Skip to content

Commit 3fd8d77

Browse files
committed
fix: ensure background work is finished when response has 3xx or 5xx status code
1 parent 62ed00c commit 3fd8d77

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

Diff for: src/run/handlers/server.ts

-11
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,6 @@ export default async (request: Request) => {
113113
setVaryHeaders(response.headers, request, nextConfig)
114114
setCacheStatusHeader(response.headers)
115115

116-
// Temporary workaround for an issue where sending a response with an empty
117-
// body causes an unhandled error. This doesn't catch everything, but redirects are the
118-
// most common case of sending empty bodies. We can't check it directly because these are streams.
119-
// The side effect is that responses which do contain data will not be streamed to the client,
120-
// but that's fine for redirects.
121-
// TODO: Remove once a fix has been rolled out.
122-
if ((response.status > 300 && response.status < 400) || response.status >= 500) {
123-
const body = await response.text()
124-
return new Response(body || null, response)
125-
}
126-
127116
const keepOpenUntilNextFullyRendered = new TransformStream({
128117
async flush() {
129118
// it's important to keep the stream open until the next handler has finished

0 commit comments

Comments
 (0)