New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

cookie-manager

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cookie-manager

cookie manager for any http client in node.js

  • 0.0.19
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
increased by24.39%
Maintainers
1
Weekly downloads
 
Created
Source

#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.store( 
	'https://example.com/is/cool', 
	'cname=cval; Expires=someDate; domain=.example.com; path=/' 
);

cm.store( 
 'https://example.com/is/cool', 
 [
  'cnameSecure=cval1sec; Expires=someDate; domain=.example.com; path=/; secure',
  'cnameHttpOnly=cval1Http; Expires=someDate; domain=.example.com; path=/; HttpOnly',
  'cnameWWW=cvalWWW; Expires=someDate; domain=www.example.com; path=/something'
 ]
);

###Prepare Cookies for request

// Hey, i want to browse http://example.com/ Please prepare the cookies
cookies = cm.prepare( 'http://example.com' );
// 'cname=cval; cnameHttpOnly=cval1Http'
// Hey, i want to browse http://cool.example.com/ Please prepare the cookies
cookies = cm.prepare( 'http://cool.example.com' );
// 'cname=cval; cnameHttpOnly=cval1Http'
// Hey, i want to browse http://www.example.com/something/awesome Please prepare the cookies
cookies = cm.prepare( 'http://www.example.com/something/awesome' );
// 'cname=cval; cnameHttpOnly=cval1Http; cname2=cval2'
// Hey, i'm trying to request https://www.example.com/something/awesome
cookies = cm.prepare( 'https://www.example.com/something/awesome' )
// 'cname=cval; cnameSecure=cval1sec; cnameHttpOnly=cval1Http; cname2=cval2'
// Hey, i want to browse http://www.example.com/other/stuff Please prepare the cookies
cookies = cm.prepare( 'http://www.example.com/other/stuff' );
// 'cname=cval; cnameHttpOnly=cval1Http'

###For Browser emulation

this.document.cookie = cm.prepare( 
							'http://www.example.com/something/awesome', 
							true 
						);

// 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.prepare( 'http://www.example.com/something/awesome' );
// empty string.. the cookies have expired.

cheers,

jujiyangasli.com

Keywords

FAQs

Package last updated on 25 Oct 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc