- Notifications
You must be signed in to change notification settings - Fork872
fix(fixRequestBody): fix request body for empty JSON object requests#640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
fix(fixRequestBody): fix request body for empty JSON object requests#640
Uh oh!
There was an error while loading.Please reload this page.
Conversation
eemelipa left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM
Faced the same issue. Allowing empty objects in the body fixes it
HappyColour commentedNov 11, 2021
This PR has been released right? |
eemelipa commentedNov 11, 2021
I don't think so. The PR is still open and the library doesn't have the fix |
HappyColour commentedNov 11, 2021
No, it is still open. |
chimurai commentedNov 28, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hi@mhassan1. I left a remark in the PR a while ago which hasn't been resolved. Happy to merge it after it's fixed. Edit: Sorry, review was pending all the time. (bad github ui/ux) Should be visible now. |
Uh oh!
There was an error while loading.Please reload this page.
@chimurai This is ready for re-review. |
coveralls commentedDec 2, 2021 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thanks@mhassan1 ! |
published in |
Description
This PR fixes the
fixRequestBody
utility so that it treats empty object bodies like non-empty object bodies and fixes them, as expected.Motivation and Context
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 inc9bec81
Currently, JSON requests with empty object payloads do not get their request bodies fixed by this utility, and the request to the target hangs while the target waits for a payload that will never arrive.
This PR removes the special handling for empty objects and treats them like any other object.
Resolves#639.
How has this been tested?
I ran the reproduction steps in#639 before and after the code change. I also updated automated tests.
Types of changes
Checklist: