villadora / express-http-proxy

Proxy middleware for express/connect
Other
1.23k stars 235 forks source link

proxyReqBodyDecorator value is not returned if parseReqBody == false #484

Open jamonkko opened 3 years ago

jamonkko commented 3 years ago

I parse the request body myself before express-http-proxy and set the parsed value with proxyReqBodyDecorator. But it seems that proxy does not send the self-parsed body.

There is a PR that fixes this already but have not been merged. Please merge it? https://github.com/villadora/express-http-proxy/pull/469

This might also fix similar looking issue: https://github.com/villadora/express-http-proxy/issues/358

cawoodadviceflow commented 3 months ago

I don't see why parseReqBody = false should mean we have absolutely no access to the body. What if it's an XML string? I see no benefit in this library parsing the body in 2 known formats (x-ww-form-urlencoded or json) or else nothing is accessible. Just provide req.body as a string and let developers use other libraries or JSON.parse() to do the parsing.