Skip to content

Commit 58dcf30

Browse files
committed
Apply fix(stream): Allows body larger than 16 KiB with middleware
1 parent f3fc912 commit 58dcf30

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/next/server/body-streams.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,14 @@ export function getClonableBody<T extends IncomingMessage>(
9090
const input = buffered ?? readable
9191
const p1 = new PassThrough()
9292
const p2 = new PassThrough()
93-
input.pipe(p1)
94-
input.pipe(p2)
93+
input.on('data', (chunk) => {
94+
p1.push(chunk)
95+
p2.push(chunk)
96+
})
97+
input.on('end', () => {
98+
p1.push(null)
99+
p2.push(null)
100+
})
95101
buffered = p2
96102
return p1
97103
},

0 commit comments

Comments
 (0)