Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/417.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Axios在IE 11中获取GET请求的空响应对象_Javascript_Internet Explorer_Axios - Fatal编程技术网

Javascript Axios在IE 11中获取GET请求的空响应对象

Javascript Axios在IE 11中获取GET请求的空响应对象,javascript,internet-explorer,axios,Javascript,Internet Explorer,Axios,使用Axios发送GET请求时,它在所有其他浏览器中都能正常工作,但是我在IE11中获得了这些数据 { request: { }, headers: { }, config: { }, statys: 200, statusText: "OK" } request、headers和config是Axios请求的响应对象中的空对象。对象中需要头、请求和配置数据(这在Chrome中运行良好) 不太清楚为什么会发生这种情况?如果浏览器没

使用Axios发送
GET
请求时,它在所有其他浏览器中都能正常工作,但是我在IE11中获得了这些数据

{
    request: {
    },
    headers: {
    },
    config: {
    },
    statys: 200,
    statusText: "OK"
}
request、headers和config
是Axios请求的响应对象中的空对象。对象中需要头、请求和配置数据(这在Chrome中运行良好)


不太清楚为什么会发生这种情况?

如果浏览器没有承诺实现(IE11没有),则必须包含承诺polyfill

axios文档提到了这一点:axios依赖于支持的本机ES6 Promise实现。如果您的环境不支持ES6承诺,您可以使用polyfill


请在此处查看ES6 promise polyfill:

如果问题与promise有关,是否应该抛出错误?不过我使用的是Promise polyfill,控制台中没有错误。在随后的回调中获得响应,JSON的结构如上所述。尝试在应用程序中添加以下代码可能有助于解决此问题_beforeRequest(config){config.headers.common['Cache-Control']='no Cache';config.Cache=false;config.headers.get={};config.headers.get['If-Modified-Since']='0';…..}参考: