Add Error::{kind, status, into_response}.
Also, remove Response::{ok, error, client_error, server_error,
redirect}. The idea is that you would access these through the
Error object instead.
I fetched all the reverse dependencies of ureq on crates.io and looked
for uses of the methods being removed. I found none.
I'm also considering removing the error_on_non_2xx method entirely. If
it's easy to get the underlying response for errors, it would be nice to
make that the single way to do things rather than support two separate
ways of handling HTTP errors.
This commit is contained in:
committed by
Martin Algesten
parent
35c03521b9
commit
4c3b93d86d
@@ -145,30 +145,6 @@ impl Response {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Whether the response status is: 200 <= status <= 299
|
||||
pub fn ok(&self) -> bool {
|
||||
self.status >= 200 && self.status <= 299
|
||||
}
|
||||
|
||||
pub fn redirect(&self) -> bool {
|
||||
self.status >= 300 && self.status <= 399
|
||||
}
|
||||
|
||||
/// Whether the response status is: 400 <= status <= 499
|
||||
pub fn client_error(&self) -> bool {
|
||||
self.status >= 400 && self.status <= 499
|
||||
}
|
||||
|
||||
/// Whether the response status is: 500 <= status <= 599
|
||||
pub fn server_error(&self) -> bool {
|
||||
self.status >= 500 && self.status <= 599
|
||||
}
|
||||
|
||||
/// Whether the response status is: 400 <= status <= 599
|
||||
pub fn error(&self) -> bool {
|
||||
self.client_error() || self.server_error()
|
||||
}
|
||||
|
||||
/// The content type part of the "Content-Type" header without
|
||||
/// the charset.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user