Open
Description
Version
v23.5.0
Platform
Linux xiaomi-mi-pro-gtx 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 5 13:09:44 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
import { Readable } from "node:stream";
const response = new Response({
async *[Symbol.asyncIterator]() {
yield '' // works only with non-empty string
}
})
const stream = Readable.fromWeb(response.body);
// const stream = Readable.from('') // works as expected
stream.on('data', chunk => {
console.log(`data: ${chunk}`)
})
stream.on('end', () => {
console.log('ended')
});
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
Similar to the Readable.from
stream, the Readable.fromWeb
stream should trigger both 'data' & 'end' events.
What do you see instead?
data
& end
events are only triggered, when the response string is not empty.
Additional information
No response