mirror of
https://github.com/nodejs/node-v0.x-archive.git
synced 2026-04-28 03:01:10 -04:00
http.request(url.parse(x))
http2.js protocols object to store defaults for http and https, and use as a switch for supported protocols. options.hostname > options.host > 'localhost' if I have an options.auth element and I do not have an Authorization header, I do basic auth. http.request collapses to new ClientRequest since the defaults are handled by the protocol object test-http-url.parse* Fixes #1390 Conflicts: lib/http2.js
This commit is contained in:
@@ -68,12 +68,16 @@ exports.globalAgent = globalAgent;
|
||||
exports.Agent = Agent;
|
||||
|
||||
exports.request = function(options, cb) {
|
||||
if (options.protocol && options.protocol !== 'https:') {
|
||||
throw new Error('Protocol:' + options.protocol + ' not supported.');
|
||||
}
|
||||
|
||||
if (options.agent === undefined) {
|
||||
options.agent = globalAgent;
|
||||
}
|
||||
options.createConnection = createConnection;
|
||||
options.defaultPort = options.defaultPort || 443;
|
||||
return http.request(options, cb);
|
||||
return new http.ClientRequest(options, cb);
|
||||
};
|
||||
|
||||
exports.get = function(options, cb) {
|
||||
|
||||
Reference in New Issue
Block a user