{"name":"co-body","version":"6.0.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.5.2","raw-body":"^2.3.3","type-is":"^1.6.16"},"devDependencies":{"autod":"^3.0.1","egg-bin":"^4.7.0","eslint":"^4.19.1","eslint-config-egg":"^7.0.0","koa":"^1.6.0","safe-qs":"^6.0.1","should":"^11.2.0","supertest":"^3.1.0"},"license":"MIT","scripts":{"lint":"eslint .","autod":"autod","test":"egg-bin test -r should","cov":"eslint . && egg-bin cov -r should"},"files":["index.js","lib/"],"gitHead":"c1710b80978996ec3b4375dc96270743e9bbbfd9","bugs":{"url":"https://github.com/cojs/co-body/issues"},"homepage":"https://github.com/cojs/co-body#readme","_id":"co-body@6.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.11.1","_npmUser":{"name":"dead_horse","email":"dead_horse@qq.com"},"dist":{"integrity":"sha512-9ZIcixguuuKIptnY8yemEOuhb71L/lLf+Rl5JfJEUiDNJk0e02MBt7BPxR2GEh5mw8dPthQYR4jPI/BnS1MQgw==","shasum":"965b9337d7f5655480787471f4237664820827e3","tarball":"http://registry-npm.ywwl.com/co-body/download/co-body-6.0.0.tgz","fileCount":9,"unpackedSize":11169,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbAoEJCRA9TVsSAnZWagAAnhwQAI701zU5D06m/TVm234m\nuhvrWrQmJy1vGuQDMynDEC0R1a9x+1pXOtkpTGX3w0wwoH8WGdF/vEPWZ/Qf\nFypke7Lio/aUBE5cImKvm0eg3jOZa143jGVx8pkSBQNCvzZXmspEwAM0tSfx\nWjsvfTSg6Wy+gnEMh1us0Oj72UNK49vUcQ+juZoZitT+rYBLGs9p67ZvrkGU\nXp+fTsVd48ZhHxvQjT0oKXR7MalxkSgn/IH26ybC085qDfJeiGop1N6qZQID\nLTEQtxTliye1/31P/RSbD5Mauvd6LO+yrKJAKF23mGdJj+DQ23ZPTnslhIFy\nynwJC9yXnihPKcLlmARCYjDopx39tcMOiVFVHcdcmNLZktlirgweZi/WZ097\nVQ3+y+BY7P/u96TnrITpsnDXrO0kxvkMJL/rCGlmNqsL48//NKCyVNgNbP43\nbrf94ErdO2pBBqJogi17i0J0RP9821DfwBuwOmXYioUbWhiWUqDOQ0mOA/d1\n8SFRAsEmrfpIGt3ycZRAiTcaCHogTsqBRIE9MVPOGyaBxxTRIcx6lwdHlf2N\nOa8rVgn5GSz4LsdJOX0IDDGVMvIxetwSX8MpdF7T124+aKHrPyDhmB4mT/KD\n0oW3Yr60Ribto8OfDuy2d5XefoCR28/NaLF8e2PTMW3FH6ap96iC61FbNqbN\nmsQG\r\n=WtZh\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFnNUYyMJuifISgx8vomGAapHBRYkVfvBxhjnE118UzyAiEA9K0PONwoBHW6IQOyQkmc98GJ600OJYIk4lpRjR8oTm4="}],"size":3694,"noattachment":false,"key":"/co-body/-/co-body-6.0.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_6.0.0_1526890761010_0.7759369293615084"},"_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":1526890761073,"_cnpm_publish_time":1526890761073,"dist-tags":{"latest":"6.2.0"}}