fix: properly proxy the body#460
Closed
sarumont wants to merge 2 commits intochimurai:masterfrom
Closed
Conversation
Owner
|
Thanks for the PR. Could you add a test as proof for this fix? You can add |
DeepCode's analysis on #691f39 found:
Top issues
👉 View analysis in DeepCode’s Dashboard | Configure the bot |
Things like body-parser can break proxying anything with a body. This checks for that (req.body will become an Object) and streams the body into the proxy request. Fixes chimurai#90, chimurai#320, chimurai#417 - and maybe some more
It is possible that the content length is not equivalent due to JSON serialization, so we need to re-write the Content-Length header to the upstream. This commit also restricts the fix to ONLY handle JSON. Other content types could be handled with some conditionals if necessary.
Author
|
@chimurai Sorry, lost track of this PR between work and a new baby arriving. :) I just updated with a fix for a bug I found, and I'll drop a test in as soon as I can! |
Owner
|
fixed in #492 |
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.
Things like
body-parsercan break proxying anything with a body. Thischecks for that (
req.bodywill become anObject) and streams the bodyinto the proxy request.
Fixes #90, #320, #417 - and maybe some more