Remove error_on_non_2xx. (#272)

After the recent changes in #257, it's probably not necessary. It's now
quite easy to use a match statement to extract responses for certain
status codes, or all status codes.

Add documentation on how to turn a status code error back into a
Response.
This commit is contained in:
Jacob Hoffman-Andrews
2020-12-18 22:10:55 -08:00
committed by GitHub
7 changed files with 38 additions and 25 deletions

View File

@@ -72,6 +72,12 @@ Ureq supports sending and receiving json, if you enable the "json" feature:
.into_string()?;
```
### Error handling
ureq returns errors via `Result<T, ureq::Error>`. That includes I/O errors,
protocol errors, and status code errors (when the server responded 4xx or
5xx). More details on the [Error] type.
### Features
To enable a minimal dependency tree, some features are off by default.
@@ -192,6 +198,7 @@ If ureq is not what you're looking for, check out these other Rust HTTP clients:
[post()]: https://docs.rs/ureq/latest/ureq/fn.post.html
[put()]: https://docs.rs/ureq/latest/ureq/fn.put.html
[Request]: https://docs.rs/ureq/latest/ureq/struct.Request.html
[Error]: https://docs.rs/ureq/latest/ureq/enum.Error.html
[Request::call()]: https://docs.rs/ureq/latest/ureq/struct.Request.html#method.call
[Request::send()]: https://docs.rs/ureq/latest/ureq/struct.Request.html#method.send
[Request::send_bytes()]: https://docs.rs/ureq/latest/ureq/struct.Request.html#method.send_bytes