fetch获取的东西, 默认是无光本站的cookie的, 所以请求时是默认不带cookie, response里的set-cookie
也是无效的,设置credentials: 'includes'
启用cookie
.
例:
fetch('/login?name=slaver00&psw=123', { method: 'POST', credentials: 'includes' })
.then(...);
fetch获取的东西, 默认是无光本站的cookie的, 所以请求时是默认不带cookie, response里的set-cookie
也是无效的,设置credentials: 'includes'
启用cookie
.
例:
fetch('/login?name=slaver00&psw=123', { method: 'POST', credentials: 'includes' })
.then(...);
本文标题:fetch携带cookie
本文链接:https://www.haomeiwen.com/subject/kqfutxtx.html
网友评论