You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an empty object request (curl ... -H 'content-type: application/json' -d '{}') is made to a proxy with onProxyReq: fixRequestBody, the request hangs because the target is expecting content-length: 2 but never receives any payload because of the early return. See Steps to Reproduce, below.
Am I missing a reason why empty objects get special handling?
yarn why http-proxy-middleware
ORnpm ls http-proxy-middleware
output (mask private folder names with *****)http-proxy-middleware
.Describe the bug (be clear and concise)
The
fixRequestBody
utility contains a check for empty objects that results in earlyreturn
:http-proxy-middleware/src/handlers/fix-request-body.ts
Lines 11 to 13 in c9bec81
When an empty object request (
curl ... -H 'content-type: application/json' -d '{}'
) is made to a proxy withonProxyReq: fixRequestBody
, the request hangs because the target is expectingcontent-length: 2
but never receives any payload because of the earlyreturn
. See Steps to Reproduce, below.Am I missing a reason why empty objects get special handling?
Step-by-step reproduction instructions
Expected behavior (be clear and concise)
I expect an empty object JSON request to be proxied with the request body fixed, the same way as a non-empty object JSON request.
What http-proxy-middleware configuration are you using?
What OS/version and node/version are you seeing the problem?
Additional context (optional)
No response
The text was updated successfully, but these errors were encountered: