Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
66a03bf1
Commit
66a03bf1
authored
Jul 09, 2019
by
JJ Kasper
Committed by
Joe Haddad
Jul 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for trailing slash on API route (#7851)
parent
bd7a85e2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
index.test.js
test/integration/api-support/test/index.test.js
+1
-1
index.test.js
test/integration/serverless/test/index.test.js
+6
-0
No files found.
test/integration/api-support/test/index.test.js
View file @
66a03bf1
...
@@ -55,7 +55,7 @@ function runTests (serverless = false) {
...
@@ -55,7 +55,7 @@ function runTests (serverless = false) {
expect
(
data
).
toEqual
([{
title
:
'Nextjs'
}])
expect
(
data
).
toEqual
([{
title
:
'Nextjs'
}])
})
})
it
(
'shuld return error with invalid JSON'
,
async
()
=>
{
it
(
'sh
o
uld return error with invalid JSON'
,
async
()
=>
{
const
data
=
await
fetchViaHTTP
(
appPort
,
'/api/parse'
,
null
,
{
const
data
=
await
fetchViaHTTP
(
appPort
,
'/api/parse'
,
null
,
{
method
:
'POST'
,
method
:
'POST'
,
headers
:
{
headers
:
{
...
...
test/integration/serverless/test/index.test.js
View file @
66a03bf1
...
@@ -8,6 +8,7 @@ import {
...
@@ -8,6 +8,7 @@ import {
findPort
,
findPort
,
nextBuild
,
nextBuild
,
nextStart
,
nextStart
,
fetchViaHTTP
,
renderViaHTTP
renderViaHTTP
}
from
'next-test-utils'
}
from
'next-test-utils'
import
fetch
from
'node-fetch'
import
fetch
from
'node-fetch'
...
@@ -144,6 +145,11 @@ describe('Serverless', () => {
...
@@ -144,6 +145,11 @@ describe('Serverless', () => {
expect
(
post
).
toBe
(
'post-1'
)
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'
,
()
=>
{
describe
(
'With basic usage'
,
()
=>
{
it
(
'should allow etag header support'
,
async
()
=>
{
it
(
'should allow etag header support'
,
async
()
=>
{
const
url
=
`http://localhost:
${
appPort
}
/`
const
url
=
`http://localhost:
${
appPort
}
/`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment