繁体   English   中英

提取API调用未设置标头

[英]Headers not set on fetch api call

使用本地提取API,我有以下代码:

fetch('https://api.surveymonkey.net/v3/surveys/' + surveyId + '/responses/bulk?api_key=' + keySurveyMonkey + '&email=' + customerEmail, {
    method: 'GET',
    credentials: "include",
    headers: {
      "authorization": "Bearer xxxxxxxxxxxxxxxxxxxx"
    }
})
.then((response) => {
    return response.json();
})

由于某些原因未设置标头,因此API抛出401。

事实证明,SurveyMonkey最近进行了一些基础结构更改,这些更改导致未发送CORS标头。 我相信这是暂时的情况。

自星期五4开始,我遇到了同样的问题。它在Postman上工作正常,在我的Web应用程序中无效。

我尝试使用Fiddler来查看区别和...魔术...使用Fiddler 4:效果很好! 无需更改,只需使用Fiddler,它就可以工作...

这意味着什么? Fiddler是否也做了我们需要做的事情?

感谢您的任何建议。

暂无
暂无

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

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