@whatwg-node/node-fetch 0.5.20-rc-20240730143614-76ddb4acc63b332024d20ffa18898cf86b707623 → 0.5.20-rc-20240730162055-2138d30b4ce4d4386c395f17634ea3a25aa6c171

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,10 +75,16 @@ class PonyfillRequest extends Body_js_1.PonyfillBody {
75
75
  this.contentLength = parseInt(contentLengthInHeaders, 10);
76
76
  }
77
77
  }
78
- if (requestInit?.agent != null &&
79
- requestInit?.agent !== http_1.globalAgent &&
80
- requestInit?.agent !== https_1.globalAgent) {
81
- this._agent = requestInit?.agent;
78
+ if (requestInit?.agent != null) {
79
+ if (requestInit.agent === false) {
80
+ this._agent = false;
81
+ }
82
+ else if (this.url.startsWith('http:/') && requestInit.agent instanceof http_1.Agent) {
83
+ this._agent = requestInit?.agent;
84
+ }
85
+ else if (this.url.startsWith('https:/') && requestInit.agent instanceof https_1.Agent) {
86
+ this._agent = requestInit?.agent;
87
+ }
82
88
  }
83
89
  }
84
90
  headersSerializer;
package/esm/Request.js CHANGED
@@ -1,5 +1,5 @@
1
- import { globalAgent as httpGlobalAgent } from 'http';
2
- import { globalAgent as httpsGlobalAgent } from 'https';
1
+ import { Agent as HTTPAgent, globalAgent as httpGlobalAgent } from 'http';
2
+ import { Agent as HTTPSAgent, globalAgent as httpsGlobalAgent } from 'https';
3
3
  import { PonyfillBody } from './Body.js';
4
4
  import { isHeadersLike, PonyfillHeaders } from './Headers.js';
5
5
  function isRequest(input) {
@@ -72,10 +72,16 @@ export class PonyfillRequest extends PonyfillBody {
72
72
  this.contentLength = parseInt(contentLengthInHeaders, 10);
73
73
  }
74
74
  }
75
- if (requestInit?.agent != null &&
76
- requestInit?.agent !== httpGlobalAgent &&
77
- requestInit?.agent !== httpsGlobalAgent) {
78
- this._agent = requestInit?.agent;
75
+ if (requestInit?.agent != null) {
76
+ if (requestInit.agent === false) {
77
+ this._agent = false;
78
+ }
79
+ else if (this.url.startsWith('http:/') && requestInit.agent instanceof HTTPAgent) {
80
+ this._agent = requestInit?.agent;
81
+ }
82
+ else if (this.url.startsWith('https:/') && requestInit.agent instanceof HTTPSAgent) {
83
+ this._agent = requestInit?.agent;
84
+ }
79
85
  }
80
86
  }
81
87
  headersSerializer;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whatwg-node/node-fetch",
3
- "version": "0.5.20-rc-20240730143614-76ddb4acc63b332024d20ffa18898cf86b707623",
3
+ "version": "0.5.20-rc-20240730162055-2138d30b4ce4d4386c395f17634ea3a25aa6c171",
4
4
  "description": "Fetch API implementation for Node",
5
5
  "sideEffects": false,
6
6
  "dependencies": {