将withCredentials设置为新的ES6内置HTTP请求API:Fetch

问题描述 投票:8回答:1

如何将withCredentials=true设置为返回承诺的fetch。以下是正确的:

fetch(url,{
   method:'post',
   headers,
   withCredentials: true
});

我认为MDN documentation谈到了关于http请求的一切,除了这一点:withCredentials

javascript ecmascript-6 xmlhttprequest fetch-api
1个回答
25
投票

得到它here

  credentials: 'include'

并不是

  withCredentials: true
© www.soinside.com 2019 - 2024. All rights reserved.