Skip to content
/ oven Public

call setCookie with incoming raw set-cookie headers then get the value of the outgoing cookie header

License

Notifications You must be signed in to change notification settings

chevett/oven

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oven Build Status Dependency Status

NPM

Put incoming set-cookie header values in the oven and get outgoing cookie header values.

var defaultDomain = 'www.miketown3.com';
var Oven = require('oven');
var oven = new Oven({url: defaultDomain});

var parsedCookie = oven.setCookie('test=mt3');
oven.setCookie('test=goog; Domain=.google.com');
oven.setCookie('test=mt3_4real');
oven.setCookie('search=heyGuy; Path=/my-path');
oven.setCookie('notTemp=555');
oven.setCookie('tmp=555');
oven.setCookie('tmp=someone; Expires=25, Dec 1999');
oven.setCookie('tmp=someone; Domain=.no-no-no.com');

console.log(defaultDomain + ': ' + oven.getCookie());
console.log(defaultDomain + '/my-path: ' + oven.getCookie('/my-path'));
console.log('www.google.com: ' + oven.getCookie('www.google.com'));
console.log('www.google.com: ' + oven.getCookie('www.google.com/my-path'));
console.log('\n-----');
console.dir(parsedCookie);

output:

www.miketown3.com: test=mt3_4real; notTemp=555
www.miketown3.com/my-path: test=mt3_4real; search=heyGuy; notTemp=555
www.google.com: test=goog
www.google.com/my-path:

------
{ value: 'test=mt3',
  expires: undefined,
  path: '/',
  domain: 'www.miketown3.com',
  priority: undefined,
  secure: false,
  httpOnly: false,
  values: [ 'test=mt3' ],
  name: 'test',
  id: 'test_www.miketown3.com' }

About

call setCookie with incoming raw set-cookie headers then get the value of the outgoing cookie header

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published