Node 怎样模拟客户端发送带有 cookie的请求?
发布于 13 年前 作者 jiyinyiyong 18983 次预览 最后一次回复是 13 年前 来自
文档里的 GET 都是网址要么带 ?key=value URL 参数的例子,
但是 HTTP 请求是有更多细节的, 这个应该是以参数的形式发送的吧?
HTTP 我还没弄懂, 求指导…
原先好像有 http.createClient() 来模拟请求的, 似乎 API 不推荐用了
http://nodejs.org/api/http.html#http_http_createclient_port_host
6 回复
可以参考下: https://github.com/mikeal/request
COOKIE的发送应该是通过http header 的 set-cookie吧
@atian25 似乎也只能用
request了, 不过那个代码怎么看呐, 不知道关键是哪里的代码?@jiyinyiyong
https://github.com/mikeal/request/tree/master/vendor/cookie https://github.com/bmeck/node-cookiejar
clone 下来全文搜索吧~
就是说应该找其中
sertHeader相关的特征变量名了…