@whatwg-node/node-fetch 0.5.20-rc-20240730143614-76ddb4acc63b332024d20ffa18898cf86b707623 → 0.5.20-rc-20240730145649-3d326c64a43b48290c8c30454172053ce6c74732
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 +10 -4
- package/esm/Request.js +12 -6
- package/package.json +1 -1
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
|
80
|
-
|
81
|
-
|
78
|
+
if (requestInit?.agent != null) {
|
79
|
+
if (requestInit?.agent === false) {
|
80
|
+
this._agent = false;
|
81
|
+
}
|
82
|
+
if (this.url.startsWith('http:/') && this._agent instanceof http_1.Agent) {
|
83
|
+
this._agent = requestInit?.agent;
|
84
|
+
}
|
85
|
+
else if (this.url.startsWith('https:/') && this._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
|
77
|
-
|
78
|
-
|
75
|
+
if (requestInit?.agent != null) {
|
76
|
+
if (requestInit?.agent === false) {
|
77
|
+
this._agent = false;
|
78
|
+
}
|
79
|
+
if (this.url.startsWith('http:/') && this._agent instanceof HTTPAgent) {
|
80
|
+
this._agent = requestInit?.agent;
|
81
|
+
}
|
82
|
+
else if (this.url.startsWith('https:/') && this._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-
|
3
|
+
"version": "0.5.20-rc-20240730145649-3d326c64a43b48290c8c30454172053ce6c74732",
|
4
4
|
"description": "Fetch API implementation for Node",
|
5
5
|
"sideEffects": false,
|
6
6
|
"dependencies": {
|