express-http-proxy
express-http-proxy copied to clipboard
Support non-strict JSON body (number)
Currently, when not treating a request body as a buffer, the Content-Length
header is set in prepareProxyReq
by the bufferOrString
method.
When a request contains a JSON body with a number value, such as 12345
, this method (bufferOrString
) will return undefined
instead of the body length. A number value can be valid JSON. For example, when using the body-parser
package, you set strict: false
to allow this type of JSON.
This results in an error later on when the _http-client
package attempts to set header values. It validates these headers and throws an error when finding undefined
as the value for Content-Length
:
Solution here could probably be just to also handle the number
data type when setting bodyContent
in prepareProxyReq
.