Closed piotr-s-brainhub closed 5 years ago
I did a workaround with:
if (!['post', 'put', 'patch'].includes(ctx.method.toLowerCase())) {
ctx.disableBodyParser = true;
}
await next();
});
however IMO this should be the default behavior - in order to avoid breaking backwards compatibility, you could update the default behavior in the next major release
ctx.request.body
is always return an object to simplify application's code(no need to detect if ctx.request.body
's type), this is by design. Actually you don't even touch ctx.request.body
when you don't expect the request will have body( etc. when request is GET, HEAD).
Request body is an empty object for GET requests but IMO it should be
undefined
.