@whatwg-node/node-fetch 0.5.19 → 0.5.20-rc-20240730143614-76ddb4acc63b332024d20ffa18898cf86b707623

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.
package/cjs/Request.js CHANGED
@@ -75,7 +75,11 @@ class PonyfillRequest extends Body_js_1.PonyfillBody {
75
75
  this.contentLength = parseInt(contentLengthInHeaders, 10);
76
76
  }
77
77
  }
78
- this._agent = requestInit?.agent;
78
+ if (requestInit?.agent != null &&
79
+ requestInit?.agent !== http_1.globalAgent &&
80
+ requestInit?.agent !== https_1.globalAgent) {
81
+ this._agent = requestInit?.agent;
82
+ }
79
83
  }
80
84
  headersSerializer;
81
85
  cache;
package/cjs/fetchCurl.js CHANGED
@@ -114,7 +114,8 @@ function fetchCurl(fetchRequest) {
114
114
  const ponyfillResponse = new Response_js_1.PonyfillResponse(outputStream, {
115
115
  status,
116
116
  headers: headersInit,
117
- url: fetchRequest.url,
117
+ url: curlHandle.getInfo(Curl.info.REDIRECT_URL)?.toString() || fetchRequest.url,
118
+ redirected: Number(curlHandle.getInfo(Curl.info.REDIRECT_COUNT)) > 0,
118
119
  });
119
120
  resolve(ponyfillResponse);
120
121
  streamResolved = outputStream;
package/esm/Request.js CHANGED
@@ -72,7 +72,11 @@ export class PonyfillRequest extends PonyfillBody {
72
72
  this.contentLength = parseInt(contentLengthInHeaders, 10);
73
73
  }
74
74
  }
75
- this._agent = requestInit?.agent;
75
+ if (requestInit?.agent != null &&
76
+ requestInit?.agent !== httpGlobalAgent &&
77
+ requestInit?.agent !== httpsGlobalAgent) {
78
+ this._agent = requestInit?.agent;
79
+ }
76
80
  }
77
81
  headersSerializer;
78
82
  cache;
package/esm/fetchCurl.js CHANGED
@@ -111,7 +111,8 @@ export function fetchCurl(fetchRequest) {
111
111
  const ponyfillResponse = new PonyfillResponse(outputStream, {
112
112
  status,
113
113
  headers: headersInit,
114
- url: fetchRequest.url,
114
+ url: curlHandle.getInfo(Curl.info.REDIRECT_URL)?.toString() || fetchRequest.url,
115
+ redirected: Number(curlHandle.getInfo(Curl.info.REDIRECT_COUNT)) > 0,
115
116
  });
116
117
  resolve(ponyfillResponse);
117
118
  streamResolved = outputStream;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.5.19",
3
+ "version": "0.5.20-rc-20240730143614-76ddb4acc63b332024d20ffa18898cf86b707623",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {