Skip to content

Commit

Permalink
NextResponse.json: pass options to Response
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Mar 16, 2022
1 parent 853442d commit 0652503
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/next/server/web/spec-extension/response.ts
Expand Up @@ -67,10 +67,10 @@ export class NextResponse extends Response {
return this.cookie(name, '', { expires: new Date(1), path: '/', ...opts })
}

static json(body: any) {
static json(body: any, init?: ResponseInit) {
return new NextResponse(JSON.stringify(body), {
headers: { 'content-type': 'application/json' },
})
}, init)
}

static redirect(url: string | NextURL | URL, status = 307) {
Expand Down

0 comments on commit 0652503

Please sign in to comment.