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

Add Response::error_for_status method to simplify checking responses #58

Merged
merged 1 commit into from
Apr 18, 2020
Merged

Add Response::error_for_status method to simplify checking responses #58

merged 1 commit into from
Apr 18, 2020

Conversation

adamreichold
Copy link
Contributor

Closes #56

@sbstp
Copy link
Owner

sbstp commented Apr 17, 2020

@adamreichold
Copy link
Contributor Author

adamreichold commented Apr 17, 2020

Is it worth also adding the ref variant?

I did wonder about that but came to the conclusion that the by-value version provides more safety as one cannot access a failed response after turning it into a Result. Since the by-ref variant could just as well be open coded, I preferred to keep it safe and simple.

That said, I have no real problem with adding that if you would like to have it.

@sbstp
Copy link
Owner

sbstp commented Apr 18, 2020

Fine like this. If someone wants the feature we can iterate later.

@sbstp sbstp merged commit 65f389c into sbstp:master Apr 18, 2020
@adamreichold adamreichold deleted the error-for-status branch April 18, 2020 07:06
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.

Add helper for converting Response into Result based on StatusCode
2 participants