PATCH Case Sensitivity

github logo ・1 min read

For Future Reference

I had the following code in my front-end app:

  const result = await fetch(url, {
    method: 'patch',
    headers: {
      'Content-Type': 'application/json'
    body: json,
    mode: 'cors'

I was getting CORS errors but I could see that the OPTIONS request was sending back PATCH as an allowed method. After banging my head against a wall for at least 2 hours, I finally stumbled on this StackOverflow post. BOOM! Problem solved! "patch" needed to be "PATCH".

Hope this helps someone!

twitter logo DISCUSS
Classic DEV Post from Jan 30

Make art, not apps <3

You don't have to build an app. In fact, if you don't need to, then don't.

Nathan Kratzmeyer profile image
IT Generalist trying to break into full-time coding. Enjoying the learning journey!