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
fixed uncontrolled error when server responds 200 #4317
fixed uncontrolled error when server responds 200 #4317
Conversation
result = json.loads(decode_text(response.content)) | ||
try: # This can fail, if some proxy returns 200 and an html message | ||
result = json.loads(decode_text(response.content)) | ||
except Exception: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is produced because of a message that it is not a json, right? The right way to check this is to check if application/json
header is present. I know you would think that is risky, but a server returning a json without a json header is a bug. The protocols need to be followed. If our own test's with the server fails (I hope they don't) we need to fix it in the server but I agree we cannot break old servers, in that case, narrow the exception capturing to the json decoding, please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need also to test with Artifactory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Tested manually with Artifactory CE 6.3 and Bintray
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Changelog: Fix: Improve error message when a server (like a proxy), returns 200-OK for a conan api call, but with an unexpected message.
Docs: Omit
Close #3985