File size: 1,192 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
import { nextTestSetup } from 'e2e-utils'
describe('ipc-forbidden-headers', () => {
const { next } = nextTestSetup({
files: __dirname,
})
it('should not error if expect header is included', async () => {
let res = await next.fetch('/api/pages-api', {
method: 'POST',
headers: { expect: '100-continue' },
})
let text = await res.text()
expect(text).toEqual('Hello, Next.js!')
res = await next.fetch('/api/app-api', {
method: 'POST',
headers: {
expect: '100-continue',
},
})
text = await res.text()
expect(text).toEqual('Hello, Next.js!')
expect(next.cliOutput).not.toContain('UND_ERR_NOT_SUPPORTED')
})
it("should not error on content-length: 0 if request shouldn't contain a payload", async () => {
let res = await next.fetch('/api/pages-api', {
method: 'DELETE',
headers: { 'content-length': '0' },
})
expect(res.status).toBe(200)
res = await next.fetch('/api/app-api', {
method: 'DELETE',
headers: { 'content-length': '0' },
})
expect(res.status).toBe(200)
expect(next.cliOutput).not.toContain('UND_ERR_REQ_CONTENT_LENGTH_MISMATCH')
})
})
|