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

Fix digest auth http: ContentLength=xxx with Body length 0 #730

Merged
merged 2 commits into from
Oct 14, 2023

Conversation

icepie
Copy link
Contributor

@icepie icepie commented Oct 11, 2023

No description provided.

@icepie
Copy link
Contributor Author

icepie commented Oct 11, 2023

#729

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.

@icepie Can you please add unit test cases?

@icepie
Copy link
Contributor Author

icepie commented Oct 12, 2023

@icepie Can you please add unit test cases?

Ok! I have added d3026f9

old code

Running tool: /home/icepie/.go/bin/go test -timeout 30s -run ^TestRequestDigestAuthWithBody$ github.com/go-resty/resty/v2

--- FAIL: TestRequestDigestAuthWithBody (0.00s)
    /home/icepie/Projects/resty-fix/resty_test.go:690: Method: POST
    /home/icepie/Projects/resty-fix/resty_test.go:691: Path: /dir/index.html
    /home/icepie/Projects/resty-fix/resty_test.go:690: Method: POST
    /home/icepie/Projects/resty-fix/resty_test.go:691: Path: /dir/index.html
    /home/icepie/Projects/resty-fix/resty_test.go:828: Error occurred [Post "http://127.0.0.1:40125/dir/index.html": net/http: HTTP/1.x transport connection broken: http: ContentLength=41 with Body length 0]
    /home/icepie/Projects/resty-fix/resty_test.go:842: Expected [200], got [0]
    /home/icepie/Projects/resty-fix/request_test.go:740: Result Success: &{"" ""}
    /home/icepie/Projects/resty-fix/resty_test.go:877: Response Status: 
    /home/icepie/Projects/resty-fix/resty_test.go:878: Response Time: 353.067µs
    /home/icepie/Projects/resty-fix/resty_test.go:879: Response Headers: map[]
    /home/icepie/Projects/resty-fix/resty_test.go:880: Response Cookies: []
    /home/icepie/Projects/resty-fix/resty_test.go:881: Response Body: 
FAIL
FAIL	github.com/go-resty/resty/v2	0.002s
FAIL

new code

Running tool: /home/icepie/.go/bin/go test -timeout 30s -run ^TestRequestDigestAuthWithBody$ github.com/go-resty/resty/v2

ok  	github.com/go-resty/resty/v2	(cached)

@jeevatkm jeevatkm added the bug label Oct 14, 2023
@jeevatkm jeevatkm added this to the v2.10.0 milestone Oct 14, 2023
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.

@icepie thanks for adding Test case

@codecov
Copy link

codecov bot commented Oct 14, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (6242e6f) 96.62% compared to head (d3026f9) 96.51%.

Additional details and impacted files
@@            Coverage Diff             @@
##               v2     #730      +/-   ##
==========================================
- Coverage   96.62%   96.51%   -0.11%     
==========================================
  Files          12       12              
  Lines        1630     1637       +7     
==========================================
+ Hits         1575     1580       +5     
- Misses         35       36       +1     
- Partials       20       21       +1     
Files Coverage Δ
digest.go 94.48% <71.42%> (-1.17%) ⬇️

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

@jeevatkm jeevatkm changed the title Fix http: ContentLength=xxx with Body length 0 Fix digest auth http: ContentLength=xxx with Body length 0 Oct 14, 2023
@jeevatkm jeevatkm merged commit 102a1bf into go-resty:v2 Oct 14, 2023
3 of 4 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.

2 participants