How to get the request body within onrequest(req, res, next) method?

How do I get the request body from the req parameter in the onrequest(req, res, next) method?

0 4 475
4 REPLIES 4

Former Community Member
Not applicable

I'm not sure what I'm meant to take from this.

Does this mean that the request body is only available in the req._chunks or that I need to use the accumulate-request plugin to get a 200 byte request body?

Thanks in advance,

Michael McD.

Former Community Member
Not applicable

The request body is indeed available only as chunks. MG has streaming enabled by default. You'll have to accumulate the data in the plugin and then act on the payload.

Cheers, got it working based upon the code you pointed me at.
Was just a bit surprised that this was the only way to get at a request body.

Anyway thanks a lot, you saved the day with that pointer. I'd never have worked that out.

Michael