Heim > Fragen und Antworten > Hauptteil
大家讲道理2017-04-17 15:24:42
var j = request.jar()
request({url: 'http://www.google.com', jar: j}, function () {
var cookie_string = j.getCookieString(url); // "key1=value1; key2=value2; ..."
var cookies = j.getCookies(url);
// [{key: 'key1', value: 'value1', domain: "www.google.com", ...}, ...]
})
黄舟2017-04-17 15:24:42
猜测你是用的request这个库?如果响应中有设置cookie的话,那么可以试下
response.headers['Set-Cookie']