koajs / joi-router

Configurable, input and output validated routing for koa
MIT License
450 stars 96 forks source link

ctx.request.rawBody #129

Closed Sleepful closed 3 years ago

Sleepful commented 3 years ago

When using validate as joi validation, the ctx.request.rawBody cannot be accessed by middleware down the line.

However, if I remove the validate portion of a route (with the Joi.validations()), I am able to access ctx.request.rawBody just fine.

What gives? I'd like to have joi validation but also access to ctx.request.rawBody, is the library removing it from the request object?

Sleepful commented 3 years ago

Most likely related to https://github.com/koajs/joi-router/issues/63

Sleepful commented 3 years ago

ctx.request.rawBody can be accessed before joi validation through pre key, which was added in https://github.com/koajs/joi-router/pull/66