-
Notifications
You must be signed in to change notification settings - Fork 444
Open
Labels
feature requestRequest for Workers team to add a featureRequest for Workers team to add a featurenodejs compat
Description
Repro:
import { Readable } from 'node:stream';
export default {
async fetch() {
const rNode = new Request('https://example.com', {
method: 'POST',
body: Readable.from([...'node']),
});
for await (const l of rNode.body!) {
console.log(l);
}
const rWeb = new Request('https://example.com', {
method: 'POST',
body: ReadableStream.from([...'web']),
});
for await (const l of rWeb.body!) {
console.log(l);
}
return new Response('done');
},
};
Logs:
Uint8Array(15) [
91, 111, 98, 106, 101,
99, 116, 32, 79, 98,
106, 101, 99, 116, 93
] // "[object Object]"
w
e
b
Node (/undici) have extra support for AsyncIterable<Uint8Array>
, Iterable<Uint8Array>
, and null
for BodyInit
Response
can also be initialized with a BodyInit
, i.e. return new Response(bodyInit);
so we should also update the response in the same way
Metadata
Metadata
Assignees
Labels
feature requestRequest for Workers team to add a featureRequest for Workers team to add a featurenodejs compat