为什么在使用 axios 发送请求时会出现网络错误?

时间:2021-05-12 22:16:21

标签: reactjs axios

如您所见,由于 Cuttly API,我想缩短我的 URL。因此我发送了一个请求:

    axios({
      method: "get",
      url: "https://cutt.ly/api/api.php",
      headers: { "Access-Control-Allow-Origin": "*" },
      params: {
        key: "MY_KEY",
        short: this.state.inputText,
        name: ""
      }
    })
      .then((res) => {
        console.log(res);
      })
      .catch((err) => {
        console.log(err);
      });

但是当发送时,我收到一个网络错误:

enter image description here

我也使用了跨域标头,但我的问题没有解决。

任何帮助将不胜感激!

0 个答案:

没有答案