简体   繁体   English

如何解决错误 CORS? 模式:'无cors'

[英]How to solve the error CORS ? mode: 'no-cors'

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?我正在尝试向第三方 API 发送请求,出现错误,我该如何解决? Error: POST https://example.com net::ERR_ABORTED 500 (Internal Server Error)错误:POST https://example.com net::ERR_ABORTED 500(内部服务器错误) 在此处输入图像描述

you are not authorized to get a response from an API that does not have the appropriate headers set.您无权从未设置适当标头的 API 获得响应。 If it is neither yours API nor public one, you can only try some hacks with CORS proxies from google search如果它既不是你的 API 也不是公共的,你只能尝试使用谷歌搜索中的 CORS 代理进行一些黑客攻击

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM