LeonL
Denoβ€’2y agoβ€’
6 replies
Leon

How To Add .done method for new Response();

Add a .done method to new Response() to ensure that the response was delivered to the client.

function handler(_req) {
const res = new Response(null, { headers });

if(res.done) {
// ... Execute if the response is guaranteed to be delivered to the client.
}

return res;
}
Deno.serve({ port: 80, handler });
Was this page helpful?