Hi everyone, does anyone know whats the
Hi everyone, does anyone know whats the issue of Response Stream not properly working:
fetch(request, env, ctx){
let { readable, writable } = new TransformStream();
let writer = writable.getWriter();
const textEncoder = new TextEncoder();
ctx.waitUntil((async () => {
writer.write(textEncoder.encode("Hi "));
await new Promise((resolve)=> setTimeout(resolve, 1000))
writer.write(textEncoder.encode("How "));
await new Promise((resolve)=> setTimeout(resolve, 1000))
writer.write(textEncoder.encode("Are "));
await new Promise((resolve)=> setTimeout(resolve, 1000))
writer.write(textEncoder.encode("You?"));
writer.close();
})());
// Send the readable back to the browser
return new Response(readable);
},
1 Reply
Just want to get back with this, this is not working in postman, but straight away to client like axios works properly