【问题标题】:Change header of response更改响应标题
【发布时间】:2018-08-24 11:06:48
【问题描述】:

我有一个使用 create-react-app 创建的反应应用程序。我想向另一个网址发送请求:

fetch('anotherUrl')
        .then(response => response.json())
        .then(res => console.log(res))

在那之后我遇到了 cors 问题。如何设置中间件为 null 这个错误?

【问题讨论】:

标签: reactjs fetch


【解决方案1】:

您可以使用浏览器插件来关闭 cors。在您完成应用程序的开发并将其上线后,cors 将不再是问题。只有在 localhost 中运行应用程序才会出现问题。

【讨论】:

    猜你喜欢
    • 2018-12-07
    • 1970-01-01
    • 1970-01-01
    • 2013-11-14
    • 2016-06-19
    • 2017-01-10
    • 2014-04-14
    • 2023-03-08
    • 2016-02-13
    相关资源
    最近更新 更多