I use request.js in a project, and since the version 2.30.0, I can't do that anymore:
var j = request.jar();
var cookie = request.cookie('uid');
cookie.value = browser.cookies.select({name:'uid'})[0].value;
j.add(cookie);
My error is:
TypeError: Object #<CookieJar> has no method 'add'
Someone had the problem and solved it?
Gotcha!
Since request uses tough-cookie (https://github.com/goinstant/node-cookie), we can add cookies like that:
j.setCookie(cookie, 'http://currentdomain.example.com/path', function(error, cookie) {});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With