mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
url: expose urlToHttpOptions utility
PR-URL: https://github.com/nodejs/node/pull/35960 Fixes: https://github.com/nodejs/node/issues/34349 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
1 parent
3ea37c2d67
commit
64fed319ef
7 files changed
+95
-46
No files matched your search
+3
-3
@@ -48,7 +48,7 @@ const { ClientRequest } = require('_http_client');
|
||||
let debug = require('internal/util/debuglog').debuglog('https', (fn) => {
|
||||
debug = fn;
|
||||
});
|
||||
const { URL, urlToOptions, searchParamsSymbol } = require('internal/url');
|
||||
const { URL, urlToHttpOptions, searchParamsSymbol } = require('internal/url');
|
||||
const { IncomingMessage, ServerResponse } = require('http');
|
||||
const { kIncomingMessage } = require('_http_common');
|
||||
|
||||
@@ -303,7 +303,7 @@ function request(...args) {
|
||||
if (typeof args[0] === 'string') {
|
||||
const urlStr = ArrayPrototypeShift(args);
|
||||
try {
|
||||
options = urlToOptions(new URL(urlStr));
|
||||
options = urlToHttpOptions(new URL(urlStr));
|
||||
} catch (err) {
|
||||
options = url.parse(urlStr);
|
||||
if (!options.hostname) {
|
||||
@@ -320,7 +320,7 @@ function request(...args) {
|
||||
} else if (args[0] && args[0][searchParamsSymbol] &&
|
||||
args[0][searchParamsSymbol][searchParamsSymbol]) {
|
||||
// url.URL instance
|
||||
options = urlToOptions(ArrayPrototypeShift(args));
|
||||
options = urlToHttpOptions(ArrayPrototypeShift(args));
|
||||
}
|
||||
|
||||
if (args[0] && typeof args[0] !== 'function') {
|
||||
|
||||
Reference in new issue
Block a user