Skip to content
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

PATCH requests using fetch adapter #6390

Closed
vojvodics opened this issue May 13, 2024 · 0 comments · Fixed by #6395
Closed

PATCH requests using fetch adapter #6390

vojvodics opened this issue May 13, 2024 · 0 comments · Fixed by #6395

Comments

@vojvodics
Copy link

vojvodics commented May 13, 2024

Describe the bug

When using the fetch adapter, patch requests are failing

To Reproduce

https://codesandbox.io/p/sandbox/axios-patch-fetch-adapter-nmxp8t

Expected behavior

Patch requests should succeed with fetch adapter

Axios Version

v1.7.0-beta.1

Adapter Version

fetch

Additional context/Screenshots

This is because per spec (https://fetch.spec.whatwg.org/#methods) methods are case-sensitive, and only some methods are normalized, but patch is not one of them.

The solution is to call method.toUpparcase() on 2 places:
https://github.com/axios/axios/blob/v1.x/lib/adapters/fetch.js#L125
https://github.com/axios/axios/blob/v1.x/lib/adapters/fetch.js#L149

Http and xhr adapters do this, probably because of the same reason mentioned above:
https://github.com/axios/axios/blob/v1.x/lib/adapters/http.js#L164
https://github.com/axios/axios/blob/v1.x/lib/adapters/xhr.js#L33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant