mirror of
https://github.com/nodejs/node.git
synced 2026-12-03 18:03:02 -05:00
Add https.get()
This commit is contained in:
1 parent
e65f6b4ce1
commit
db8736ad93
2 files changed
+30
-1
No files matched your search
@@ -44,6 +44,8 @@ Agent.prototype._getConnection = function(host, port, cb) {
|
||||
|
||||
|
||||
function getAgent(options) {
|
||||
if (!options.port) options.port = 443;
|
||||
|
||||
var id = options.host + ':' + options.port;
|
||||
var agent = agents[id];
|
||||
|
||||
@@ -59,3 +61,11 @@ exports.request = function(options, cb) {
|
||||
var agent = getAgent(options);
|
||||
return http._requestFromAgent(agent, options, cb);
|
||||
};
|
||||
|
||||
|
||||
exports.get = function(options, cb) {
|
||||
options.method = 'GET';
|
||||
var req = exports.request(options, cb);
|
||||
req.end();
|
||||
return req;
|
||||
};
|
||||
Reference in new issue
Block a user