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

Correct bug detecting content type and parsing JSON responses #36

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DigitallyBorn
Copy link
Contributor

This is likely a breaking bug fix, since requests will now correctly parse the response body as json and return a hash, instead of returning the body as a string.

Fixes #34

@@ -316,7 +321,7 @@ def request(params)
end
end

response.body = Fog::JSON.decode(response.body) if !response.body.empty? && response.get_header('Content-Type') == 'application/json'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This value often comes back as application/json; charset=utf-8which fails the exact-string matching used before.

This is likely a breaking bug fix, since requests will now _correctly_ parse the response body as json and return a hash, instead of returning the body as a string.

Fixes fog#34
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.

Requests are incorrectly returning strings instead of hashes
1 participant