Files
Shu DingandGitHub 7dfa56c714 Fix missing request body in DELETE and OPTIONS Route Handlers (#51874)
It looks like the `content-length` header can't be ignored for the request forwarded to the render worker. See https://github.com/nodejs/node/issues/27880.

Closes #48096, closes #49310. Fix NEXT-1194
fix NEXT-1114
2023-06-27 11:44:01 +00:00

25 lines
617 B
TypeScript

import type { NextRequest } from 'next/server'
import { withRequestMeta } from '../../../../helpers'
export async function POST(request: NextRequest) {
const body = await request.json()
return new Response('hello, world', {
status: 200,
headers: withRequestMeta({ body }),
})
}
export async function DELETE(request: NextRequest) {
const body = await request.json()
return new Response('delete ' + body.name, {
status: 200,
})
}
export async function OPTIONS(request: NextRequest) {
const body = await request.json()
return new Response('options ' + body.name, {
status: 200,
})
}