opensearch-project / opensearch-go

Go Client for OpenSearch
https://opensearch.org/docs/latest/clients/go/
Apache License 2.0
188 stars 96 forks source link

Fix empty request body on retries with compression enabled #542

Closed merlinz01 closed 1 month ago

merlinz01 commented 1 month ago

Description

Make the transport use a new reader for each retry when gzip compression is enabled. Also be more explicit about doing so for non-compressed requests. Test included.

Issues Resolved

Closes #541.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 67.96%. Comparing base (06a6dc8) to head (5258878). Report is 22 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #542 +/- ## =========================================== + Coverage 57.29% 67.96% +10.67% =========================================== Files 315 376 +61 Lines 9823 8853 -970 =========================================== + Hits 5628 6017 +389 + Misses 2902 1555 -1347 + Partials 1293 1281 -12 ``` | [Flag](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/542/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | Coverage Δ | | |---|---|---| | [integration](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/542/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | `60.39% <100.00%> (+9.55%)` | :arrow_up: | | [unit](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/542/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | `15.28% <100.00%> (+2.43%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/542?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project) | Coverage Δ | | |---|---|---| | [opensearchtransport/opensearchtransport.go](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/542?src=pr&el=tree&filepath=opensearchtransport%2Fopensearchtransport.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project#diff-b3BlbnNlYXJjaHRyYW5zcG9ydC9vcGVuc2VhcmNodHJhbnNwb3J0Lmdv) | `86.63% <100.00%> (+1.47%)` | :arrow_up: | ... and [272 files with indirect coverage changes](https://app.codecov.io/gh/opensearch-project/opensearch-go/pull/542/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=opensearch-project)
merlinz01 commented 1 month ago

I forgot to create a new branch for the PR. Please disregard.