Files
Zack TannerandGitHub 7a733dfd34 fix edge route catch-all param parsing (#59343)
### What?
Visiting an edge catch-all route incorrectly truncates multiple
parameters

### Why?
The params are currently coerced into a `ParsedURLQuery`-like format by
calling `Object.fromEntries` on `searchParams`, but this doesn't
consider multiple param values assigned to the same key

### How?
Rather than use `fromEntries`, this uses an existing util to get the
path into `ParsedURLQuery` format.

Closes NEXT-1814
Fixes #59333
2023-12-06 12:21:28 -08:00

24 lines
642 B
TypeScript

import { createNextDescribe } from 'e2e-utils'
createNextDescribe(
'edge-route-catchall',
{
files: __dirname,
},
({ next }) => {
it('should correctly normalize edge route catch-all with a single param', async () => {
const result = await next.fetch('/edge/one')
expect(await result.text()).toBe(JSON.stringify({ slug: ['one'] }))
})
it('should correctly normalize edge route catch-all with multiple params', async () => {
const result = await next.fetch('/edge/one/two/three')
expect(await result.text()).toBe(
JSON.stringify({ slug: ['one', 'two', 'three'] })
)
})
}
)