Skip to content

Commit

Permalink
feat!: removes NextResponse.json() function
Browse files Browse the repository at this point in the history
  • Loading branch information
feugy committed May 9, 2022
1 parent aa82adc commit cfb312c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 83 deletions.
9 changes: 0 additions & 9 deletions test/e2e/middleware-cannot-return-body/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@ describe.each([
export default function middleware(request) {
return new Response(JSON.stringify({ foo: 'bar' }), { headers: {'content-type': 'application/json'} });
}
`,
},
{
title: 'use NextResponse.json()',
middlewareCode: `
import { NextResponse } from 'next/server';
export default function middleware(request) {
return NextResponse.json({ foo: 'bar' });
}
`,
},
])('middleware cannot $title', ({ middlewareCode }) => {
Expand Down
4 changes: 3 additions & 1 deletion test/unit/web-runtime/next-cookies.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ it('response.cookie does not modify options', async () => {
)

const options = { maxAge: 10000 }
const response = NextResponse.json(null)
const response = new NextResponse(null, {
headers: { 'content-type': 'application/json' },
})
response.cookies.set('cookieName', 'cookieValue', options)
expect(options).toEqual({ maxAge: 10000 })
})
73 changes: 0 additions & 73 deletions test/unit/web-runtime/next-response.test.ts

This file was deleted.

0 comments on commit cfb312c

Please sign in to comment.