{"name":"co-body","version":"1.2.0","repository":{"type":"git","url":"git+https://github.com/cojs/co-body.git"},"description":"request body parsing for co","keywords":["request","parse","parser","json","co","generators","urlencoded"],"dependencies":{"qs":"~2.3.3","raw-body":"~1.3.3"},"devDependencies":{"istanbul-harmony":"^0.3.1","koa":"*","mocha":"*","should":"*","supertest":"*"},"license":"MIT","scripts":{"test":"make test","test-cov":"make test-cov"},"files":["index.js","lib/"],"gitHead":"613940b43c2ca28e40ed23c4303be398a2e09dd5","bugs":{"url":"https://github.com/cojs/co-body/issues"},"homepage":"https://github.com/cojs/co-body#readme","_id":"co-body@1.2.0","_shasum":"2a01b3b7b9c0a5c0fab2f6e6e4642cf878e070ab","_from":".","_npmVersion":"2.8.3","_nodeVersion":"1.8.1","_npmUser":{"name":"fengmk2","email":"fengmk2@gmail.com"},"maintainers":[{"name":"tjholowaychuk","email":"tj@vision-media.ca"},{"name":"fengmk2","email":"fengmk2@gmail.com"}],"dist":{"shasum":"2a01b3b7b9c0a5c0fab2f6e6e4642cf878e070ab","tarball":"http://registry-npm.ywwl.com/co-body/download/co-body-1.2.0.tgz","integrity":"sha512-ojskDfHZ+7yNAMi/Cpd3/m2tvmhXOwzjUjnc3PSbbESyS/pbKCOBlhvvMkNRra4Cp7r3dvIXeLHGKO5S8Dhj0A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICd3ZdNKDlPmEXrtKKWvnskTlUjXWTbd6WUT4/AS1i88AiA0PQroZZGp+VWtIRWJ+aoix/8lVm4LFb/X56Y7RP7gXA=="}],"size":2226,"noattachment":false,"key":"/co-body/-/co-body-1.2.0.tgz"},"directories":{},"readme":"# co-body\n\n[![NPM version][npm-image]][npm-url]\n[![CI](https://github.com/cojs/co-body/actions/workflows/node.yml/badge.svg)](https://github.com/cojs/co-body/actions/workflows/node.yml)\n[![Test coverage][codecov-image]][codecov-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/co-body.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/co-body\n[codecov-image]: https://codecov.io/github/cojs/co-body/coverage.svg?branch=master\n[codecov-url]: https://codecov.io/github/cojs/co-body?branch=master\n[download-image]: https://img.shields.io/npm/dm/co-body.svg?style=flat-square\n[download-url]: https://npmjs.org/package/co-body\n\n> Parse request bodies with generators inspired by [Raynos/body](https://github.com/Raynos/body).\n\n## Installation\n\n```bash\n$ npm install co-body\n```\n\n## Options\n\n  - `limit` number or string representing the request size limit (1mb for json and 56kb for form-urlencoded)\n  - `strict` when set to `true`, JSON parser will only accept arrays and objects; when `false` will accept anything `JSON.parse` accepts. Defaults to `true`. (also `strict` mode will always return object).\n  - `onProtoPoisoning` Defines what action the `co-body` lib must take when parsing a JSON object with `__proto__`. This functionality is provided by [bourne](https://github.com/hapijs/bourne).\n    See [Prototype-Poisoning](https://fastify.dev/docs/latest/Guides/Prototype-Poisoning/) for more details about prototype poisoning attacks.\n    Possible values are `'error'`, `'remove'` and `'ignore'`.\n    Default to `'error'`, it will throw a `SyntaxError` when `Prototype-Poisoning` happen.\n  - `queryString` an object of options when parsing query strings and form data. See [qs](https://github.com/hapijs/qs) for more information.\n  - `returnRawBody` when set to `true`, the return value of `co-body` will be an object with two properties: `{ parsed: /* parsed value */, raw: /* raw body */}`.\n  - `jsonTypes` is used to determine what media type **co-body** will parse as **json**, this option is passed directly to the [type-is](https://github.com/jshttp/type-is) library.\n  - `formTypes` is used to determine what media type **co-body** will parse as **form**, this option is passed directly to the [type-is](https://github.com/jshttp/type-is) library.\n  - `textTypes` is used to determine what media type **co-body** will parse as **text**, this option is passed directly to the [type-is](https://github.com/jshttp/type-is) library.\n\nmore options available via [raw-body](https://github.com/stream-utils/raw-body#getrawbodystream-options-callback):\n\n## Example\n\n```js\n// application/json\nvar body = await parse.json(req);\n\n// explicit limit\nvar body = await parse.json(req, { limit: '10kb' });\n\n// application/x-www-form-urlencoded\nvar body = await parse.form(req);\n\n// text/plain\nvar body = await parse.text(req);\n\n// either\nvar body = await parse(req);\n\n// custom type\nvar body = await parse(req, { textTypes: ['text', 'html'] });\n```\n\n## Koa\n\n  This lib also supports `ctx.req` in Koa (or other libraries),\n  so that you may simply use `this` instead of `this.req`.\n\n```js\n// application/json\nvar body = await parse.json(this);\n\n// application/x-www-form-urlencoded\nvar body = await parse.form(this);\n\n// text/plain\nvar body = await parse.text(this);\n\n// either\nvar body = await parse(this);\n```\n\n# License\n\n[MIT](LICENSE.txt)\n","publish_time":1430238820188,"_cnpm_publish_time":1430238820188,"dist-tags":{"latest":"6.2.0"}}