-
Notifications
You must be signed in to change notification settings - Fork 852
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 our terms of service and privacy 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
fix(fixRequestBody): fix request body for empty JSON object requests #640
Conversation
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
This PR has been released right? |
I don't think so. The PR is still open and the library doesn't have the fix |
No, it is still open. |
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. |
@chimurai This is ready for re-review. |
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 in c9bec81
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: