@whatwg-node/node-fetch 0.7.15 → 0.7.17-alpha-20250325145529-58232171d1f56e9f26b72ecd5acfffe6680802dc
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/Body.js +5 -2
- package/esm/Body.js +5 -2
- package/package.json +1 -1
package/cjs/Body.js
CHANGED
@@ -6,6 +6,7 @@ const tslib_1 = require("tslib");
|
|
6
6
|
const node_buffer_1 = require("node:buffer");
|
7
7
|
const node_http_1 = require("node:http");
|
8
8
|
const node_stream_1 = require("node:stream");
|
9
|
+
const promises_1 = require("node:stream/promises");
|
9
10
|
const busboy_1 = tslib_1.__importDefault(require("busboy"));
|
10
11
|
const promise_helpers_1 = require("@whatwg-node/promise-helpers");
|
11
12
|
const Blob_js_1 = require("./Blob.js");
|
@@ -401,10 +402,12 @@ function processBodyInit(bodyInit, signal) {
|
|
401
402
|
};
|
402
403
|
}
|
403
404
|
if (bodyInit instanceof node_http_1.IncomingMessage) {
|
404
|
-
const passThrough =
|
405
|
+
const passThrough = new node_stream_1.PassThrough();
|
406
|
+
(0, promises_1.pipeline)(bodyInit, passThrough, {
|
405
407
|
signal,
|
406
|
-
}), {
|
407
408
|
end: true,
|
409
|
+
}).catch(e => {
|
410
|
+
passThrough.destroy(e);
|
408
411
|
});
|
409
412
|
return {
|
410
413
|
bodyType: BodyInitType.Readable,
|
package/esm/Body.js
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
import { Buffer } from 'node:buffer';
|
3
3
|
import { IncomingMessage } from 'node:http';
|
4
4
|
import { PassThrough, Readable } from 'node:stream';
|
5
|
+
import { pipeline } from 'node:stream/promises';
|
5
6
|
import busboy from 'busboy';
|
6
7
|
import { handleMaybePromise } from '@whatwg-node/promise-helpers';
|
7
8
|
import { hasArrayBufferMethod, hasBufferMethod, hasBytesMethod, PonyfillBlob } from './Blob.js';
|
@@ -396,10 +397,12 @@ function processBodyInit(bodyInit, signal) {
|
|
396
397
|
};
|
397
398
|
}
|
398
399
|
if (bodyInit instanceof IncomingMessage) {
|
399
|
-
const passThrough =
|
400
|
+
const passThrough = new PassThrough();
|
401
|
+
pipeline(bodyInit, passThrough, {
|
400
402
|
signal,
|
401
|
-
}), {
|
402
403
|
end: true,
|
404
|
+
}).catch(e => {
|
405
|
+
passThrough.destroy(e);
|
403
406
|
});
|
404
407
|
return {
|
405
408
|
bodyType: BodyInitType.Readable,
|
package/package.json
CHANGED