This commit is contained in:
Jacob Hoffman-Andrews
2020-12-02 00:19:11 -08:00
committed by Martin Algesten
parent 18a9b08973
commit be6be7e600
2 changed files with 5 additions and 2 deletions

View File

@@ -122,7 +122,7 @@ impl Request {
unit::connect(unit, true, 0, reader, false).map_err(|e| e.url(url.clone()))?;
if response.error() && self.error_on_non_2xx {
Err(ErrorKind::HTTP.new().url(url.clone()).response(response))
Err(Error::Status(response.status(), response))
} else {
Ok(response)
}