Unverified Commit 3e2aec5e authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Fix E2E deploy test for API bodies (#41542)

Fixes:
https://github.com/vercel/next.js/actions/runs/3275381974/jobs/5390966319
parent bc335d7e
...@@ -64,7 +64,10 @@ describe('Middleware fetches with body', () => { ...@@ -64,7 +64,10 @@ describe('Middleware fetches with body', () => {
) )
expect(res.status).toBe(413) expect(res.status).toBe(413)
if (!(global as any).isNextDeploy) {
expect(res.statusText).toBe('Body exceeded 1mb limit') expect(res.statusText).toBe('Body exceeded 1mb limit')
}
}) })
it('should be able to send and return body size equal to 1mb', async () => { it('should be able to send and return body size equal to 1mb', async () => {
...@@ -129,7 +132,10 @@ describe('Middleware fetches with body', () => { ...@@ -129,7 +132,10 @@ describe('Middleware fetches with body', () => {
) )
expect(res.status).toBe(413) expect(res.status).toBe(413)
if (!(global as any).isNextDeploy) {
expect(res.statusText).toBe('Body exceeded 5kb limit') expect(res.statusText).toBe('Body exceeded 5kb limit')
}
}) })
it('should be able to send and return body size equal to 5kb', async () => { it('should be able to send and return body size equal to 5kb', async () => {
...@@ -171,7 +177,10 @@ describe('Middleware fetches with body', () => { ...@@ -171,7 +177,10 @@ describe('Middleware fetches with body', () => {
) )
expect(res.status).toBe(413) expect(res.status).toBe(413)
if (!(global as any).isNextDeploy) {
expect(res.statusText).toBe('Body exceeded 5mb limit') expect(res.statusText).toBe('Body exceeded 5mb limit')
}
}) })
it('should return 413 for body greater than 5mb', async () => { it('should return 413 for body greater than 5mb', async () => {
...@@ -189,9 +198,13 @@ describe('Middleware fetches with body', () => { ...@@ -189,9 +198,13 @@ describe('Middleware fetches with body', () => {
) )
expect(res.status).toBe(413) expect(res.status).toBe(413)
if (!(global as any).isNextDeploy) {
expect(res.statusText).toBe('Body exceeded 5mb limit') expect(res.statusText).toBe('Body exceeded 5mb limit')
}
}) })
if (!(global as any).isNextDeploy) {
it('should be able to send and return body size equal to 5mb', async () => { it('should be able to send and return body size equal to 5mb', async () => {
const bodySize = 5 * 1024 * 1024 const bodySize = 5 * 1024 * 1024
const body = 'FGHI1J2K3L4M5N6O7P8Q9R0SaTbUcVdW'.repeat(bodySize / 32) const body = 'FGHI1J2K3L4M5N6O7P8Q9R0SaTbUcVdW'.repeat(bodySize / 32)
...@@ -213,6 +226,7 @@ describe('Middleware fetches with body', () => { ...@@ -213,6 +226,7 @@ describe('Middleware fetches with body', () => {
bodySize / 32 + 1 bodySize / 32 + 1
) )
}) })
}
}) })
describe('with bodyParser = false', () => { describe('with bodyParser = false', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment