[all] IsEmpty to check for HTTP status 204#2540
Merged
mandre merged 1 commit intogophercloud:masterfrom Mar 8, 2023
Merged
Conversation
240844e to
94c64d1
Compare
Member
Author
|
@mandre you modified the milestone to a minor bump. Is that because you think this PR needs a semver:minor label? |
Contributor
Not at all, it's because I've merge a couple of PRs in main last week that requires a minor bump. Because we don't maintain stable branches yet, this supposed the next version is going to be 1.3.0. |
94c64d1 to
6ed94ca
Compare
With this commit, all `IsEmpty() (bool, error)` functions now check the status code of the result. If it's `204`, they immediately confirm that the page is empty. This change was introduced in commit 64ed1bc in `objectstorage` to support Swift instances running behind a reverse proxy that was truncating `content-type` headers from `204 Empty` responses. With this change, the same check is applied to all services. While no functional impact is expected on non-proxied OpenStack modules, this patch will prevent issues on proxied clouds. In general, it also seems reasonable to expect `204 Empty` responses to be empty. --- This change is the result of running: ```shell find -name 'results.go' -exec sed -i 's|^\(func (\(.\+\) .\+) IsEmpty() (bool, error) {\)$|\1\nif \2.StatusCode==204 {\nreturn true,nil\n}\n|' {} \; go fmt ./... ```
6ed94ca to
974f426
Compare
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.
With this commit, all
IsEmpty() (bool, error)functions now check the status code of the result. If it's204, they immediately confirm that the page is empty.This change was introduced in commit 64ed1bc in
objectstorageto support Swift instances running behind a reverse proxy that was truncatingcontent-typeheaders from204 Emptyresponses. With this change, the same check is applied to all services.While no functional impact is expected on non-proxied OpenStack modules, this patch will prevent issues on proxied clouds. In general, it also seems reasonable to expect
204 Emptyresponses to be empty.This change is the result of running: