You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deno.serve((req: Request)=>{req.signal.addEventListener("abort",()=>{console.log("Request aborted on the server side:",req.signal.aborted);});returnnewResponse("Hello, World!");});constconstructor=newAbortController();const{ signal }=constructor;constres=awaitfetch("http://localhost:8000",{ signal });console.log(awaitres.text());console.log("Request aborted on the client side:",signal.aborted);
Prints:
Request aborted on the server side: true
Hello, World!
Request aborted on the client side: false
This is awkward, and may even lead to potential bugs.
Bun doesn't seem to have this problem.
The text was updated successfully, but these errors were encountered:
This has been intended behavior ever since request abort signals were introduced in Deno.serve. All request signals are aborted when it completes (marking them as completed).
ayonli
changed the title
Deno.serve: request.signal is aborted even the response finished successfully
Deno.serve: request.signal is aborted even though the response finished successfully
Nov 23, 2024
This has been intended behavior ever since request abort signals were introduced in Deno.serve. All request signals are aborted when it completes (marking them as completed).
I just updated the example, please check again the oddness of this design.
Version: Deno 2.1.1
Example:
Prints:
This is awkward, and may even lead to potential bugs.
Bun doesn't seem to have this problem.
The text was updated successfully, but these errors were encountered: