|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- {
- "name": "cookie-parser",
- "description": "cookie parsing with signatures",
- "version": "1.3.3",
- "author": {
- "name": "TJ Holowaychuk",
- "email": "tj@vision-media.ca",
- "url": "http://tjholowaychuk.com"
- },
- "licenses": "MIT",
- "repository": {
- "type": "git",
- "url": "git://github.com/expressjs/cookie-parser"
- },
- "keywords": [
- "cookie",
- "middleware"
- ],
- "dependencies": {
- "cookie": "0.1.2",
- "cookie-signature": "1.0.5"
- },
- "devDependencies": {
- "istanbul": "0.3.2",
- "mocha": "~1.21.4",
- "supertest": "~0.13.0"
- },
- "files": [
- "lib/",
- "LICENSE",
- "HISTORY.md",
- "index.js"
- ],
- "engines": {
- "node": ">= 0.8.0"
- },
- "scripts": {
- "test": "mocha --reporter spec --bail --check-leaks test/",
- "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
- "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
- },
- "readme": "# cookie-parser\n\n[![NPM Version][npm-image]][npm-url]\n[![NPM Downloads][downloads-image]][downloads-url]\n[![Build Status][travis-image]][travis-url]\n[![Test Coverage][coveralls-image]][coveralls-url]\n\nParse `Cookie` header and populate `req.cookies` with an object keyed by the cookie\nnames. Optionally you may enable signed cookie support by passing a `secret` string,\nwhich assigns `req.secret` so it may be used by other middleware.\n\n## Installation\n\n```sh\n$ npm install cookie-parser\n```\n\n## API\n\n```js\nvar express = require('express')\nvar cookieParser = require('cookie-parser')\n\nvar app = express()\napp.use(cookieParser())\n```\n\n### cookieParser(secret, options)\n\n- `secret` a string used for signing cookies. This is optional and if not specified, will not parse signed cookies.\n- `options` an object that is passed to `cookie.parse` as the second option. See [cookie](https://www.npmjs.org/package/cookie) for more information.\n - `decode` a function to decode the value of the cookie\n\n### cookieParser.JSONCookie(str)\n\nParse a cookie value as a JSON cookie. This will return the parsed JSON value if it was a JSON cookie, otherwise it will return the passed value.\n\n### cookieParser.JSONCookies(cookies)\n\nGiven an object, this will iterate over the keys and call `JSONCookie` on each value. This will return the same object passed in.\n\n### cookieParser.signedCookie(str, secret)\n\nParse a cookie value as a signed cookie. This will return the parsed unsigned value if it was a signed cookie and the signature was valid, otherwise it will return the passed value.\n\n### cookieParser.signedCookies(cookies, secret)\n\nGiven an object, this will iterate over the keys and check if any value is a signed cookie. If it is a signed cookie and the signature is valid, the key will be deleted from the object and added to the new object that is returned.\n\n## Example\n\n```js\nvar express = require('express')\nvar cookieParser = require('cookie-parser')\n\nvar app = express()\napp.use(cookieParser())\n\napp.get('/', function(req, res) {\n console.log(\"Cookies: \", req.cookies)\n})\n\napp.listen(8080)\n\n// curl command that sends an HTTP request with two cookies\n// curl http://127.0.0.1:8080 --cookie \"Cho=Kim;Greet=Hello\"\n```\n\n### [MIT Licensed](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/cookie-parser.svg?style=flat\n[npm-url]: https://npmjs.org/package/cookie-parser\n[travis-image]: https://img.shields.io/travis/expressjs/cookie-parser.svg?style=flat\n[travis-url]: https://travis-ci.org/expressjs/cookie-parser\n[coveralls-image]: https://img.shields.io/coveralls/expressjs/cookie-parser.svg?style=flat\n[coveralls-url]: https://coveralls.io/r/expressjs/cookie-parser?branch=master\n[downloads-image]: https://img.shields.io/npm/dm/cookie-parser.svg?style=flat\n[downloads-url]: https://npmjs.org/package/cookie-parser\n",
- "readmeFilename": "README.md",
- "bugs": {
- "url": "https://github.com/expressjs/cookie-parser/issues"
- },
- "_id": "cookie-parser@1.3.3",
- "_from": "cookie-parser@~1.3.3"
- }
|