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

查看:27
本文介绍了将 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

推荐答案

知道了这里 : >

Got it here :

  credentials: 'include'

而不是

  withCredentials: true

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

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