为什么在浏览器中提示“对预检请求的响应未通过访问控制检查”时,我可以使用curl发送发帖请求?

时间:2018-07-10 15:43:06

标签: cors

为什么在浏览器中提示“对飞行前请求的响应未通过访问控制检查”时,我可以使用curl发送发帖请求?

我的卷曲代码如下:

curl 'https://xxx.example.com' \
   -H 'Content-Type: application/json' \
   -d '
  {"data": "text",
    "text": {
        "content": "123"
     }
  }'

我在浏览器中的代码是:

fetch("https://xxx.example.com", {
    method:  "POST",
    headers: {
        "Content-Type": "application/json"
     },
    body: JSON.stringify({
         "data": "text",
         "text": {
             "content": "1234"
         },
     })
})

0 个答案:

没有答案