Skip to content

Commit ec2a920

Browse files
committed
fix: Set preventAbort to true on the pipeThrough as to work around an issue in Deno where an uncatchable exception is thrown if/when the client aborts the incoming request.
denoland/deno#27715
1 parent aeaacbe commit ec2a920

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/html_rewriter_wrapper.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,15 @@ export class HTMLRewriter {
4747
});
4848

4949
// Return a response with the transformed body, copying over headers, etc
50-
const res = new Response(body.pipeThrough(transformStream), response);
50+
const res = new Response(
51+
body.pipeThrough(transformStream, {
52+
// Work around an issue in Deno where an uncatchable exception is thrown
53+
// if/when the client aborts the incoming request.
54+
// https://github.com/denoland/deno/issues/27715
55+
preventAbort: true,
56+
}),
57+
response,
58+
);
5159
// If Content-Length is set, it's probably going to be wrong, since we're
5260
// rewriting content, so remove it
5361
res.headers.delete("Content-Length");

0 commit comments

Comments
 (0)