tough-cookie - RFC6265 Cookies and CookieJar for Node.js

  •        0

``` javascriptvar tough = require('tough-cookie'); // note: not 'cookie', 'cookies' or 'node-cookie'var Cookie = tough.Cookie;var cookie = Cookie.parse(header);cookie.value = 'somethingdifferent';header = cookie.toString();var cookiejar = new tough.CookieJar();cookiejar.setCookie(cookie, 'http://currentdomain.example.com/path', cb);// ...cookiejar.getCookies('http://example.com/otherpath',function(err,cookies) { res.headers['cookie'] = cookies.join('; ');});```

https://github.com/goinstant/tough-cookie

Tags
Implementation
License
Platform

   




Related Projects