Skip to content

Commit

Permalink
Fix unexpected parameter error when running locally with node 18.x (#135
Browse files Browse the repository at this point in the history
)
  • Loading branch information
G4brym committed Mar 13, 2024
1 parent 6c8d721 commit 0f02a3b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,13 @@ export function extractQueryParameters(
): Record<string, any> | null {
const { searchParams } = new URL(request.url)

if (searchParams.size === 0) {
// For older node versions, searchParams is just an object without the size property
if (
searchParams.size === 0 ||
(searchParams.size === undefined &&
typeof searchParams === 'object' &&
Object.keys(searchParams).length === 0)
) {
return null
}

Expand Down

0 comments on commit 0f02a3b

Please sign in to comment.