Add HTTP Upgrade support to Response. (#1376)

This commit is contained in:
Luqman Aden
2022-07-28 13:18:18 -07:00
committed by GitHub
parent e9ba0a9dc7
commit 61474f422c
5 changed files with 161 additions and 42 deletions

View File

@@ -185,6 +185,7 @@ impl fmt::Display for Error {
Kind::Body => f.write_str("request or response body error")?,
Kind::Decode => f.write_str("error decoding response body")?,
Kind::Redirect => f.write_str("error following redirect")?,
Kind::Upgrade => f.write_str("error upgrading connection")?,
Kind::Status(ref code) => {
let prefix = if code.is_client_error() {
"HTTP status client error"
@@ -236,6 +237,7 @@ pub(crate) enum Kind {
Status(StatusCode),
Body,
Decode,
Upgrade,
}
// constructors
@@ -274,6 +276,10 @@ if_wasm! {
}
}
pub(crate) fn upgrade<E: Into<BoxError>>(e: E) -> Error {
Error::new(Kind::Upgrade, Some(e))
}
// io::Error helpers
#[allow(unused)]