Skip to content

Commit

Permalink
Fix max buffer error detection
Browse files Browse the repository at this point in the history
  • Loading branch information
TrySound committed Feb 6, 2021
1 parent 2576be7 commit 4eb3f78
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/next/next-server/server/api-utils.ts
Expand Up @@ -128,7 +128,7 @@ export async function parseBody(
const maxBuffer = bytes.parse(limit)
buffer = await getStream.buffer(req, { maxBuffer })
} catch (e) {
if (e.type === 'entity.too.large') {
if (e.name === 'MaxBufferError') {
throw new ApiError(413, `Body exceeded ${limit} limit`)
} else {
throw new ApiError(400, 'Invalid body')
Expand Down

0 comments on commit 4eb3f78

Please sign in to comment.