File tree 2 files changed +8
-4
lines changed
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;
34
34
const OutgoingMessage = require ( '_http_outgoing' ) . OutgoingMessage ;
35
35
const Agent = require ( '_http_agent' ) ;
36
36
const Buffer = require ( 'buffer' ) . Buffer ;
37
- const urlToOptions = require ( 'internal/url' ) . urlToOptions ;
37
+ const { urlToOptions, searchParamsSymbol } = require ( 'internal/url' ) ;
38
38
const outHeadersKey = require ( 'internal/http' ) . outHeadersKey ;
39
39
const nextTick = require ( 'internal/process/next_tick' ) . nextTick ;
40
40
@@ -82,7 +82,9 @@ function ClientRequest(options, cb) {
82
82
if ( ! options . hostname ) {
83
83
throw new Error ( 'Unable to determine the domain name' ) ;
84
84
}
85
- } else if ( options instanceof url . URL ) {
85
+ } else if ( options && options [ searchParamsSymbol ] &&
86
+ options [ searchParamsSymbol ] [ searchParamsSymbol ] ) {
87
+ // url.URL instance
86
88
options = urlToOptions ( options ) ;
87
89
} else {
88
90
options = util . _extend ( { } , options ) ;
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ const http = require('http');
29
29
const util = require ( 'util' ) ;
30
30
const inherits = util . inherits ;
31
31
const debug = util . debuglog ( 'https' ) ;
32
- const urlToOptions = require ( 'internal/url' ) . urlToOptions ;
32
+ const { urlToOptions, searchParamsSymbol } = require ( 'internal/url' ) ;
33
33
34
34
function Server ( opts , requestListener ) {
35
35
if ( ! ( this instanceof Server ) ) return new Server ( opts , requestListener ) ;
@@ -221,7 +221,9 @@ exports.request = function request(options, cb) {
221
221
if ( ! options . hostname ) {
222
222
throw new Error ( 'Unable to determine the domain name' ) ;
223
223
}
224
- } else if ( options instanceof url . URL ) {
224
+ } else if ( options && options [ searchParamsSymbol ] &&
225
+ options [ searchParamsSymbol ] [ searchParamsSymbol ] ) {
226
+ // url.URL instance
225
227
options = urlToOptions ( options ) ;
226
228
} else {
227
229
options = util . _extend ( { } , options ) ;
You can’t perform that action at this time.
0 commit comments