You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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
The text was updated successfully, but these errors were encountered: