Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
chimurai merged 2 commits intochimurai:masterfrommhassan1:fix/fix-request-body-empty-json
Jan 23, 2022
Merged

fix(fixRequestBody): fix request body for empty JSON object requests#640

chimurai merged 2 commits intochimurai:masterfrommhassan1:fix/fix-request-body-empty-json
Jan 23, 2022

Conversation

mhassan1
Copy link
Contributor

Description

This PR fixes thefixRequestBody utility so that it treats empty object bodies like non-empty object bodies and fixes them, as expected.

Motivation and Context

ThefixRequestBody utility contains a check for empty objects that results in earlyreturn:

if(!requestBody||!Object.keys(requestBody).length){
return;
}

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

SuperOleg39, pw-helper, and rusichmr86 reacted with heart emoji
Copy link

@eemelipaeemelipa left a 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
Copy link

This PR has been released right?

@eemelipa
Copy link

This PR has been released right?

I don't think so. The PR is still open and the library doesn't have the fix

@HappyColour
Copy link

This PR has been released right?

I don't think so. The PR is still open and the library doesn't have the fix

Thx bro@eemelipa,please confirm this pr has been merged@mhassan1.

@mhassan1
Copy link
ContributorAuthor

No, it is still open.

@chimurai
Copy link
Owner

chimurai commentedNov 28, 2021
edited
Loading

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.

mhassan1 reacted with thumbs up emoji

@chimuraichimurai self-requested a reviewNovember 28, 2021 11:45
@mhassan1
Copy link
ContributorAuthor

@chimurai This is ready for re-review.

@coveralls
Copy link

coveralls commentedDec 2, 2021
edited
Loading

Coverage Status

Coverage remained the same at 98.86% when pullingece40cb on mhassan1:fix/fix-request-body-empty-json into6b5d7a8 on chimurai:master.

@chimuraichimurai changed the titleFix request body for empty JSON object requestsfix(fixRequestBody): fix request body for empty JSON object requestsJan 23, 2022
@chimuraichimurai merged commit2bddd38 intochimurai:masterJan 23, 2022
@chimurai
Copy link
Owner

Thanks@mhassan1 !

@chimurai
Copy link
Owner

published inhttp-proxy-middleware@2.0.2

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@chimuraichimuraichimurai approved these changes

+1 more reviewer

@eemelipaeemelipaeemelipa approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Empty JSON object does not get fixed byfixRequestBody

5 participants

@mhassan1@HappyColour@eemelipa@chimurai@coveralls

[8]ページ先頭

©2009-2025 Movatter.jp