package
http module compatability for browserify
npm install http-browserifyGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
The http module from node.js, but for browsers.
When you require('http') in
browserify,
this module will be loaded.
var http = require('http');
http.get({ path : '/beep' }, function (res) {
var div = document.getElementById('result');
div.innerHTML += 'GET /beep<br>';
res.on('data', function (buf) {
div.innerHTML += buf;
});
res.on('end', function () {
div.innerHTML += '<br>__END__';
});
});var http = require('http');
where opts are:
opts.method='GET' - http method verbopts.path - path string, example: '/foo/bar?baz=555'opts.headers={} - as an object mapping key names to string or Array valuesopts.host=window.location.host - http hostopts.port=window.location.port - http portopts.responseType - response type to set on the underlying xhr objectThe callback will be called with the response object.
A shortcut for
options.method = 'GET';
var req = http.request(options, cb);
req.end();Set an http header.
Get an http header.
Remove an http header.
Write some data to the request body.
If only 1 piece of data is written, data can be a FormData, Blob, or
ArrayBuffer instance. Otherwise, data should be a string or a buffer.
Close and send the request body, optionally with additional data to append.
Return an http header, if set. key is case-insensitive.
This module has been tested and works with:
Multipart streaming responses are buffered in all versions of Internet Explorer
and are somewhat buffered in Opera. In all the other browsers you get a nice
unbuffered stream of "data" events when you send down a content-type of
multipart/octet-stream or similar.
You can do:
var bundle = browserify({
require : { http : 'http-browserify' }
});in order to map "http-browserify" over require('http') in your browserified
source.
With npm do:
npm install http-browserifyMIT
gkatsev
me@gkatsev.com
maxogden
max@maxogden.com
thlorenz
thlorenz10@gmail.com
terinjokes
terinjokes@gmail.com
jmm
npm-public@jessemccarthy.net
mellowmelon
palmermebane@gmail.com
ashaffer88
darawk@gmail.com
balupton
b@lupton.cc
cwmma
calvin.metcalf@gmail.com
jprichardson
jprichardson@gmail.com
indutny
blackhole@livebox.sh
jryans
jryans@gmail.com
sethvincent
sethvincent@gmail.com
yoshuawuyts
javascript@yosh.is
ungoldman
ungoldman@gmail.com
ahdinosaur
michael.williams@enspiral.com
elnounch
contact@elnounch.net
parshap
parshap+npm@gmail.com
yerkopalma
yerko.palma@usach.cl
forbeslindesay
forbes@lindesay.co.uk
leichtgewicht
martin.heidegger@gmail.com
garann
garann@gmail.com
bret
bcomnes@gmail.com
anandthakker
vestibule@anandthakker.net
mattdesl
dave.des@gmail.com
hughsk
hughskennedy@gmail.com
fpereira1
pereira.filype@gmail.com
goto-bus-stop
renee@kooi.me
bpostlethwaite
post.ben.here@gmail.com
emilbayes
github@tixz.dk
stevemao
maochenyan@gmail.com
pkrumins
peteris.krumins@gmail.com
tehshrike
me@JoshDuff.com
defunctzombie
shtylman@gmail.com
lukechilds
lukechilds123@gmail.com
raynos
raynos2@gmail.com