Add https.get()

This commit is contained in:
Ryan Dahl committed 2011-01-21 13:21:01 -08:00
1 parent e65f6b4ce1
commit db8736ad93
2 files changed
+30 -1

No files matched your search

+10
View File
@@ -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;
};