Gathering detailed insights and metrics for co-wechat-body
Gathering detailed insights and metrics for co-wechat-body
Gathering detailed insights and metrics for co-wechat-body
Gathering detailed insights and metrics for co-wechat-body
npm install co-wechat-body
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
4 Stars
11 Commits
3 Forks
1 Watchers
1 Branches
1 Contributors
Updated on Jun 15, 2019
Minified
Minified + Gzipped
Latest Version
0.1.6
Package Id
co-wechat-body@0.1.6
Size
2.96 kB
NPM Version
2.15.9
Node Version
4.5.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
Parse wechat xml request body for Koa
1const koa = require('koa'); 2const wechatBodyParser = require('co-wechat-body'); 3 4const app = koa(); 5app.use(wechatBodyParser(<options>)); 6 7app.use(function *() { 8 // the parsed body will store in this.request.body 9 // if nothing was parsed, body will be undefined 10 this.body = this.request.body; 11});
co-wechat-body
will carefully check and set this.request.body
, so it can intergate well with other body parsers such as koa-bodyparser
:
1// ... 2const bodyParser = require('koa-bodyparser'); 3 4// ... 5app.use(wechatBodyParser(<options>)); 6app.use(bodyParser());
http request raw body:
<xml>
<return_code><![CDATA[SUCCESS]]></return_code>
<return_msg><![CDATA[OK]]></return_msg>
</xml>
parse result, this.request.body:
{
"return_code": "SUCCESS",
"return_msg": "OK"
}
Please refer to (https://www.npmjs.com/package/koa-xml-body#options)
utf8
. If not set, the lib will retrive it from content-type
(such as content-type:application/xml;charset=gb2312
).1mb
.content-length
is found, it will be overwritten automatically.noop
function. It means it will eat the error silently. You can config it to customize the response.1app.use(xmlParser({
2 limit: 128,
3 length: 200, // '1mb'|1024... If not sure about the effect, just leave it unspecified
4 encoding: 'utf8', // lib will detect it from `content-type`
5 onerror: (err, ctx) => {
6 ctx.throw(err.status, err.message);
7 }
8}));
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 0/11 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
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
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-06-23
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