Thursday, 27 April 2017

How do you get request to save cookies as JSON with tough-cookie-filestore?

I am using request with NodeJS and I'd like to save cookies as JSON. As per the docs, I am using tough-cookie-filestore and passing in the jar option.

I create the file on disk beforehand, and then make a request that I know returns cookies. But for some reason, the empty file I created to store the cookies in stays empty after the response has been received.

Should I explicitly tell request to commit the cookies to the file, or should it be automatic?

// using a promise-enabled version of promise
return request({
  url: url,
  jar: new FileCookieStore(myfile)
});



via springloaded

No comments:

Post a Comment