-
-
Notifications
You must be signed in to change notification settings - Fork 389
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
Allow providing custom Request
and Response
#1563
Comments
This is a great idea, and I’d be in favor of adding it. msw has a similar concept where there are reasons why you’d have a custom Request or Response that are WHATWG-compliant but have additional helpers or additional behavior. And of course the Node <> browser differences with the fetch() API, which should match but often don’t (and I haven’t done an in-depth comparison on the latest version of Node, but there are almost always subtle differences with APIs that can break edge cases as you’ve found). |
Description
I am using
openapi-fetch
in Node.js. As you probably know, the built-infetch
is provided by Undici project, which is still in development. Usually it's better to installundici
package separately and have a warranty that fetching works the same, no matter the runtime version. Also, if you want to use more sophisticated features (like mocking or proxy connection), they're not available in the built-in version.When I tried to use Undici in your app, it broke down due to some inconsistency of
Request
object behavior (despite both implement the WHATWG spec). Here is a code snippet that shows the inconsistency.Results with:
Proposal
createClient
should allow providing customRequest
andResponse
constructors, next tofetch
.Checklist
The text was updated successfully, but these errors were encountered: