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

14 lines
250 B
TypeScript

import { NextRequest, NextResponse } from 'next/server'
export const runtime = 'edge'
type Context = {
params: {
slug: string[]
}
}
export const GET = async (req: NextRequest, { params }: Context) => {
return NextResponse.json(params)
}