Unable to add cookie anymore to request.jar

I use request.js in the project, and from version 2.30.0 I can no longer do this:

var j = request.jar(); var cookie = request.cookie('uid'); cookie.value = browser.cookies.select({name:'uid'})[0].value; j.add(cookie); 

My mistake:

  TypeError: Object #<CookieJar> has no method 'add' 

Did someone have a problem and have it been resolved?

+6
source share
1 answer

Gotcha!

Since the request uses hard-cookie ( https://github.com/goinstant/node-cookie ), we can add the following files:

 j.setCookie(cookie, 'http://currentdomain.example.com/path', function(error, cookie) {}); 
+10
source

All Articles