set withCredentials to the new ES6 built-in HTTP request API : Fetch

只谈情不闲聊 提交于 2019-11-26 21:33:14

问题


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

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

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


回答1:


Got it here :

  credentials: 'include'

and not

  withCredentials: true


来源:https://stackoverflow.com/questions/40543372/set-withcredentials-to-the-new-es6-built-in-http-request-api-fetch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!