Trait ureq::OrAnyStatus [−][src]
pub trait OrAnyStatus { fn or_any_status(self) -> Result<Response, Transport>; }
Extension to Result<Response, Error>
for handling all status codes as Response
.
Required methods
fn or_any_status(self) -> Result<Response, Transport>
[src]
Ergonomic helper for handling all status codes as Response
.
By default, ureq returns non-2xx responses as Error::Status
. This
helper is for handling all responses as Response
, regardless
of status code.
// Bring trait into context. use ureq::OrAnyStatus; let response = ureq::get("http://httpbin.org/status/500") .call() // Transport errors, such as DNS or connectivity problems // must still be dealt with as `Err`. .or_any_status()?; assert_eq!(response.status(), 500);
Implementations on Foreign Types
impl OrAnyStatus for Result<Response, Error>
[src]
impl OrAnyStatus for Result<Response, Error>
[src]