Cookie management for node's request library
JavaScript
Switch branches/tags
Nothing to show
Latest commit 269ae19 Jan 28, 2014 @lalitkapoor 1.1.0
Permalink
Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
LICENSE Initial commit Dec 11, 2013
README.md adding travis ci badge Jan 25, 2014
index.js No need to wrap functions anymore Dec 26, 2013
package.json 1.1.0 Jan 28, 2014

README.md

request-cookies Build Status

Cookie management for node's request library

see tests for examples

CookieJar

CookieJar()

Holds cookies

add(data, url, options)

Add a cookie to the cookie jar

Params:

  • String|Object data can be a Cookie, json object, or a set-cookie header string

  • String url

  • Object options [optional]

remove(url, key)

Remove a cookie by name for a given domain. If the key then all cookies for the given domain and path (if given) will be removed. Note: when cookies are added without a path specified the default path is "/" in accordance with http://tools.ietf.org/search/rfc6265#section-5.1.4 - so you should use that for the path param when appropriate.

Params:

  • String url

  • String key

getCookies(url, options)

Get cookies that match the given properties

Params:

  • String url

  • Object options [optional]

getCookieHeaderString(url, options)

Get HTTP Cookie header string

Params:

  • String url

  • Object options [optional]

toJSON()

Get cookie jar as a JSON object

Return:

  • Object

Cookie

Cookie(data)

HTTP Cookie

Params:

  • String|Object data can be a cookie header string or a json object

getCookieHeaderString()

Get cookie as a cookie header string

Return:

  • String

set(data)

Set multiple cookie properties at once

Params:

  • String|Object data

toJSON()

Get cookie as a JSON object

Return:

  • Object