@whatwg-node/node-fetch 0.8.4 → 0.8.5-alpha-20251204161910-2003e62893209e3fa3217923be080639992c9e3d
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/fetchNodeHttp.js +3 -0
- package/cjs/utils.js +1 -1
- package/esm/fetchNodeHttp.js +3 -0
- package/esm/utils.js +1 -1
- package/package.json +1 -1
- package/typings/utils.d.cts +2 -2
- package/typings/utils.d.ts +2 -2
package/cjs/fetchNodeHttp.js
CHANGED
|
@@ -131,6 +131,9 @@ function fetchNodeHttp(fetchRequest) {
|
|
|
131
131
|
if (fetchRequest['_buffer'] != null) {
|
|
132
132
|
(0, promise_helpers_1.handleMaybePromise)(() => (0, utils_js_1.safeWrite)(fetchRequest['_buffer'], nodeRequest), () => (0, utils_js_1.endStream)(nodeRequest), reject);
|
|
133
133
|
}
|
|
134
|
+
else if (fetchRequest['bodyType'] === 'String') {
|
|
135
|
+
(0, promise_helpers_1.handleMaybePromise)(() => (0, utils_js_1.safeWrite)(fetchRequest['bodyInit'], nodeRequest), () => (0, utils_js_1.endStream)(nodeRequest), reject);
|
|
136
|
+
}
|
|
134
137
|
else {
|
|
135
138
|
const nodeReadable = (fetchRequest.body != null
|
|
136
139
|
? (0, utils_js_1.isNodeReadable)(fetchRequest.body)
|
package/cjs/utils.js
CHANGED
|
@@ -96,7 +96,7 @@ function pipeThrough({ src, dest, signal, onError, }) {
|
|
|
96
96
|
src.pipe(dest, { end: true /* already default */ });
|
|
97
97
|
}
|
|
98
98
|
function endStream(stream) {
|
|
99
|
-
//
|
|
99
|
+
// Avoid arguments adaptor trampoline https://v8.dev/blog/adaptor-frame
|
|
100
100
|
return stream.end(null, null, null);
|
|
101
101
|
}
|
|
102
102
|
function safeWrite(chunk, stream) {
|
package/esm/fetchNodeHttp.js
CHANGED
|
@@ -127,6 +127,9 @@ export function fetchNodeHttp(fetchRequest) {
|
|
|
127
127
|
if (fetchRequest['_buffer'] != null) {
|
|
128
128
|
handleMaybePromise(() => safeWrite(fetchRequest['_buffer'], nodeRequest), () => endStream(nodeRequest), reject);
|
|
129
129
|
}
|
|
130
|
+
else if (fetchRequest['bodyType'] === 'String') {
|
|
131
|
+
handleMaybePromise(() => safeWrite(fetchRequest['bodyInit'], nodeRequest), () => endStream(nodeRequest), reject);
|
|
132
|
+
}
|
|
130
133
|
else {
|
|
131
134
|
const nodeReadable = (fetchRequest.body != null
|
|
132
135
|
? isNodeReadable(fetchRequest.body)
|
package/esm/utils.js
CHANGED
|
@@ -81,7 +81,7 @@ export function pipeThrough({ src, dest, signal, onError, }) {
|
|
|
81
81
|
src.pipe(dest, { end: true /* already default */ });
|
|
82
82
|
}
|
|
83
83
|
export function endStream(stream) {
|
|
84
|
-
//
|
|
84
|
+
// Avoid arguments adaptor trampoline https://v8.dev/blog/adaptor-frame
|
|
85
85
|
return stream.end(null, null, null);
|
|
86
86
|
}
|
|
87
87
|
export function safeWrite(chunk, stream) {
|
package/package.json
CHANGED
package/typings/utils.d.cts
CHANGED
|
@@ -14,8 +14,8 @@ export declare function pipeThrough({ src, dest, signal, onError, }: {
|
|
|
14
14
|
onError?: ((e: Error) => void) | undefined;
|
|
15
15
|
}): void;
|
|
16
16
|
export declare function endStream(stream: {
|
|
17
|
-
end: () => void;
|
|
17
|
+
end: (...args: any[]) => void;
|
|
18
18
|
}): void;
|
|
19
|
-
export declare function safeWrite(chunk:
|
|
19
|
+
export declare function safeWrite<TWritable extends Writable>(chunk: Parameters<TWritable['write']>[0], stream: TWritable): Promise<any[]> | undefined;
|
|
20
20
|
export declare const DEFAULT_ACCEPT_ENCODING: string;
|
|
21
21
|
export declare function getSupportedFormats(): PonyfillCompressionFormat[];
|
package/typings/utils.d.ts
CHANGED
|
@@ -14,8 +14,8 @@ export declare function pipeThrough({ src, dest, signal, onError, }: {
|
|
|
14
14
|
onError?: ((e: Error) => void) | undefined;
|
|
15
15
|
}): void;
|
|
16
16
|
export declare function endStream(stream: {
|
|
17
|
-
end: () => void;
|
|
17
|
+
end: (...args: any[]) => void;
|
|
18
18
|
}): void;
|
|
19
|
-
export declare function safeWrite(chunk:
|
|
19
|
+
export declare function safeWrite<TWritable extends Writable>(chunk: Parameters<TWritable['write']>[0], stream: TWritable): Promise<any[]> | undefined;
|
|
20
20
|
export declare const DEFAULT_ACCEPT_ENCODING: string;
|
|
21
21
|
export declare function getSupportedFormats(): PonyfillCompressionFormat[];
|