Skip to content
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

Set ContentLength to 0 when Body is nil #698

Merged
merged 3 commits into from
Sep 22, 2023
Merged

Conversation

praem90
Copy link
Contributor

@praem90 praem90 commented Sep 21, 2023

To address the issue #671 set ContentLength header to 0 when Body is nil and setContentLength was set to true.

Closes #671

Set ContentLength=0 when body is `nil` and `setContentLength` is true
Add a test case for ContentLength when body is nil
Copy link
Member

@jeevatkm jeevatkm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@praem90 Kindly check the PR comment and address.

middleware.go Show resolved Hide resolved
@jeevatkm jeevatkm added the bug label Sep 22, 2023
@jeevatkm jeevatkm added this to the v2.9.0 milestone Sep 22, 2023
Refactor if block for better readability
Copy link
Member

@jeevatkm jeevatkm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @praem90, for the PR, appreciated.

@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (1969424) 95.64% compared to head (ec85026) 95.65%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #698   +/-   ##
=======================================
  Coverage   95.64%   95.65%           
=======================================
  Files          12       12           
  Lines        1608     1611    +3     
=======================================
+ Hits         1538     1541    +3     
  Misses         42       42           
  Partials       28       28           
Files Changed Coverage Δ
middleware.go 92.22% <100.00%> (+0.07%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jeevatkm jeevatkm merged commit 9ef9b6f into go-resty:master Sep 22, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

How to set Content-Lenght=0 with nil Body?
2 participants