File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ const debug = common.debug;
3434const OutgoingMessage = require('_http_outgoing').OutgoingMessage;
3535const Agent = require('_http_agent');
3636const Buffer = require('buffer').Buffer;
37- const urlToOptions = require('internal/url').urlToOptions ;
37+ const { urlToOptions, searchParamsSymbol } = require('internal/url');
3838const outHeadersKey = require('internal/http').outHeadersKey;
3939const nextTick = require('internal/process/next_tick').nextTick;
4040
@@ -82,7 +82,9 @@ function ClientRequest(options, cb) {
8282 if (!options.hostname) {
8383 throw new Error('Unable to determine the domain name');
8484 }
85- } else if (options instanceof url.URL) {
85+ } else if (options && options[searchParamsSymbol] &&
86+ options[searchParamsSymbol][searchParamsSymbol]) {
87+ // url.URL instance
8688 options = urlToOptions(options);
8789 } else {
8890 options = util._extend({}, options);
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ const http = require('http');
2929const util = require('util');
3030const inherits = util.inherits;
3131const debug = util.debuglog('https');
32- const urlToOptions = require('internal/url').urlToOptions ;
32+ const { urlToOptions, searchParamsSymbol } = require('internal/url');
3333
3434function Server(opts, requestListener) {
3535 if (!(this instanceof Server)) return new Server(opts, requestListener);
@@ -221,7 +221,9 @@ exports.request = function request(options, cb) {
221221 if (!options.hostname) {
222222 throw new Error('Unable to determine the domain name');
223223 }
224- } else if (options instanceof url.URL) {
224+ } else if (options && options[searchParamsSymbol] &&
225+ options[searchParamsSymbol][searchParamsSymbol]) {
226+ // url.URL instance
225227 options = urlToOptions(options);
226228 } else {
227229 options = util._extend({}, options);
You can’t perform that action at this time.
0 commit comments