Gathering detailed insights and metrics for co-body
Gathering detailed insights and metrics for co-body
Gathering detailed insights and metrics for co-body
Gathering detailed insights and metrics for co-body
npm install co-body
Module System
Unable to determine the module system for this package.
Min. Node Version
Typescript Support
Node Version
NPM Version
325 Stars
89 Commits
42 Forks
9 Watching
1 Branches
22 Contributors
Updated on 25 Sept 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-9.6%
206,579
Compared to previous day
Last week
-1.7%
1,177,405
Compared to previous week
Last month
6.3%
5,048,445
Compared to previous month
Last year
10.1%
51,805,726
Compared to previous year
Parse request bodies with generators inspired by Raynos/body.
1$ npm install co-body
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.
See 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 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 library.formTypes
is used to determine what media type co-body will parse as form, this option is passed directly to the 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 library.more options available via raw-body:
1// application/json 2var body = await parse.json(req); 3 4// explicit limit 5var body = await parse.json(req, { limit: '10kb' }); 6 7// application/x-www-form-urlencoded 8var body = await parse.form(req); 9 10// text/plain 11var body = await parse.text(req); 12 13// either 14var body = await parse(req); 15 16// custom type 17var body = await parse(req, { textTypes: ['text', 'html'] });
This lib also supports ctx.req
in Koa (or other libraries),
so that you may simply use this
instead of this.req
.
1// application/json 2var body = await parse.json(this); 3 4// application/x-www-form-urlencoded 5var body = await parse.form(this); 6 7// text/plain 8var body = await parse.text(this); 9 10// either 11var body = await parse(this);
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 10/30 approved changesets -- score normalized to 3
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More