Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Cookie management for node's request library
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json

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
Something went wrong with that request. Please try again.