first commit

This commit is contained in:
2026-09-08 20:28:54 +08:00
commit 2ada8d3d5a
37380 changed files with 4886169 additions and 0 deletions
+153
View File
@@ -0,0 +1,153 @@
4.4.1 / 2023-06-22
==================
**fixes**
* [[`5a551b1`](http://github.com/koajs/bodyparser/commit/5a551b1de6f5e2200b8a838207b56ea1198bdb96)] - fix: compatible extra semicolon on content-type header (#153) (fengmk2 <<fengmk2@gmail.com>>)
4.4.0 / 2023-03-15
==================
**features**
* [[`a9a6476`](http://github.com/koajs/bodyparser/commit/a9a647641bb883746c9691e86b8f87739df4e374)] - feat: Support scim json format (#151) (ask me anything :) <<caryyu.tg@gmail.com>>)
**fixes**
* [[`4d931c6`](http://github.com/koajs/bodyparser/commit/4d931c634e9b59a843152f56d68b3ef2e1719675)] - fix: revert html parser, use text directly (dead-horse <<dead_horse@qq.com>>)
**others**
* [[`c02ec0c`](http://github.com/koajs/bodyparser/commit/c02ec0c062f92e1114b4196534669367eae14ccc)] - Update README.md (#149) (sgywzy <<44345776+sgywzy@users.noreply.github.com>>)
* [[`85b426f`](http://github.com/koajs/bodyparser/commit/85b426fea3d98481fd4acbafce0857189199426e)] - Recommend @koa/multer for multipart/form-data (#145) (Jim Fisher <<jameshfisher@gmail.com>>)
* [[`afecb1a`](http://github.com/koajs/bodyparser/commit/afecb1ab7303ebd36d1a50d6bfe5fc3125759e43)] - Update Repo + Add Html Parser (#134) (imed jaberi <<imed_jebari@hotmail.fr>>)
* [[`ecc6ebf`](http://github.com/koajs/bodyparser/commit/ecc6ebfad7179e0009501723e7b2227d25c9603d)] - docs: fix broken npmjs link (#132) (Joel Colucci <<joelcolucci@users.noreply.github.com>>)
* [[`336b287`](http://github.com/koajs/bodyparser/commit/336b2879dc7c0e048d79e28bf23d4b8fe2589376)] - Update README.md (haoxin <<haoxinst@gmail.com>>)
* [[`e02cb7d`](http://github.com/koajs/bodyparser/commit/e02cb7dd2c798a116ef12c776da30c710697dea5)] - Update README.md (#125) (thaiworldgame <<36978149+thaiworldgame@users.noreply.github.com>>)
4.3.0 / 2020-03-24
==================
**features**
* [[`705673d`](http://github.com/koajs/bodyparser/commit/705673d634818727dbdb25ee999560970bd268a2)] - feat: support xml (#131) (TZ | 天猪 <<atian25@qq.com>>)
**others**
* [[`6fd7e9c`](http://github.com/koajs/bodyparser/commit/6fd7e9c321684adc239d2afb270782c21d0b6231)] - docs: add multipart tips (dead-horse <<dead_horse@qq.com>>)
* [[`57c0022`](http://github.com/koajs/bodyparser/commit/57c00225d54b5b5dd1a7526478ad3eae8495222f)] - Fix typo in README.md (#112) (Adrian Pascu <<1521321+adipascu@users.noreply.github.com>>)
4.2.1 / 2018-05-21
==================
**others**
* [[`b270d5d`](http://github.com/koajs/bodyparser/commit/b270d5d138662f41dc63527505ea02dea0c1e7e8)] - deps: upgrade co-body (#104) (Haoliang Gao <<sakura9515@gmail.com>>)
* [[`d234345`](http://github.com/koajs/bodyparser/commit/d234345ffa2dadbab2ef0ce970fb8a58059e5f47)] - docs(readme): update opts encode -> encoding (#103) (Matthew Scragg <<scragg@gmail.com>>)
* [[`db193f5`](http://github.com/koajs/bodyparser/commit/db193f5d46860393521ad38f90a554968b2ba98a)] - chore:replace indexOf with includes (#90) (coderzzp <<coderzzp@gmail.com>>)
4.2.0 / 2017-03-21
==================
* feat: ctx.request.rawBody to get raw request body (#70)
4.1.0 / 2017-03-02
==================
* deps: upgrade co-body@5 (#64)
4.0.0 / 2017-02-27
==================
* refactor: use async function and support koa@2 (#62)
2.3.0 / 2016-11-14
==================
* feat: support dynamic disable body parser
2.2.0 / 2016-05-16
==================
* feat: support enableTypes and text (#44)
2.1.0 / 2016-05-10
==================
* deps: co-body@4
2.0.1 / 2015-08-12
==================
* chore: upgrade co-body@3.1.0
2.0.0 / 2015-05-07
==================
* deps: co-body@2, default to strict mode
1.6.0 / 2015-05-01
==================
* feat: support custom error handler
1.5.0 / 2015-04-04
==================
* Use an empty object instead of null, if no body is parsed
1.4.1 / 2015-03-10
==================
* bump co-body@1.1.0
1.4.0 / 2015-02-26
==================
* feat: custom json request detect
1.3.1 / 2015-01-27
==================
* fix: extend
1.3.0 / 2014-11-27
==================
* support extendTypes
* Merge pull request #8 from coderhaoxin/json-patch
* add support for json patch
1.2.0 / 2014-11-07
==================
* add example.js
* bump dependencies
* Merge pull request #7 from rudijs/develop
* Add support for JSON-API
1.1.0 / 2014-10-28
==================
* Merge pull request #6 from tunnckoCore/master
* resolve https://github.com/tunnckoCore/koa-better-body/issues/3#issuecomment-60458238
1.0.0 / 2014-04-23
==================
* update readme
* refactor
0.1.0 / 2014-03-06
==================
* Merge pull request #2 from fengmk2/remove-co
* Remove co deps and improve coverage to 100%
0.0.2 / 2014-02-26
==================
* Merge pull request #1 from fengmk2/jsonLimit
* add jsonLimit options to fix json and form body limit confuse
0.0.1 / 2014-02-18
==================
* update package name, merge middleware into module.exports
* complete readme
* complete bodyparser and bodyparser.middleware
* Initial commit
+20
View File
@@ -0,0 +1,20 @@
The MIT License (MIT)
Copyright (c) 2014 dead_horse
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+111
View File
@@ -0,0 +1,111 @@
# [**koa-bodyparser**](https://github.com/koajs/bodyparser)
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Coveralls][coveralls-image]][coveralls-url]
[![David deps][david-image]][david-url]
[![node version][node-image]][node-url]
[npm-image]: https://img.shields.io/npm/v/koa-bodyparser.svg?style=flat-square
[npm-url]: https://npmjs.com/package/koa-bodyparser
[travis-image]: https://img.shields.io/travis/koajs/bodyparser.svg?style=flat-square
[travis-url]: https://travis-ci.org/koajs/bodyparser
[coveralls-image]: https://img.shields.io/coveralls/koajs/bodyparser.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/koajs/bodyparser?branch=master
[david-image]: https://img.shields.io/david/koajs/bodyparser.svg?style=flat-square
[david-url]: https://david-dm.org/koajs/bodyparser
[node-image]: https://img.shields.io/badge/node.js-%3E=_8-green.svg?style=flat-square
[node-url]: http://nodejs.org/download/
A body parser for koa, based on [co-body](https://github.com/tj/co-body). support `json`, `form` and `text` type body.
> Notice: this module doesn't support parsing multipart format data, please use [`@koa/multer`](https://github.com/koajs/multer) to parse multipart format data.
## Install
[![NPM](https://nodei.co/npm/koa-bodyparser.png?downloads=true)](https://nodei.co/npm/koa-bodyparser/)
## Usage
```js
const Koa = require('koa');
const bodyParser = require('koa-bodyparser');
const app = new Koa();
app.use(bodyParser());
app.use(async ctx => {
// the parsed body will store in ctx.request.body
// if nothing was parsed, body will be an empty object {}
ctx.body = ctx.request.body;
});
```
## Options
* **enableTypes**: parser will only parse when request type hits enableTypes, support `json/form/text/xml`, default is `['json', 'form']`.
* **encoding**: requested encoding. Default is `utf-8` by `co-body`.
* **formLimit**: limit of the `urlencoded` body. If the body ends up being larger than this limit, a 413 error code is returned. Default is `56kb`.
* **jsonLimit**: limit of the `json` body. Default is `1mb`.
* **textLimit**: limit of the `text` body. Default is `1mb`.
* **xmlLimit**: limit of the `xml` body. Default is `1mb`.
* **strict**: when set to true, JSON parser will only accept arrays and objects. Default is `true`. See [strict mode](https://github.com/cojs/co-body#options) in `co-body`. In strict mode, `ctx.request.body` will always be an object(or array), this avoid lots of type judging. But text body will always return string type.
* **detectJSON**: custom json request detect function. Default is `null`.
```js
app.use(bodyParser({
detectJSON: function (ctx) {
return /\.json$/i.test(ctx.path);
}
}));
```
* **extendTypes**: support extend types:
```js
app.use(bodyParser({
extendTypes: {
json: ['application/x-javascript'] // will parse application/x-javascript type body as a JSON string
}
}));
```
* **onerror**: support custom error handle, if `koa-bodyparser` throw an error, you can customize the response like:
```js
app.use(bodyParser({
onerror: function (err, ctx) {
ctx.throw(422, 'body parse error');
}
}));
```
* **disableBodyParser**: you can dynamic disable body parser by set `ctx.disableBodyParser = true`.
```js
app.use(async (ctx, next) => {
if (ctx.path === '/disable') ctx.disableBodyParser = true;
await next();
});
app.use(bodyParser());
```
## Raw Body
You can access raw request body by `ctx.request.rawBody` after `koa-bodyparser` when:
1. `koa-bodyparser` parsed the request body.
2. `ctx.request.rawBody` is not present before `koa-bodyparser`.
## Koa 1 Support
To use `koa-bodyparser` with koa@1, please use [bodyparser 2.x](https://github.com/koajs/bodyparser/tree/2.x).
```bash
npm install koa-bodyparser@2 --save
```
#### Licences
---
[MIT](LICENSE)
+136
View File
@@ -0,0 +1,136 @@
'use strict';
const parse = require('co-body');
const copy = require('copy-to');
const typeis = require('type-is');
/**
* @param [Object] opts
* - {String} jsonLimit default '1mb'
* - {String} formLimit default '56kb'
* - {string} encoding default 'utf-8'
* - {Object} extendTypes
*/
module.exports = function(opts) {
opts = opts || {};
const {detectJSON} = opts;
const {onerror} = opts;
const enableTypes = opts.enableTypes || ['json', 'form'];
const enableForm = checkEnable(enableTypes, 'form');
const enableJson = checkEnable(enableTypes, 'json');
const enableText = checkEnable(enableTypes, 'text');
const enableXml = checkEnable(enableTypes, 'xml');
opts.detectJSON = undefined;
opts.onerror = undefined; // eslint-disable-line unicorn/prefer-add-event-listener
// force co-body return raw body
opts.returnRawBody = true;
// default json types
const jsonTypes = [
'application/json',
'application/json-patch+json',
'application/vnd.api+json',
'application/csp-report',
'application/scim+json'
];
// default form types
const formTypes = ['application/x-www-form-urlencoded'];
// default text types
const textTypes = ['text/plain'];
// default xml types
const xmlTypes = ['text/xml', 'application/xml'];
const jsonOpts = formatOptions(opts, 'json');
const formOpts = formatOptions(opts, 'form');
const textOpts = formatOptions(opts, 'text');
const xmlOpts = formatOptions(opts, 'xml');
const extendTypes = opts.extendTypes || {};
extendType(jsonTypes, extendTypes.json);
extendType(formTypes, extendTypes.form);
extendType(textTypes, extendTypes.text);
extendType(xmlTypes, extendTypes.xml);
// eslint-disable-next-line func-names
return async function bodyParser(ctx, next) {
if (ctx.request.body !== undefined || ctx.disableBodyParser)
return await next(); // eslint-disable-line no-return-await
try {
const res = await parseBody(ctx);
ctx.request.body = 'parsed' in res ? res.parsed : {};
if (ctx.request.rawBody === undefined) ctx.request.rawBody = res.raw;
} catch (err) {
if (onerror) {
onerror(err, ctx);
} else {
throw err;
}
}
await next();
};
async function parseBody(ctx) {
if (
enableJson &&
((detectJSON && detectJSON(ctx)) ||
isTypes(ctx.request.get('content-type'), jsonTypes))
) {
return await parse.json(ctx, jsonOpts); // eslint-disable-line no-return-await
}
if (enableForm && ctx.request.is(formTypes)) {
return await parse.form(ctx, formOpts); // eslint-disable-line no-return-await
}
if (enableText && ctx.request.is(textTypes)) {
return (await parse.text(ctx, textOpts)) || '';
}
if (enableXml && ctx.request.is(xmlTypes)) {
return (await parse.text(ctx, xmlOpts)) || '';
}
return {};
}
};
function formatOptions(opts, type) {
const res = {};
copy(opts).to(res);
res.limit = opts[type + 'Limit'];
return res;
}
function extendType(original, extend) {
if (extend) {
if (!Array.isArray(extend)) {
extend = [extend];
}
extend.forEach(function(extend) {
original.push(extend);
});
}
}
function checkEnable(types, type) {
return types.includes(type);
}
function isTypes(contentTypeValue, types) {
if (typeof contentTypeValue === 'string') {
// trim extra semicolon
contentTypeValue = contentTypeValue.replace(/;$/, '');
}
return typeis.is(contentTypeValue, types);
}
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2013-present cojs and the contributors.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+82
View File
@@ -0,0 +1,82 @@
# co-body
[![NPM version][npm-image]][npm-url]
[![CI](https://github.com/cojs/co-body/actions/workflows/node.yml/badge.svg)](https://github.com/cojs/co-body/actions/workflows/node.yml)
[![Test coverage][codecov-image]][codecov-url]
[![npm download][download-image]][download-url]
[npm-image]: https://img.shields.io/npm/v/co-body.svg?style=flat-square
[npm-url]: https://npmjs.org/package/co-body
[codecov-image]: https://codecov.io/github/cojs/co-body/coverage.svg?branch=master
[codecov-url]: https://codecov.io/github/cojs/co-body?branch=master
[download-image]: https://img.shields.io/npm/dm/co-body.svg?style=flat-square
[download-url]: https://npmjs.org/package/co-body
> Parse request bodies with generators inspired by [Raynos/body](https://github.com/Raynos/body).
## Installation
```bash
$ npm install co-body
```
## Options
- `limit` number or string representing the request size limit (1mb for json and 56kb for form-urlencoded)
- `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).
- `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).
See [Prototype-Poisoning](https://fastify.dev/docs/latest/Guides/Prototype-Poisoning/) for more details about prototype poisoning attacks.
Possible values are `'error'`, `'remove'` and `'ignore'`.
Default to `'error'`, it will throw a `SyntaxError` when `Prototype-Poisoning` happen.
- `queryString` an object of options when parsing query strings and form data. See [qs](https://github.com/hapijs/qs) for more information.
- `returnRawBody` when set to `true`, the return value of `co-body` will be an object with two properties: `{ parsed: /* parsed value */, raw: /* raw body */}`.
- `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.
- `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.
- `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.
more options available via [raw-body](https://github.com/stream-utils/raw-body#getrawbodystream-options-callback):
## Example
```js
// application/json
var body = await parse.json(req);
// explicit limit
var body = await parse.json(req, { limit: '10kb' });
// application/x-www-form-urlencoded
var body = await parse.form(req);
// text/plain
var body = await parse.text(req);
// either
var body = await parse(req);
// custom type
var body = await parse(req, { textTypes: ['text', 'html'] });
```
## Koa
This lib also supports `ctx.req` in Koa (or other libraries),
so that you may simply use `this` instead of `this.req`.
```js
// application/json
var body = await parse.json(this);
// application/x-www-form-urlencoded
var body = await parse.form(this);
// text/plain
var body = await parse.text(this);
// either
var body = await parse(this);
```
# License
[MIT](LICENSE.txt)
+6
View File
@@ -0,0 +1,6 @@
'use strict';
exports = module.exports = require('./lib/any');
exports.json = require('./lib/json');
exports.form = require('./lib/form');
exports.text = require('./lib/text');
+51
View File
@@ -0,0 +1,51 @@
'use strict';
/**
* Module dependencies.
*/
const typeis = require('type-is');
const json = require('./json');
const form = require('./form');
const text = require('./text');
const jsonTypes = [ 'json', 'application/*+json', 'application/csp-report' ];
const formTypes = [ 'urlencoded' ];
const textTypes = [ 'text' ];
/**
* Return a Promise which parses form and json requests
* depending on the Content-Type.
*
* Pass a node request or an object with `.req`,
* such as a koa Context.
*
* @param {Request} req
* @param {Options} [opts]
* @return {Function}
* @api public
*/
module.exports = async function(req, opts) {
req = req.req || req;
opts = opts || {};
// json
const jsonType = opts.jsonTypes || jsonTypes;
if (typeis(req, jsonType)) return json(req, opts);
// form
const formType = opts.formTypes || formTypes;
if (typeis(req, formType)) return form(req, opts);
// text
const textType = opts.textTypes || textTypes;
if (typeis(req, textType)) return text(req, opts);
// invalid
const type = req.headers['content-type'] || '';
const message = type ? 'Unsupported content-type: ' + type : 'Missing content-type';
const err = new Error(message);
err.status = 415;
throw err;
};
+49
View File
@@ -0,0 +1,49 @@
'use strict';
/**
* Module dependencies.
*/
const raw = require('raw-body');
const inflate = require('inflation');
const qs = require('qs');
const utils = require('./utils');
/**
* Return a Promise which parses x-www-form-urlencoded requests.
*
* Pass a node request or an object with `.req`,
* such as a koa Context.
*
* @param {Request} req
* @param {Options} [opts]
* @return {Function}
* @api public
*/
module.exports = async function(req, opts) {
req = req.req || req;
opts = utils.clone(opts);
const queryString = opts.queryString || {};
// keep compatibility with qs@4
if (queryString.allowDots === undefined) queryString.allowDots = true;
// defaults
const len = req.headers['content-length'];
const encoding = req.headers['content-encoding'] || 'identity';
if (len && encoding === 'identity') opts.length = ~~len;
opts.encoding = opts.encoding || 'utf8';
opts.limit = opts.limit || '56kb';
opts.qs = opts.qs || qs;
const str = await raw(inflate(req), opts);
try {
const parsed = opts.qs.parse(str, queryString);
return opts.returnRawBody ? { parsed, raw: str } : parsed;
} catch (err) {
err.status = 400;
err.body = str;
throw err;
}
};
+61
View File
@@ -0,0 +1,61 @@
'use strict';
/**
* Module dependencies.
*/
const raw = require('raw-body');
const inflate = require('inflation');
const bourne = require('@hapi/bourne');
const utils = require('./utils');
// Allowed whitespace is defined in RFC 7159
// http://www.rfc-editor.org/rfc/rfc7159.txt
const strictJSONReg = /^[\x20\x09\x0a\x0d]*(\[|\{)/;
/**
* Return a Promise which parses json requests.
*
* Pass a node request or an object with `.req`,
* such as a koa Context.
*
* @param {Request} req
* @param {Options} [opts]
* @return {Function}
* @api public
*/
module.exports = async function(req, opts) {
req = req.req || req;
opts = utils.clone(opts);
// defaults
const len = req.headers['content-length'];
const encoding = req.headers['content-encoding'] || 'identity';
if (len && encoding === 'identity') opts.length = ~~len;
opts.encoding = opts.encoding || 'utf8';
opts.limit = opts.limit || '1mb';
const strict = opts.strict !== false;
const protoAction = opts.onProtoPoisoning || 'error';
const str = await raw(inflate(req), opts);
try {
const parsed = parse(str);
return opts.returnRawBody ? { parsed, raw: str } : parsed;
} catch (err) {
err.status = 400;
err.body = str;
throw err;
}
function parse(str) {
if (!strict) return str ? bourne.parse(str, { protoAction }) : str;
// strict mode always return object
if (!str) return {};
// strict JSON test
if (!strictJSONReg.test(str)) {
throw new SyntaxError('invalid JSON, only supports object and array');
}
return bourne.parse(str, { protoAction });
}
};
+37
View File
@@ -0,0 +1,37 @@
'use strict';
/**
* Module dependencies.
*/
const raw = require('raw-body');
const inflate = require('inflation');
const utils = require('./utils');
/**
* Return a Promise which parses text/plain requests.
*
* Pass a node request or an object with `.req`,
* such as a koa Context.
*
* @param {Request} req
* @param {Options} [opts]
* @return {Function}
* @api public
*/
module.exports = async function(req, opts) {
req = req.req || req;
opts = utils.clone(opts);
// defaults
const len = req.headers['content-length'];
const encoding = req.headers['content-encoding'] || 'identity';
if (len && encoding === 'identity') opts.length = ~~len;
opts.encoding = opts.encoding === undefined ? 'utf8' : opts.encoding;
opts.limit = opts.limit || '1mb';
const str = await raw(inflate(req), opts);
// ensure return the same format with json / form
return opts.returnRawBody ? { parsed: str, raw: str } : str;
};
+14
View File
@@ -0,0 +1,14 @@
'use strict';
/**
* Module dependencies.
*/
exports.clone = function(opts) {
const options = {};
opts = opts || {};
for (const key in opts) {
options[key] = opts[key];
}
return options;
};
+45
View File
@@ -0,0 +1,45 @@
{
"name": "co-body",
"version": "6.2.0",
"repository": "cojs/co-body",
"description": "request body parsing for co",
"keywords": [
"request",
"parse",
"parser",
"json",
"co",
"generators",
"urlencoded"
],
"dependencies": {
"@hapi/bourne": "^3.0.0",
"inflation": "^2.0.0",
"qs": "^6.5.2",
"raw-body": "^2.3.3",
"type-is": "^1.6.16"
},
"devDependencies": {
"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 .",
"test": "egg-bin test -r should",
"cov": "eslint . && egg-bin cov -r should",
"ci": "npm run lint && npm run cov"
},
"files": [
"index.js",
"lib/"
],
"engines": {
"node": ">=8.0.0"
}
}
+71
View File
@@ -0,0 +1,71 @@
{
"name": "koa-bodyparser",
"version": "4.4.1",
"description": "a body parser for Koa",
"main": "index.js",
"scripts": {
"lint": "xo",
"lint:fix": "xo --fix",
"test": "mocha --require should test/*.spec.js --exit",
"coverage": "nyc npm run test --reporter=lcov",
"ci": "npm run lint && npm run coverage"
},
"repository": {
"type": "git",
"url": "git://github.com/koajs/bodyparser.git"
},
"files": [
"index.js"
],
"keywords": [
"bodyParser",
"json",
"urlencoded",
"koa",
"body"
],
"author": {
"name": "dead_horse",
"email": "dead_horse@qq.com",
"url": " http://deadhorse.me"
},
"license": "MIT",
"devDependencies": {
"eslint-config-xo-lass": "^1.0.3",
"husky": "^4.2.5",
"koa": "^2",
"mocha": "^10.2.0",
"nyc": "^15.0.1",
"should": "^13.2.3",
"supertest": "^4.0.2",
"xo": "0.25.4"
},
"dependencies": {
"co-body": "^6.0.0",
"copy-to": "^2.0.1",
"type-is": "^1.6.18"
},
"xo": {
"prettier": true,
"space": true,
"extends": [
"xo-lass"
],
"rules": {
"node/no-deprecated-api": "off",
"no-unused-vars": "off",
"no-prototype-builtins": "off",
"prefer-rest-params": "off"
},
"ignores": [
"test/**"
]
},
"engines": {
"node": ">=8.0.0"
},
"bugs": {
"url": "https://github.com/koajs/body-parser/issues"
},
"homepage": "https://github.com/koajs/body-parser"
}