Javascript 将withCredentials设置为新ES6内置HTTP请求API:Fetch
如何设置返回承诺的Javascript 将withCredentials设置为新ES6内置HTTP请求API:Fetch,javascript,ecmascript-6,xmlhttprequest,fetch-api,Javascript,Ecmascript 6,Xmlhttprequest,Fetch Api,如何设置返回承诺的withCredentials=true。 以下各项是否正确: fetch(url,{ method:'post', headers, withCredentials: true }); 我想,除了这一点,他们谈论了关于http请求的所有内容:使用凭据明白了: 而不是 withCredentials: true 还有一个XHR示例,如果有人在添加此配置以获取时遇到问题,并且在登录后仍无法获取发送的请求cookie,则可能需要在服务器响应中添加标题“Ac
withCredentials=true
。
以下各项是否正确:
fetch(url,{
method:'post',
headers,
withCredentials: true
});
我想,除了这一点,他们谈论了关于http请求的所有内容:使用凭据
明白了:
而不是
withCredentials: true
还有一个XHR示例,如果有人在添加此配置以获取时遇到问题,并且在登录后仍无法获取发送的请求cookie,则可能需要在服务器响应中添加标题
“Access-Control-Allow-Credentials”:true
withCredentials: true