8
                            
                                失败案例
                                    
                                
                            
                        axios({
  url: 'example.com',
  responseType: 'json',
  transformResponse: [
    data => {
      console.log(data.message.field);  // ERROR
    }
  ]
})在 IE 11 中运行上述案例时,将在标记的行处抛出错误。
因为:
- defaults.transformResponse被覆盖
- IE 11 忽略XHR.responseType并XHR.response始终给出string
每当我们发现responseType被设置为json且响应类型为 时string,请尝试JSON.parse它。