-
-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Description
Describe the bug
When using the fetch adapter, patch requests are failing
To Reproduce
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