capricorn86 / happy-dom

A JavaScript implementation of a web browser without its graphical user interface
MIT License
3.08k stars 185 forks source link

Fetch does not accept a request object in first parameter #1433

Open jasonkuhrt opened 1 month ago

jasonkuhrt commented 1 month ago

Describe the bug

When trying to pass a request object to fetch the following error happens:

TypeError: Failed to parse URL from [object Request]

To Reproduce

const requestObject = new Request(input.url, {
    method: `POST`,
    body: '',
  })

  const response = await fetch(requestObject)

Expected behavior Should accept request object in first parameter.

Other

It works with jsdom.