-
Notifications
You must be signed in to change notification settings - Fork 131
Open
Labels
Description
Describe the bug
Node.js version:
v15.14.0
OS version:
macos monterey 12.5.1
Description:
I use the demo : https://github.com/koajs/koa-body#hello-world---quickstart to recive a application/xml request, but ctx.request.body is empty.
Actual behavior
Expected behavior
expected the same req content
Code to reproduce
req cmd:
curl --location --request POST 'http://127.0.0.1:3000' \
--header 'Content-Type: application/xml' \
--data-raw '<xml>
<mch_id>123</mch_id>
<nonce_str>adb</nonce_str>
<sign>BIYTVI1123</sign>
</xml>'
server code(same as the example):
const Koa = require('koa');
const koaBody = require('koa-body');
const app = new Koa();
app.use(koaBody());
app.use(ctx => {
ctx.body = `Request Body: ${JSON.stringify(ctx.request.body)}`;
});
app.listen(3000);
Checklist
- [ yes] I have searched through GitHub issues for similar issues.
- [ yes] I have completely read through the README and documentation.
- [ yes] I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.
cedx
