-
Notifications
You must be signed in to change notification settings - Fork 100
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
Convert verb to uppercase #71
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
In Google Chrome, `patch` specifically seems to be causing problems. I'd been Googling for about an hour and finally came across this SO post: https://stackoverflow.com/a/67744766/51021 Apparently, some verbs (`PATCH` in my case) ARE case-sensitive when comparing against a pre-flight `OPTIONS` check. I think in order to be the most compatible with the `axios` module, and to make `PATCH` work during cross-origin requests, these verbs should be made uppercase (See `axios` source: [axios/lib/adapters/xhr.js#L32](https://github.com/axios/axios/blob/5ad6994/lib/adapters/xhr.js#L32))
Fixed tests |
A workaround I'm using for now until this PR is merged is that you can manually supply the verb using the full syntax: import redaxios from "redaxios"
import { auth, baseURL } from "./helpers.js"
export async function patchItemById(itemId, payload) {
const { data } = await redaxios(`/v1/item/${itemId}`, {
data: payload,
method: "PATCH", // <-- uppercase is required
auth,
baseURL,
})
return data
} |
Could someone approve it? =) |
Size Change: +34 B (1%) Total Size: 2.99 kB
|
In Google Chrome,
patch
specifically seems to be causing problems. I'd been Googling for about an hour and finally came across this SO post: https://stackoverflow.com/a/67744766/51021Apparently, some verbs (
PATCH
in my case) ARE case-sensitive when comparing against a pre-flightOPTIONS
check.I think in order to be the most compatible with the
axios
module, and to makePATCH
work during cross-origin requests, these verbs should be made uppercase (Seeaxios
source: axios/lib/adapters/xhr.js#L32)