@whatwg-node/node-fetch 0.7.8-alpha-20250122134914-14266b4231406ede9b9179c23b41bf6e6ed0ce35 → 0.7.8-alpha-20250122135701-d1a6e1b2227c25bd4b427747363078b8b9d744ad
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/fetchUndici.js +11 -11
- package/esm/fetchUndici.js +3 -3
- package/package.json +1 -1
package/cjs/fetchUndici.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.createFetchUndici = createFetchUndici;
|
4
|
-
const
|
5
|
-
const types_1 = require("util/types");
|
6
|
-
const
|
4
|
+
const node_stream_1 = require("node:stream");
|
5
|
+
const types_1 = require("node:util/types");
|
6
|
+
const node_zlib_1 = require("node:zlib");
|
7
7
|
const fetchNodeHttp_js_1 = require("./fetchNodeHttp.js");
|
8
8
|
const Request_js_1 = require("./Request.js");
|
9
9
|
const Response_js_1 = require("./Response.js");
|
@@ -25,7 +25,7 @@ function createFetchUndici(getGlobalDispatcher) {
|
|
25
25
|
if (typeof bodyInit === 'string' ||
|
26
26
|
Buffer.isBuffer(bodyInit) ||
|
27
27
|
(0, types_1.isUint8Array)(bodyInit) ||
|
28
|
-
bodyInit instanceof
|
28
|
+
bodyInit instanceof node_stream_1.Readable) {
|
29
29
|
body = bodyInit;
|
30
30
|
}
|
31
31
|
else if (fetchRequest.body != null) {
|
@@ -33,7 +33,7 @@ function createFetchUndici(getGlobalDispatcher) {
|
|
33
33
|
body = fetchRequest.body.readable;
|
34
34
|
}
|
35
35
|
else {
|
36
|
-
body =
|
36
|
+
body = node_stream_1.Readable.from(fetchRequest.body);
|
37
37
|
}
|
38
38
|
}
|
39
39
|
}
|
@@ -41,21 +41,21 @@ function createFetchUndici(getGlobalDispatcher) {
|
|
41
41
|
switch (contentEncoding) {
|
42
42
|
case 'x-gzip':
|
43
43
|
case 'gzip':
|
44
|
-
passthrough = (0,
|
44
|
+
passthrough = (0, node_zlib_1.createGunzip)();
|
45
45
|
break;
|
46
46
|
case 'x-deflate':
|
47
47
|
case 'deflate':
|
48
|
-
passthrough = (0,
|
48
|
+
passthrough = (0, node_zlib_1.createInflate)();
|
49
49
|
break;
|
50
50
|
case 'x-deflate-raw':
|
51
51
|
case 'deflate-raw':
|
52
|
-
passthrough = (0,
|
52
|
+
passthrough = (0, node_zlib_1.createInflateRaw)();
|
53
53
|
break;
|
54
54
|
case 'br':
|
55
|
-
passthrough = (0,
|
55
|
+
passthrough = (0, node_zlib_1.createBrotliDecompress)();
|
56
56
|
break;
|
57
57
|
default:
|
58
|
-
passthrough = new
|
58
|
+
passthrough = new node_stream_1.PassThrough();
|
59
59
|
}
|
60
60
|
return passthrough;
|
61
61
|
}
|
@@ -158,7 +158,7 @@ function createFetchUndici(getGlobalDispatcher) {
|
|
158
158
|
}
|
159
159
|
return header;
|
160
160
|
});
|
161
|
-
passthrough ||= new
|
161
|
+
passthrough ||= new node_stream_1.PassThrough();
|
162
162
|
resolve(new Response_js_1.PonyfillResponse(passthrough, {
|
163
163
|
status: statusCode,
|
164
164
|
statusText,
|
package/esm/fetchUndici.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import { PassThrough, Readable } from 'stream';
|
2
|
-
import { isUint8Array } from 'util/types';
|
3
|
-
import { createBrotliDecompress, createGunzip, createInflate, createInflateRaw } from 'zlib';
|
1
|
+
import { PassThrough, Readable } from 'node:stream';
|
2
|
+
import { isUint8Array } from 'node:util/types';
|
3
|
+
import { createBrotliDecompress, createGunzip, createInflate, createInflateRaw } from 'node:zlib';
|
4
4
|
import { fetchNodeHttp } from './fetchNodeHttp.js';
|
5
5
|
import { PonyfillRequest } from './Request.js';
|
6
6
|
import { PonyfillResponse } from './Response.js';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@whatwg-node/node-fetch",
|
3
|
-
"version": "0.7.8-alpha-
|
3
|
+
"version": "0.7.8-alpha-20250122135701-d1a6e1b2227c25bd4b427747363078b8b9d744ad",
|
4
4
|
"description": "Fetch API implementation for Node",
|
5
5
|
"sideEffects": false,
|
6
6
|
"dependencies": {
|