在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:browserify/http-browserify开源软件地址:https://github.com/browserify/http-browserify开源编程语言:JavaScript 100.0%开源软件介绍:http-browserifyThe http module from node.js, but for browsers. When you examplevar 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__';
});
}); http methodsvar http = require('http'); var req = http.request(opts, cb)where
The callback will be called with the response object. var req = http.get(options, cb)A shortcut for options.method = 'GET';
var req = http.request(options, cb);
req.end(); request methodsreq.setHeader(key, value)Set an http header. req.getHeader(key)Get an http header. req.removeHeader(key)Remove an http header. req.write(data)Write some data to the request body. If only 1 piece of data is written, req.end(data)Close and send the request body, optionally with additional response methodsres.getHeader(key)Return an http header, if set. response attributes
compatibilityThis 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 protipYou can do: var bundle = browserify({
require : { http : 'http-browserify' }
}); in order to map "http-browserify" over installWith npm do:
licenseMIT |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论