How do I get the request body from the req parameter in the onrequest(req, res, next) method?
Please see this sample plugin https://github.com/apigee/microgateway-plugins/blob/master/accumulate-request/index.js
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.
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