Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't add cookie anymore in request.jar

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?

like image 902
nicolas Avatar asked Dec 31 '13 10:12

nicolas


1 Answers

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) {});
like image 62
nicolas Avatar answered Nov 10 '22 08:11

nicolas