@whatwg-node/node-fetch 0.7.6-alpha-20250102085451-de4b863f8a6e01d74b4154a7023c6f3704af0666 → 0.7.6-alpha-20250102090748-a4646a14a0f772d8f18415dc5438bc5ddb152ee9
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/fetchNodeHttp.js +3 -10
- package/esm/fetchNodeHttp.js +3 -10
- package/package.json +1 -1
package/cjs/fetchNodeHttp.js
CHANGED
@@ -33,17 +33,10 @@ function fetchNodeHttp(fetchRequest) {
|
|
33
33
|
nodeHeaders['accept-encoding'] = 'gzip, deflate, br';
|
34
34
|
}
|
35
35
|
let nodeRequest;
|
36
|
-
//
|
37
|
-
if (fetchRequest.parsedUrl
|
38
|
-
nodeRequest = requestFn({
|
39
|
-
auth: fetchRequest.parsedUrl.username
|
40
|
-
? `${fetchRequest.parsedUrl.username}:${fetchRequest.parsedUrl.password}`
|
41
|
-
: undefined,
|
42
|
-
hostname: fetchRequest.parsedUrl.hostname,
|
36
|
+
// If it is our ponyfilled Request, it should have `parsedUrl` which is a `URL` object
|
37
|
+
if (fetchRequest.parsedUrl) {
|
38
|
+
nodeRequest = requestFn(fetchRequest.parsedUrl, {
|
43
39
|
method: fetchRequest.method,
|
44
|
-
path: fetchRequest.parsedUrl.pathname + (fetchRequest.parsedUrl.search || ''),
|
45
|
-
port: fetchRequest.parsedUrl.port,
|
46
|
-
protocol: fetchRequest.parsedUrl.protocol,
|
47
40
|
headers: nodeHeaders,
|
48
41
|
signal: fetchRequest['_signal'] ?? undefined,
|
49
42
|
agent: fetchRequest.agent,
|
package/esm/fetchNodeHttp.js
CHANGED
@@ -30,17 +30,10 @@ export function fetchNodeHttp(fetchRequest) {
|
|
30
30
|
nodeHeaders['accept-encoding'] = 'gzip, deflate, br';
|
31
31
|
}
|
32
32
|
let nodeRequest;
|
33
|
-
//
|
34
|
-
if (fetchRequest.parsedUrl
|
35
|
-
nodeRequest = requestFn({
|
36
|
-
auth: fetchRequest.parsedUrl.username
|
37
|
-
? `${fetchRequest.parsedUrl.username}:${fetchRequest.parsedUrl.password}`
|
38
|
-
: undefined,
|
39
|
-
hostname: fetchRequest.parsedUrl.hostname,
|
33
|
+
// If it is our ponyfilled Request, it should have `parsedUrl` which is a `URL` object
|
34
|
+
if (fetchRequest.parsedUrl) {
|
35
|
+
nodeRequest = requestFn(fetchRequest.parsedUrl, {
|
40
36
|
method: fetchRequest.method,
|
41
|
-
path: fetchRequest.parsedUrl.pathname + (fetchRequest.parsedUrl.search || ''),
|
42
|
-
port: fetchRequest.parsedUrl.port,
|
43
|
-
protocol: fetchRequest.parsedUrl.protocol,
|
44
37
|
headers: nodeHeaders,
|
45
38
|
signal: fetchRequest['_signal'] ?? undefined,
|
46
39
|
agent: fetchRequest.agent,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@whatwg-node/node-fetch",
|
3
|
-
"version": "0.7.6-alpha-
|
3
|
+
"version": "0.7.6-alpha-20250102090748-a4646a14a0f772d8f18415dc5438bc5ddb152ee9",
|
4
4
|
"description": "Fetch API implementation for Node",
|
5
5
|
"sideEffects": false,
|
6
6
|
"dependencies": {
|