{"name":"co-body","version":"1.0.0","repository":{"type":"git","url":"https://github.com/visionmedia/co-body"},"description":"request body parsing for co","keywords":["request","parse","parser","json","co","generators","urlencoded"],"dependencies":{"qs":"~1.0.0","raw-body":"~1.1.1"},"devDependencies":{"mocha":"*","should":"*","koa":"git+https://github.com/koajs/koa","supertest":"~0.8.2"},"license":"MIT","gitHead":"6bdad7fbed0e11685ad6c7a96c25d6987d004009","bugs":{"url":"https://github.com/visionmedia/co-body/issues"},"homepage":"https://github.com/visionmedia/co-body","_id":"co-body@1.0.0","scripts":{},"_shasum":"dab6c3770805227d4c337300ff205e8a9e533e65","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"tjholowaychuk","email":"tj@vision-media.ca"},"maintainers":[{"name":"tjholowaychuk","email":"tj@vision-media.ca"}],"dist":{"shasum":"dab6c3770805227d4c337300ff205e8a9e533e65","tarball":"http://registry-npm.ywwl.com/co-body/download/co-body-1.0.0.tgz","integrity":"sha512-IIbjHSJUCbxq3tg0VmLK7F0BSGbnY0fuOjdeavgy/797pxjcDMNHR2kaADdXwaCfXc/pDhVFLtb9aNCo1Gq6XA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDwZ0G9yzQuJSgqe4Ton8kbbzFl4osddC1EZtaOMAlJJAiEAzFuP3lv08bduo0WXKiweGRqC79mj0qfsSQVuZVHLZxg="}],"size":2044,"noattachment":false,"key":"/co-body/-/co-body-1.0.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":1407350882759,"_cnpm_publish_time":1407350882759,"dist-tags":{"latest":"6.2.0"}}