summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorkoichik <koichik@improvement.jp>2012-08-18 14:18:02 +0900
committerBen Noordhuis <info@bnoordhuis.nl>2012-08-24 16:56:06 +0200
commit752ac320ae48d266fdc5d61a3963857b8f343c10 (patch)
treed8121ef8ff5705d6c7e909570a8c74d2f7de6d80 /lib
parent59011448c0c47a1ad374f5b184d2627fc68c06bd (diff)
downloadandroid-node-v8-752ac320ae48d266fdc5d61a3963857b8f343c10.tar.gz
android-node-v8-752ac320ae48d266fdc5d61a3963857b8f343c10.tar.bz2
android-node-v8-752ac320ae48d266fdc5d61a3963857b8f343c10.zip
https: make https.get() accept a URL
https.get() now accepts either a URL (as a string) or an options object. Refs #2859. Fixes #3882.
Diffstat (limited to 'lib')
-rw-r--r--lib/https.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/https.js b/lib/https.js
index 9778354007..a243b2bc2e 100644
--- a/lib/https.js
+++ b/lib/https.js
@@ -21,6 +21,7 @@
var tls = require('tls');
var http = require('http');
+var url = require('url');
var inherits = require('util').inherits;
function Server(opts, requestListener) {
@@ -88,6 +89,10 @@ exports.globalAgent = globalAgent;
exports.Agent = Agent;
exports.request = function(options, cb) {
+ if (typeof options === 'string') {
+ options = url.parse(options);
+ }
+
if (options.protocol && options.protocol !== 'https:') {
throw new Error('Protocol:' + options.protocol + ' not supported.');
}