Commit 66a03bf1 authored by JJ Kasper's avatar JJ Kasper Committed by Joe Haddad

Add test for trailing slash on API route (#7851)

parent bd7a85e2
......@@ -55,7 +55,7 @@ function runTests (serverless = false) {
expect(data).toEqual([{ title: 'Nextjs' }])
})
it('shuld return error with invalid JSON', async () => {
it('should return error with invalid JSON', async () => {
const data = await fetchViaHTTP(appPort, '/api/parse', null, {
method: 'POST',
headers: {
......
......@@ -8,6 +8,7 @@ import {
findPort,
nextBuild,
nextStart,
fetchViaHTTP,
renderViaHTTP
} from 'next-test-utils'
import fetch from 'node-fetch'
......@@ -144,6 +145,11 @@ describe('Serverless', () => {
expect(post).toBe('post-1')
})
it('should 404 on API request with trailing slash', async () => {
const res = await fetchViaHTTP(appPort, '/api/hello/')
expect(res.status).toBe(404)
})
describe('With basic usage', () => {
it('should allow etag header support', async () => {
const url = `http://localhost:${appPort}/`
......
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