Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/canary' into dev/check-getstat…
Browse files Browse the repository at this point in the history
…icpaths
  • Loading branch information
ijjk committed Feb 24, 2020
2 parents 2ceee01 + 008a558 commit ce556fc
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 13 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Expand Up @@ -12,5 +12,5 @@
"registry": "https://registry.npmjs.org/"
}
},
"version": "9.2.3-canary.10"
"version": "9.2.3-canary.11"
}
2 changes: 1 addition & 1 deletion packages/create-next-app/package.json
@@ -1,6 +1,6 @@
{
"name": "create-next-app",
"version": "9.2.3-canary.10",
"version": "9.2.3-canary.11",
"keywords": [
"react",
"next",
Expand Down
2 changes: 1 addition & 1 deletion packages/next-bundle-analyzer/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/bundle-analyzer",
"version": "9.2.3-canary.10",
"version": "9.2.3-canary.11",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-mdx/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/mdx",
"version": "9.2.3-canary.10",
"version": "9.2.3-canary.11",
"main": "index.js",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-google-analytics/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-google-analytics",
"version": "9.2.3-canary.10",
"version": "9.2.3-canary.11",
"nextjs": {
"name": "Google Analytics",
"required-env": [
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-material-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-material-ui",
"version": "9.2.3-canary.10",
"version": "9.2.3-canary.11",
"nextjs": {
"name": "Material UI",
"required-env": []
Expand Down
2 changes: 1 addition & 1 deletion packages/next-plugin-sentry/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/plugin-sentry",
"version": "9.2.3-canary.10",
"version": "9.2.3-canary.11",
"nextjs": {
"name": "Sentry",
"required-env": [
Expand Down
2 changes: 1 addition & 1 deletion packages/next-polyfill-nomodule/package.json
@@ -1,6 +1,6 @@
{
"name": "@next/polyfill-nomodule",
"version": "9.2.3-canary.10",
"version": "9.2.3-canary.11",
"description": "A polyfill for non-dead, nomodule browsers.",
"main": "dist/polyfill-nomodule.js",
"license": "MIT",
Expand Down
Expand Up @@ -301,7 +301,7 @@ const nextServerlessLoader: loader.Loader = function() {
return Object.keys(obj).reduce(
(prev, key) =>
Object.assign(prev, {
[key]: encodeURIComponent(obj[key])
[key]: obj[key]
}),
{}
);
Expand Down
4 changes: 2 additions & 2 deletions packages/next/package.json
@@ -1,6 +1,6 @@
{
"name": "next",
"version": "9.2.3-canary.10",
"version": "9.2.3-canary.11",
"description": "The React Framework",
"main": "./dist/server/next.js",
"license": "MIT",
Expand Down Expand Up @@ -73,7 +73,7 @@
"@babel/preset-typescript": "7.7.2",
"@babel/runtime": "7.7.2",
"@babel/types": "7.7.4",
"@next/polyfill-nomodule": "9.2.3-canary.10",
"@next/polyfill-nomodule": "9.2.3-canary.11",
"amphtml-validator": "1.0.30",
"async-retry": "1.2.3",
"async-sema": "3.0.0",
Expand Down
5 changes: 5 additions & 0 deletions test/integration/serverless/pages/catchall/[...slug].js
@@ -0,0 +1,5 @@
const SlugPage = ({ query }) => <div>{JSON.stringify(query)}</div>

SlugPage.getInitialProps = ({ query }) => ({ query })

export default SlugPage
24 changes: 22 additions & 2 deletions test/integration/serverless/test/index.test.js
Expand Up @@ -251,10 +251,30 @@ describe('Serverless', () => {
expect(data.query).toEqual({ slug: paramRaw })
})

it('should have the correct query string for a spr route', async () => {
it('should have the correct query string for a now route', async () => {
const paramRaw = 'test % 123'
const html = await fetchViaHTTP(appPort, `/dr/[slug]`, '', {
headers: { 'x-now-route-matches': qs.stringify({ 1: paramRaw }) },
headers: {
'x-now-route-matches': qs.stringify({
1: encodeURIComponent(paramRaw),
}),
},
}).then(res => res.text())
const $ = cheerio.load(html)
const data = JSON.parse($('#__NEXT_DATA__').html())

expect(data.query).toEqual({ slug: paramRaw })
})

it('should have the correct query string for a catch all now route', async () => {
const paramRaw = ['nested % 1', 'nested/2']

const html = await fetchViaHTTP(appPort, `/catchall/[...slug]`, '', {
headers: {
'x-now-route-matches': qs.stringify({
1: paramRaw.map(e => encodeURIComponent(e)).join('/'),
}),
},
}).then(res => res.text())
const $ = cheerio.load(html)
const data = JSON.parse($('#__NEXT_DATA__').html())
Expand Down

0 comments on commit ce556fc

Please sign in to comment.