-
Notifications
You must be signed in to change notification settings - Fork 305
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
fix: fix check for 'internal_failure' condition #387
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
…e `error' field In some cases response doesn't contain error_description field. So the retry won't work. The solution is to look at both error and error_description fields.
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.
This changes the test coverage: in test__token_endpoint_request_internal_failure_error, the first check should only have "error_description" set. Otherwise looks good.
Now test__token_endpoint_request_internal_failure_error contains two mutually exclusive cases.
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.
LGTM. Test could be refactored to loop over "error" and "error_description", but it's fine as is.
Fixed the test |
@georgysavva Thank you for submitting a patch! |
@georgysavva Do you think it's possible that, sometimes if we get errors from the server, the response will not be in json format, thus loading json from the response before checking ok would cause exception? |
@ziliangpeng totally makes sense. Should be a good improvement. Fill free to open a PR with the fix. |
As I was saying in this comment
In some cases response doesn't contain
error_description
field. So the retry won't work. The solution is to look at botherror
anderror_description
fields.