cookie-manager
cookie manager for any http client in node.js
install
npm install cookie-manager
Usage
var CM = require('cookie-manager');var cm = new CM();
Storing Cookies
// Hey, i just requested https://example.com/is/cool// the website sent me some cookies to set. please store these cookies...// cm; cm;
Prepare Cookies for request
// Hey, i want to browse http://example.com/ Please prepare the cookiescookies = cm;// 'cname=cval; cnameHttpOnly=cval1Http'
// Hey, i want to browse http://cool.example.com/ Please prepare the cookiescookies = cm;// 'cname=cval; cnameHttpOnly=cval1Http'
// Hey, i want to browse http://www.example.com/something/awesome Please prepare the cookiescookies = cm;// 'cname=cval; cnameHttpOnly=cval1Http; cname2=cval2'
// Hey, i'm trying to request https://www.example.com/something/awesomecookies = cm// 'cname=cval; cnameSecure=cval1sec; cnameHttpOnly=cval1Http; cname2=cval2'
// Hey, i want to browse http://www.example.com/other/stuff Please prepare the cookiescookies = cm;// 'cname=cval; cnameHttpOnly=cval1Http'
For Browser emulation
thisdocumentcookie = cm; // cname=cval; cname2=cval2
For Time Travelers
// Hey, i traveled 500 years in time, // and i want to browse http://www.example.com/something/awesome// again.//cm;// empty string.. the cookies have expired.
cheers,