(
query: Record<string, string | string[] | undefined>,
routeParamKeys: Set<string>
)
| 423 | } |
| 424 | |
| 425 | function normalizeQueryParams( |
| 426 | query: Record<string, string | string[] | undefined>, |
| 427 | routeParamKeys: Set<string> |
| 428 | ) { |
| 429 | // this is used to pass query information in rewrites |
| 430 | // but should not be exposed in final query |
| 431 | delete query['nextInternalLocale'] |
| 432 | |
| 433 | for (const [key, value] of Object.entries(query)) { |
| 434 | const normalizedKey = normalizeNextQueryParam(key) |
| 435 | if (!normalizedKey) continue |
| 436 | |
| 437 | // Remove the prefixed key from the query params because we want |
| 438 | // to consume it for the dynamic route matcher. |
| 439 | delete query[key] |
| 440 | routeParamKeys.add(normalizedKey) |
| 441 | |
| 442 | if (typeof value === 'undefined') continue |
| 443 | |
| 444 | query[normalizedKey] = Array.isArray(value) |
| 445 | ? value.map((v) => decodeQueryPathParameter(v)) |
| 446 | : decodeQueryPathParameter(value) |
| 447 | } |
| 448 | } |
| 449 | |
| 450 | return { |
| 451 | handleRewrites, |
nothing calls this directly
no test coverage detected