Revert deletions of client_error and friends.

This commit is contained in:
Jacob Hoffman-Andrews
2020-12-02 00:10:36 -08:00
committed by Martin Algesten
parent 64ebd47979
commit 18a9b08973
4 changed files with 28 additions and 3 deletions

View File

@@ -121,8 +121,8 @@ 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 {
Err(Error::Status(response.status(), response))
if response.error() && self.error_on_non_2xx {
Err(ErrorKind::HTTP.new().url(url.clone()).response(response))
} else {
Ok(response)
}