将withCredentials设置为新的ES6内置HTTP请求API:Fetch [英] set withCredentials to the new ES6 built-in HTTP request API : Fetch

查看:154
本文介绍了将withCredentials设置为新的ES6内置HTTP请求API:Fetch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

How to set withCredentials=true to fetch which return promise. Is the following correct :

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

我认为 MDN文档讨论了关于http请求的所有内容,除此之外: withCredentials

I think the MDN documentation talked about everything about http-requesting except this point: withCredentials

推荐答案

知道了这里

  credentials: 'include'

而不是

  withCredentials: true

这篇关于将withCredentials设置为新的ES6内置HTTP请求API:Fetch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆