rsnext/test/integration/production/pages/invalid-param/[slug].js
Joe Haddad c351f6154b
Improve server performance by skipping decode/re-encode (#17323)
Prior to this pull request, Next.js would immediately decode all URLs sent to its server (via `path-match`).

This was rarely needed, and Next.js would typically re-encode the incoming request right away (see all the `encodeURIComponent`s removed in PR diff). This adds unnecessary performance overhead.

Long term, this will also help prevent weird encoding edge-cases like #10004, #10022, #11371, et al.

---

No new tests are necessary for this change because we've extensively tested these edge cases with existing tests.
One test was updated to reflect that we skip decoding in a 404 scenario.

Let's see if all the existing tests pass!
2020-09-24 06:05:40 +00:00

13 lines
220 B
JavaScript

import { useRouter } from 'next/router'
export default function Page() {
return <p>hello {useRouter().query}</p>
}
export const getServerSideProps = () => {
return {
props: {
hello: 'world',
},
}
}