Open tafel opened 1 year ago
Node.js version: 18.12.0
OS version: docker node:18.12.0-bullseye
Description:
Documentation says that unparsed body can be accessed with const unparsed = require('koa-body/unparsed.js');. But it throws an error instead.
const unparsed = require('koa-body/unparsed.js');
MODULE_NOT_FOUND : Cannot find module 'koa-body/unparsed.js'
It should require the unparsed script
Maybe it is not the best fix, but it is possible to require the file by changing the path:
const unparsed = require('koa-body/lib/unparsed.js').default;
If it is a viable solution, README.md should be updated to reflect this.
Note that the unparsedBody symbol can be used directly (i.e. without first importing it). Like this:
unparsedBody
const rawBody = ctx.request.body[Symbol.for("unparsedBody")];
Describe the bug
Node.js version: 18.12.0
OS version: docker node:18.12.0-bullseye
Description:
Documentation says that unparsed body can be accessed with
const unparsed = require('koa-body/unparsed.js');
. But it throws an error instead.Actual behavior
Expected behavior
It should require the unparsed script
Code to reproduce
const unparsed = require('koa-body/unparsed.js');
Fix suggestion
Maybe it is not the best fix, but it is possible to require the file by changing the path:
const unparsed = require('koa-body/lib/unparsed.js').default;
If it is a viable solution, README.md should be updated to reflect this.
Checklist