@whatwg-node/node-fetch 0.7.6-alpha-20250102090222-b3df3a37f8f87ca84ae46c16473ebd0dcf369462 → 0.7.6-alpha-20250102090748-a4646a14a0f772d8f18415dc5438bc5ddb152ee9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,17 +33,10 @@ function fetchNodeHttp(fetchRequest) {
33
33
  nodeHeaders['accept-encoding'] = 'gzip, deflate, br';
34
34
  }
35
35
  let nodeRequest;
36
- // Skip using parsed URL if it's an IPv6 address (starting with brackets)
37
- if (fetchRequest.parsedUrl && !fetchRequest.parsedUrl.hostname?.startsWith('[')) {
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,
@@ -30,17 +30,10 @@ export function fetchNodeHttp(fetchRequest) {
30
30
  nodeHeaders['accept-encoding'] = 'gzip, deflate, br';
31
31
  }
32
32
  let nodeRequest;
33
- // Skip using parsed URL if it's an IPv6 address (starting with brackets)
34
- if (fetchRequest.parsedUrl && !fetchRequest.parsedUrl.hostname?.startsWith('[')) {
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-20250102090222-b3df3a37f8f87ca84ae46c16473ebd0dcf369462",
3
+ "version": "0.7.6-alpha-20250102090748-a4646a14a0f772d8f18415dc5438bc5ddb152ee9",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {