DEV Community

Nathan Kratzmeyer
Nathan Kratzmeyer

Posted on

2

PATCH Case Sensitivity

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'
  });

Enter fullscreen mode Exit fullscreen mode

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!

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay