Skip to content

URLSearchParams - getAll() is not returning proper array in edge runtime.  #340

Open
@robertotcestari

Description

@robertotcestari

Bug Report

Current behavior
Using NextJS 13.4, using API routes (Pages Folder) in the following folder structure:

pages/api/[...name].jsx

When i try to use the method getAll() on the route BASE_URL/api/first-segment/second-segment:

  const { searchParams } = new URL(req.url);
  const allSegments = searchParams.getAll('name')

the expected return from getAll() was to be an array like:

[
  'first-segment',
  'second-segment'
]

This works correct in localhost and in chrome js console.
However, when pushing to production (edge runtime), it gives the following code:

[
  'first-segment/second-segment',
]

... which is different from the Web API implementation.

Expected behavior/code

From the example above, searchParams.getAll(param) was expected to return an array with two items. It returned one array with only one item.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions