avatar

Catalog
axios CROS每次请求多一次options请求

参考: https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Access_control_CORS
header中设置了除

  • Accept
  • Accept-Language
  • Content-Language
  • Content-Type (需要注意额外的限制)
  • DPR
  • Downlink
  • Save-Data
  • Viewport-Width
  • Width
    之外的其他字段导致 请求成为复杂请求
javascript
1
// config.headers['X-Token'] = getToken()

搞了半天原来是这个X-Token导致的

Author: Qin
Link: https://qinhaolei.com/posts/30125/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Reward
  • WechatPay
    WechatPay
  • AliPay
    AliPay
  • Bitcoin
    Bitcoin

Comment