@whatwg-node/node-fetch 0.5.5-rc-20240125133601-fc7e289c722a90228b02f5403948b1d44cbc2235 → 0.5.5
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 +12 -0
- package/cjs/Request.js +3 -0
- package/esm/Body.js +12 -0
- package/esm/Request.js +3 -0
- package/package.json +1 -1
- package/typings/Request.d.cts +1 -0
- package/typings/Request.d.ts +1 -0
package/cjs/Body.js
CHANGED
@@ -318,6 +318,15 @@ function processBodyInit(bodyInit) {
|
|
318
318
|
},
|
319
319
|
};
|
320
320
|
}
|
321
|
+
if (isReadableStream(bodyInit)) {
|
322
|
+
return {
|
323
|
+
contentType: null,
|
324
|
+
contentLength: null,
|
325
|
+
bodyFactory() {
|
326
|
+
return new ReadableStream_js_1.PonyfillReadableStream(bodyInit);
|
327
|
+
},
|
328
|
+
};
|
329
|
+
}
|
321
330
|
if (bodyInit[Symbol.iterator] || bodyInit[Symbol.asyncIterator]) {
|
322
331
|
return {
|
323
332
|
contentType: null,
|
@@ -339,3 +348,6 @@ function isBlob(value) {
|
|
339
348
|
function isURLSearchParams(value) {
|
340
349
|
return value?.sort != null;
|
341
350
|
}
|
351
|
+
function isReadableStream(value) {
|
352
|
+
return value?.getReader != null;
|
353
|
+
}
|
package/cjs/Request.js
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
"use strict";
|
2
|
+
var _a;
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
4
|
exports.PonyfillRequest = void 0;
|
4
5
|
const Body_js_1 = require("./Body.js");
|
@@ -30,6 +31,7 @@ class PonyfillRequest extends Body_js_1.PonyfillBody {
|
|
30
31
|
requestInit = options;
|
31
32
|
}
|
32
33
|
super(bodyInit, options);
|
34
|
+
this[_a] = 'Request';
|
33
35
|
this.cache = requestInit?.cache || 'default';
|
34
36
|
this.credentials = requestInit?.credentials || 'same-origin';
|
35
37
|
this.headers =
|
@@ -82,3 +84,4 @@ class PonyfillRequest extends Body_js_1.PonyfillBody {
|
|
82
84
|
}
|
83
85
|
}
|
84
86
|
exports.PonyfillRequest = PonyfillRequest;
|
87
|
+
_a = Symbol.toStringTag;
|
package/esm/Body.js
CHANGED
@@ -313,6 +313,15 @@ function processBodyInit(bodyInit) {
|
|
313
313
|
},
|
314
314
|
};
|
315
315
|
}
|
316
|
+
if (isReadableStream(bodyInit)) {
|
317
|
+
return {
|
318
|
+
contentType: null,
|
319
|
+
contentLength: null,
|
320
|
+
bodyFactory() {
|
321
|
+
return new PonyfillReadableStream(bodyInit);
|
322
|
+
},
|
323
|
+
};
|
324
|
+
}
|
316
325
|
if (bodyInit[Symbol.iterator] || bodyInit[Symbol.asyncIterator]) {
|
317
326
|
return {
|
318
327
|
contentType: null,
|
@@ -334,3 +343,6 @@ function isBlob(value) {
|
|
334
343
|
function isURLSearchParams(value) {
|
335
344
|
return value?.sort != null;
|
336
345
|
}
|
346
|
+
function isReadableStream(value) {
|
347
|
+
return value?.getReader != null;
|
348
|
+
}
|
package/esm/Request.js
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
var _a;
|
1
2
|
import { PonyfillBody } from './Body.js';
|
2
3
|
import { isHeadersLike, PonyfillHeaders } from './Headers.js';
|
3
4
|
function isRequest(input) {
|
@@ -27,6 +28,7 @@ export class PonyfillRequest extends PonyfillBody {
|
|
27
28
|
requestInit = options;
|
28
29
|
}
|
29
30
|
super(bodyInit, options);
|
31
|
+
this[_a] = 'Request';
|
30
32
|
this.cache = requestInit?.cache || 'default';
|
31
33
|
this.credentials = requestInit?.credentials || 'same-origin';
|
32
34
|
this.headers =
|
@@ -78,3 +80,4 @@ export class PonyfillRequest extends PonyfillBody {
|
|
78
80
|
return new PonyfillRequest(this);
|
79
81
|
}
|
80
82
|
}
|
83
|
+
_a = Symbol.toStringTag;
|
package/package.json
CHANGED
package/typings/Request.d.cts
CHANGED