简体   繁体   English

提取API调用未设置标头

[英]Headers not set on fetch api call

Using the native fetch API, I have this code: 使用本地提取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();
})

For some reason the headers are not set, so the API is throwing 401. 由于某些原因未设置标头,因此API抛出401。

It turned out that SurveyMonkey recently made some infrastructure changes, that have caused CORS headers not be be sent. 事实证明,SurveyMonkey最近进行了一些基础结构更改,这些更改导致未发送CORS标头。 I believe this is a temporary situation. 我相信这是暂时的情况。

I have the same problem since friday 4. It works fine from Postman, does not work from my web application. 自星期五4开始,我遇到了同样的问题。它在Postman上工作正常,在我的Web应用程序中无效。

I tried to use Fiddler to see the difference and... magic... using Fiddler 4: it works fine! 我尝试使用Fiddler来查看区别和...魔术...使用Fiddler 4:效果很好! No change, just use Fiddler and it works... 无需更改,只需使用Fiddler,它就可以工作...

What does that mean? 这意味着什么? Does Fiddler does something we need to do too? Fiddler是否也做了我们需要做的事情?

Thanks for any advice. 感谢您的任何建议。

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

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