Skip to content

Commit 0f02b90

Browse files
committed
fix: address edge can read request body failures
1 parent 2810004 commit 0f02b90

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

edge-runtime/lib/response.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,11 @@ export const buildResponse = async ({
241241
edgeResponse.headers.delete('x-middleware-next')
242242

243243
// coookies set in middleware need to be available during the lambda request
244-
const newRequest = new Request(request)
244+
const newRequest = new Request(request.url, {
245+
headers: request.headers,
246+
method: request.method,
247+
body: request.body && !request.bodyUsed ? await request.arrayBuffer() : undefined,
248+
})
245249
const newRequestCookies = mergeMiddlewareCookies(edgeResponse, newRequest)
246250
if (newRequestCookies) {
247251
newRequest.headers.set('Cookie', newRequestCookies)

0 commit comments

Comments
 (0)