summaryrefslogtreecommitdiff
path: root/lib/https.js
diff options
context:
space:
mode:
authorBrian White <mscdex@mscdex.net>2017-05-11 17:57:53 -0400
committerBrian White <mscdex@mscdex.net>2017-05-22 18:07:27 -0400
commited365653f6eb74d58a1d2a1c1bdb20e4baf67fa0 (patch)
tree6cc0507dcd1eeab68d4a2613ff802c64b9a0bd8f /lib/https.js
parentdcc59f91c68e2bedd489aab4499ef8637c5ae419 (diff)
downloadnode-new-ed365653f6eb74d58a1d2a1c1bdb20e4baf67fa0.tar.gz
http,https: avoid instanceof for WHATWG URL
PR-URL: https://github.com/nodejs/node/pull/12983 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Timothy Gu <timothygu99@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'lib/https.js')
-rw-r--r--lib/https.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/https.js b/lib/https.js
index 1ca546ac10..f0ecbd90a6 100644
--- a/lib/https.js
+++ b/lib/https.js
@@ -29,7 +29,7 @@ const http = require('http');
const util = require('util');
const inherits = util.inherits;
const debug = util.debuglog('https');
-const urlToOptions = require('internal/url').urlToOptions;
+const { urlToOptions, searchParamsSymbol } = require('internal/url');
function Server(opts, requestListener) {
if (!(this instanceof Server)) return new Server(opts, requestListener);
@@ -221,7 +221,9 @@ exports.request = function request(options, cb) {
if (!options.hostname) {
throw new Error('Unable to determine the domain name');
}
- } else if (options instanceof url.URL) {
+ } else if (options && options[searchParamsSymbol] &&
+ options[searchParamsSymbol][searchParamsSymbol]) {
+ // url.URL instance
options = urlToOptions(options);
} else {
options = util._extend({}, options);