fix(fixRequestBody): fix request body for empty JSON object requests#640
Merged
chimurai merged 2 commits intochimurai:masterfrom Jan 23, 2022
mhassan1:fix/fix-request-body-empty-json
Merged
fix(fixRequestBody): fix request body for empty JSON object requests#640chimurai merged 2 commits intochimurai:masterfrom mhassan1:fix/fix-request-body-empty-json
chimurai merged 2 commits intochimurai:masterfrom
mhassan1:fix/fix-request-body-empty-json
Conversation
eemelipa
approved these changes
Oct 15, 2021
eemelipa
left a comment
There was a problem hiding this comment.
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 |
Contributor
Author
|
No, it is still open. |
Owner
|
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
requested changes
Nov 28, 2021
Contributor
Author
|
@chimurai This is ready for re-review. |
chimurai
approved these changes
Jan 23, 2022
Owner
|
Thanks @mhassan1 ! |
Owner
|
published in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR fixes the
fixRequestBodyutility so that it treats empty object bodies like non-empty object bodies and fixes them, as expected.Motivation and Context
The
fixRequestBodyutility 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: