{"name":"co-body","version":"5.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":{"inflation":"^2.0.0","qs":"^6.4.0","raw-body":"^2.2.0","type-is":"^1.6.14"},"devDependencies":{"istanbul":"^0.4.5","koa":"^1.2.5","mocha":"^3.2.0","safe-qs":"^6.0.1","should":"^11.2.0","supertest":"^1.0.1"},"license":"MIT","scripts":{"test":"make test","test-cov":"make test-cov"},"files":["index.js","lib/"],"gitHead":"e62c3db7f46eb5bd81bcf694beb289820ab3dc05","bugs":{"url":"https://github.com/cojs/co-body/issues"},"homepage":"https://github.com/cojs/co-body#readme","_id":"co-body@5.2.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.1","_npmUser":{"name":"dead_horse","email":"dead_horse@qq.com"},"dist":{"integrity":"sha512-sX/LQ7LqUhgyaxzbe7IqwPeTr2yfpfUIQ/dgpKo6ZI4y4lpQA0YxAomWIY+7I7rHWcG02PG+OuPREzMW/5tszQ==","shasum":"5a0a658c46029131e0e3a306f67647302f71c124","tarball":"http://registry-npm.ywwl.com/co-body/download/co-body-5.2.0.tgz","fileCount":9,"unpackedSize":11156,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa6YwgCRA9TVsSAnZWagAA2zAP/0MxpYusyGNlHktcCX1J\nmg0fTa3LgTWRdZtI2NHzH5BXP991Jgz/xk45bY/vWiqVqTDbQbUUeI4vjbqP\nxVCiiKqp9PjNkUAusn4ebcrVNSW9LTg6e4Ev1pW7MTqvesl2j19So+AKfkUB\nURTV1vot591kVDM196ay/kVTYLPGHbFSS4cDz2tAtUGMtAYa+n8Wlf7WX7Iu\nfr3jI7WhLUtlQXpUMb/6v/y4ushrlJkJlm98JB6McxR4X5AhxFIwprPsrHoO\nwC2ZOVA2f/QIqlGtrvy+HV3+WGfMhIC/QlYbea2dO2RkFPT2q1zXLLtN/nKq\nkgZTcSLPd/LwRSzMQzIpNcE3hPfwsdyrvyk4rX34qHJNqaEsyqxIdLg9Mv9o\n65OlaPK4lqcrjTlpjQE3nivnRY38h0OGLN5D7vffMYCu0RW16/O/l8+mEYWc\nx52WjdObB1XjHHFQ+h+EtOnnhx+rscR0IeRbQDX3m+OkLpMCVbjGyCVkCDGa\nXbMc4u0G2T4n0kCq8VBcGc2hBMyzb1pwxo1iN6CDLCGhRfKvRZ8JcCQhmzuq\nrAxoPiSDtU7lBM2fVj69GCrAfx+YhwJDoccggFMY91tA41oJSBS3H7MoUbh+\nUBCDRAqrHKM9aDd/zqyWfwMGG1O2HmRfHJcRJrRZt/JLVCiue4wW+kWmvD3H\ne02F\r\n=FkVR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCvcwLxXTvEc0KEuQ55ARJVW1IDKmjG8/lJKn1nfA86VAIgKRYuhyx02fs7b3tKXb3Hk3e/AwI0r+JmN8lNen1YK88="}],"size":3628,"noattachment":false,"key":"/co-body/-/co-body-5.2.0.tgz"},"maintainers":[{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"tjholowaychuk","email":"tj@vision-media.ca"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/co-body_5.2.0_1525255199639_0.47926923615869854"},"_hasShrinkwrap":false,"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":1525255199690,"_cnpm_publish_time":1525255199690,"dist-tags":{"latest":"6.2.0"}}