在nodejs中,如何将请求中的cookie发送到服务器

use*_*405 3 cookies response request setcookie node.js

我们怎么能收到一个cookie作为响应和标题的'set-cookie'参数,然后在下一个请求中发送这个cookie.所有这些使用'http'模块而没有第三方模块.我基本上对我将如何感兴趣将cookie作为标题中的参数发布,以便进入下一个请求

use*_*405 7

哦,终于发现我的错误,我没有在我的标题列表中包含cookie参数.我写的是这样的:

var options = {host:url_parsed.host, path:url_parsed.path, method:'GET', 'Cookie':cookie, 'Accept':'/', 'Connection':'keep-alive', };
Run Code Online (Sandbox Code Playgroud)

我应该是这样的:

 var options = {host:url_parsed.host, path:url_parsed.path, method:'GET', headers:{'Cookie':cookie}, 'Accept':'/', 'Connection':'keep-alive', };
Run Code Online (Sandbox Code Playgroud)