0
const result = await fetch(https://example.com', {
  method: 'POST',
  mode: 'no-cors',
  headers: {
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"username": "Jochan","countFollowers": 60001}),
});

I am trying to send a request to a third-party API, an error arrives, how can I solve it?

Error:

POST https://example.com net::ERR_ABORTED 500 (Internal Server Error)

enter image description here

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Volodimir
  • 13
  • 3
  • https://stackoverflow.com/questions/53442236/error-when-accessing-api-with-fetch-while-setting-mode-to-no-cors – Quentin Feb 25 '21 at 22:23

1 Answers1

0

you are not authorized to get a response from an API that does not have the appropriate headers set. If it is neither yours API nor public one, you can only try some hacks with CORS proxies from google search