diff --git a/src/request.rs b/src/request.rs index 0394ad9..132458c 100644 --- a/src/request.rs +++ b/src/request.rs @@ -121,7 +121,7 @@ impl Request { let response = unit::connect(unit, true, 0, reader, false).map_err(|e| e.url(url.clone()))?; - if self.error_on_non_2xx && response.status() >= 400 { + if response.status() >= 400 { Err(Error::Status(response.status(), response)) } else { Ok(response) @@ -337,26 +337,6 @@ impl Request { .push((param.to_string(), value.to_string())); self } - - /// By default, if a response's status is anything but a 2xx or 3xx, - /// call()/send() and related methods will return an Error. If you want - /// to handle such responses as non-errors, set this to `false`. - /// - /// Example: - /// ``` - /// # fn main() -> Result<(), ureq::Error> { - /// # ureq::is_test(true); - /// let response = ureq::get("http://httpbin.org/status/500") - /// .error_on_non_2xx(false) - /// .call()?; - /// assert_eq!(response.status(), 500); - /// # Ok(()) - /// # } - /// ``` - pub fn error_on_non_2xx(mut self, value: bool) -> Self { - self.error_on_non_2xx = value; - self - } } #[test]