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

"Get" returning error on non 2xx response #200

Open
N0ct3 opened this issue Jul 13, 2023 · 0 comments
Open

"Get" returning error on non 2xx response #200

N0ct3 opened this issue Jul 13, 2023 · 0 comments

Comments

@N0ct3
Copy link

N0ct3 commented Jul 13, 2023

Hello,
This might actually be more of a question than an actual issue:
The http.Client.Get doc states that:

An error is returned if the Client's CheckRedirect function fails or if there was an HTTP protocol error. A non-2xx response doesn't cause an error.

My understanding is that a retryablehttp.Client with default configuration would behaves similarly, retrying up to 4 times, and returning the response, no matter what the status code is, as long as there is no error.

But it seems that if the client doesn't get a success status in the configured number of retries, it WILL return an error similar to Get ...: GET ... giving up after 5 attempt(s), instead of returning the response with the non success status code.

Am I misunderstanding the doc?

Anyway, setting the client's ErrorHandler to retryablehttp.PassthroughErrorHandler seems to give what I expected to be the default behavior.

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

No branches or pull requests

1 participant