-
-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fetch does not accept a request object in first parameter #1433
Comments
Some of MSW community members also encountering this: mswjs/msw#2191. |
Thank you for reporting @jasonkuhrt and @kettanaito! 🙂 This should be supported already in Happy DOM. I have added an additional unit test to cover this now here: Is it something that I'm missing? Is it possible to setup a reproducible example project somewhere? |
By using the example project in mswjs/msw#2191, I managed to find the problem. This is a bug in Vitest, where Vitest is using the native fetch from Node.js and not the one from Happy DOM. It is using the Request and Response objects from Happy DOM. As the Request object is not recognizable by the native fetch, it will try to convert it to a string. |
Bug created for Vitest: |
@capricorn86, outstanding work. Thank you so much! |
The fix has been released now in Vitest. I'm closing this one now. Please re-open if the problem still exist. |
Describe the bug
When trying to pass a request object to fetch the following error happens:
To Reproduce
Expected behavior
Should accept request object in first parameter.
Other
It works with
jsdom
.The text was updated successfully, but these errors were encountered: