Skip to content

objectstorage: Do not parse NoContent responses#2513

Merged
mandre merged 1 commit intogophercloud:masterfrom
shiftstack:fix_swift_204_content_type
Nov 24, 2022
Merged

objectstorage: Do not parse NoContent responses#2513
mandre merged 1 commit intogophercloud:masterfrom
shiftstack:fix_swift_204_content_type

Conversation

@pierreprinetti
Copy link
Copy Markdown
Member

@pierreprinetti pierreprinetti commented Nov 23, 2022

Some Swift instances respond with HTTP status code 204 when asked to list containers and there are no containers, or when asked to list objects on an empty container. Before this patch, Gophercloud would error because the header content-type is absent on the response.

With this patch, objectstorage responses with HTTP status code 204 are immediately recognised as empty and their body is not read.

Potentially supersedes #2510

Some Swift instances respond with HTTP status code 204 when asked to
list containers and there are no containers, or when asked to list
objects on an empty container. Before this patch, Gophercloud would
error because the header `content-type` is absent on the response.

With this patch, objectstorage responses with HTTP status code 204 are
immediately recognised as empty and their body is not read.
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.004%) to 80.08% when pulling 64ed1bc on shiftstack:fix_swift_204_content_type into 740fda7 on gophercloud:master.

Copy link
Copy Markdown
Contributor

@EmilienM EmilienM left a comment

Choose a reason for hiding this comment

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

LGTM

cc @mandre for a second pair of eyes

Copy link
Copy Markdown
Contributor

@mandre mandre left a comment

Choose a reason for hiding this comment

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

LGTM. This should solve #2509.

Does #2510 still makes sense?

@mandre mandre merged commit 4cc91e5 into gophercloud:master Nov 24, 2022
@mandre mandre deleted the fix_swift_204_content_type branch November 24, 2022 07:22
@pierreprinetti
Copy link
Copy Markdown
Member Author

pierreprinetti commented Nov 24, 2022

Does #2510 still makes sense?

Ideally, the current issue is solved with this PR. But we might need to take yours out of the hat again in the future.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants