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
393af8e6
Unverified
Commit
393af8e6
authored
Oct 16, 2019
by
Joe Haddad
Committed by
GitHub
Oct 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix SPR header name (#9104)
parent
42bf2109
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
next-serverless-loader.ts
...ages/next/build/webpack/loaders/next-serverless-loader.ts
+3
-3
index.test.js
test/integration/serverless/test/index.test.js
+1
-1
No files found.
packages/next/build/webpack/loaders/next-serverless-loader.ts
View file @
393af8e6
...
...
@@ -133,13 +133,13 @@ const nextServerlessLoader: loader.Loader = function() {
:
`const params = {};`
}
${
// Temporary work around
-- `x-now-route-param
s` is a platform header
// Temporary work around
: `x-now-route-matche
s` is a platform header
// _only_ set for `Prerender` requests. We should move this logic
// into our builder to ensure we're decoupled. However, this entails
// removing reliance on `req.url` and using `req.query` instead
// (which is needed for "custom routes" anyway).
isDynamicRoute
(
page
)
?
`const nowParams = req.headers && req.headers["x-now-route-
param
s"]
?
`const nowParams = req.headers && req.headers["x-now-route-
matche
s"]
? getRouteMatcher(
(function() {
const { re, groups } = getRouteRegex("
${
page
}
");
...
...
@@ -160,7 +160,7 @@ const nextServerlessLoader: loader.Loader = function() {
groups
};
})()
)(req.headers["x-now-route-
param
s"])
)(req.headers["x-now-route-
matche
s"])
: null;
`
:
`const nowParams = null;`
...
...
test/integration/serverless/test/index.test.js
View file @
393af8e6
...
...
@@ -207,7 +207,7 @@ describe('Serverless', () => {
it
(
'should have the correct query string for a spr route'
,
async
()
=>
{
const
paramRaw
=
'test % 123'
const
html
=
await
fetchViaHTTP
(
appPort
,
`/dr/[slug]`
,
''
,
{
headers
:
{
'x-now-route-
param
s'
:
qs
.
stringify
({
1
:
paramRaw
})
}
headers
:
{
'x-now-route-
matche
s'
:
qs
.
stringify
({
1
:
paramRaw
})
}
}).
then
(
res
=>
res
.
text
())
const
$
=
cheerio
.
load
(
html
)
const
data
=
JSON
.
parse
(
$
(
'#__NEXT_DATA__'
).
html
())
...
...
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