请求头 header中传cookie不生效原因

寻找请求头 header中传cookie不生效原因

axios中报错:xhr.js:126 Refused to set unsafe header "Cookie"
查找到原因:w3c规定,当请求的header匹配以下不安全字符时,将被终止
Accept-Charset
Accept-Encoding
Connection
Content-Length
Cookie
Cookie2
Content-Transfer-Encoding
Date
Expect
Host
Keep-Alive
Referer
TE
Trailer
Transfer-Encoding
Upgrade
User-Agent
Via

解决方案:在本地种cookie即可

posted @ 2020-09-17 15:03  Macchiato  阅读(5208)  评论(0编辑  收藏  举报