Skip to content

Playwright's route.fetch throws ERR_INVALID_URL #26419

@qFlensT

Description

@qFlensT

What version of Bun is running?

1.3.5

What platform is your computer?

Darwin 25.0.0 arm64 arm

What steps can reproduce the bug?

page.route(`**baskets/${payment.ident}/checkout**`, async (route) => {
  const response = await route.fetch(); // fails here
  const data = await response.json();

  console.log(data);

  if (data.message) {
    console.log(data.message);
  }

  await route.fulfill({
    response,
    body: JSON.stringify(data),
  });
});

What is the expected behavior?

Send request to the route

What do you see instead?

153 |     return { ...fetchResponse, fetchUid };
154 |   }
155 |   _parseSetCookieHeader(responseUrl, setCookie) {
156 |     if (!setCookie)
157 |       return [];
158 |     const url = new URL(responseUrl);
                      ^
TypeError: "/api/baskets/d77e5v-f9729702412aa4c1d62ffb1912a6822de4e0222d/checkout/" cannot be parsed as a URL.
 code: "ERR_INVALID_URL"

      at _parseSetCookieHeader 

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions