Skip to content

Commit c5037d7

Browse files
committed
test: add test case for route with 0-length response
1 parent 8a63ac2 commit c5037d7

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export async function GET() {
2+
return new Response('')
3+
}
4+
5+
export const dynamic = 'force-static'

tests/integration/cache-handler.test.ts

+10
Original file line numberDiff line numberDiff line change
@@ -508,4 +508,14 @@ describe('route', () => {
508508

509509
expect(call2.body).toBe('{"params":{"slug":"not-in-generateStaticParams"}}')
510510
})
511+
512+
test<FixtureTestContext>('cacheable route handler response with 0 length response is served correctly', async (ctx) => {
513+
await createFixture('server-components', ctx)
514+
await runPlugin(ctx)
515+
516+
const call = await invokeFunction(ctx, { url: '/api/zero-length-response' })
517+
518+
expect(call.statusCode).toBe(200)
519+
expect(call.body).toBe('')
520+
})
511521
})

0 commit comments

Comments
 (0)