Skip to content

Commit

Permalink
Add conversions from smithy StatusCode to http StatusCode.
Browse files Browse the repository at this point in the history
  • Loading branch information
khuey committed May 5, 2024
1 parent fc32b3f commit b812615
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions rust-runtime/aws-smithy-runtime-api/src/http/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,27 @@ impl From<http0::StatusCode> for StatusCode {
}
}

#[cfg(feature = "http-02x")]
impl From<StatusCode> for http0::StatusCode {
fn from(value: StatusCode) -> Self {
Self::from_u16(value.0).unwrap()
}
}

#[cfg(feature = "http-1x")]
impl From<http1::StatusCode> for StatusCode {
fn from(value: http1::StatusCode) -> Self {
Self(value.as_u16())
}
}

#[cfg(feature = "http-1x")]
impl From<StatusCode> for http1::StatusCode {
fn from(value: StatusCode) -> Self {
Self::from_u16(value.0).unwrap()
}
}

impl From<StatusCode> for u16 {
fn from(value: StatusCode) -> Self {
value.0
Expand Down

0 comments on commit b812615

Please sign in to comment.