Server Test

Server Test

rev. ee474c7509d7728618c23068f3741e8e5b339ef9

Files changed:

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response-http0x/rust-server-codegen/src/sigv4_event_stream.rs

@@ -0,1 +0,325 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/// Receiver wrapper that handles SigV4 signed event stream messages
           3  +
#[derive(Debug)]
           4  +
pub struct SigV4Receiver<T, E> {
           5  +
    inner: ::aws_smithy_legacy_http::event_stream::Receiver<
           6  +
        crate::sigv4_event_stream::SignedEvent<T>,
           7  +
        crate::sigv4_event_stream::SignedEventError<E>,
           8  +
    >,
           9  +
    initial_signature: ::std::option::Option<crate::sigv4_event_stream::SignatureInfo>,
          10  +
}
          11  +
          12  +
impl<T, E> SigV4Receiver<T, E> {
          13  +
    pub fn new(
          14  +
        unmarshaller: impl ::aws_smithy_eventstream::frame::UnmarshallMessage<Output = T, Error = E>
          15  +
            + ::std::marker::Send
          16  +
            + ::std::marker::Sync
          17  +
            + 'static,
          18  +
        body: ::aws_smithy_types::body::SdkBody,
          19  +
    ) -> Self {
          20  +
        let sigv4_unmarshaller = crate::sigv4_event_stream::SigV4Unmarshaller::new(unmarshaller);
          21  +
        Self {
          22  +
            inner: ::aws_smithy_legacy_http::event_stream::Receiver::new(sigv4_unmarshaller, body),
          23  +
            initial_signature: ::std::option::Option::None,
          24  +
        }
          25  +
    }
          26  +
          27  +
    /// Get the signature from the initial message, if it was signed
          28  +
    pub fn initial_signature(
          29  +
        &self,
          30  +
    ) -> ::std::option::Option<&crate::sigv4_event_stream::SignatureInfo> {
          31  +
        self.initial_signature.as_ref()
          32  +
    }
          33  +
          34  +
    /// Try to receive an initial message of the given type.
          35  +
    /// Handles SigV4-wrapped messages by extracting the inner message first.
          36  +
    pub async fn try_recv_initial(
          37  +
        &mut self,
          38  +
        message_type: ::aws_smithy_legacy_http::event_stream::InitialMessageType,
          39  +
    ) -> ::std::result::Result<
          40  +
        ::std::option::Option<::aws_smithy_types::event_stream::Message>,
          41  +
        ::aws_smithy_runtime_api::client::result::SdkError<
          42  +
            crate::sigv4_event_stream::SignedEventError<E>,
          43  +
            ::aws_smithy_types::event_stream::RawMessage,
          44  +
        >,
          45  +
    >
          46  +
    where
          47  +
        E: std::error::Error + 'static,
          48  +
    {
          49  +
        let result = self
          50  +
            .inner
          51  +
            .try_recv_initial_with_preprocessor(message_type, |message| {
          52  +
                match crate::sigv4_event_stream::extract_signed_message(&message) {
          53  +
                    ::std::result::Result::Ok(MaybeSignedMessage::Signed {
          54  +
                        message: inner,
          55  +
                        signature,
          56  +
                    }) => {
          57  +
                        ::std::result::Result::Ok((inner, ::std::option::Option::Some(signature)))
          58  +
                    }
          59  +
                    ::std::result::Result::Ok(MaybeSignedMessage::Unsigned) => {
          60  +
                        ::std::result::Result::Ok((message, ::std::option::Option::None))
          61  +
                    }
          62  +
                    ::std::result::Result::Err(err) => ::std::result::Result::Err(
          63  +
                        ::aws_smithy_runtime_api::client::result::ResponseError::builder()
          64  +
                            .raw(::aws_smithy_types::event_stream::RawMessage::Decoded(
          65  +
                                message,
          66  +
                            ))
          67  +
                            .source(err)
          68  +
                            .build(),
          69  +
                    ),
          70  +
                }
          71  +
            })
          72  +
            .await?;
          73  +
        match result {
          74  +
            ::std::option::Option::Some((message, signature)) => {
          75  +
                self.initial_signature = signature;
          76  +
                ::std::result::Result::Ok(::std::option::Option::Some(message))
          77  +
            }
          78  +
            ::std::option::Option::None => ::std::result::Result::Ok(::std::option::Option::None),
          79  +
        }
          80  +
    }
          81  +
          82  +
    /// Receive the next event from the stream
          83  +
    /// The SigV4Unmarshaller handles unwrapping, so we just pass through
          84  +
    pub async fn recv(
          85  +
        &mut self,
          86  +
    ) -> ::std::result::Result<
          87  +
        ::std::option::Option<crate::sigv4_event_stream::SignedEvent<T>>,
          88  +
        ::aws_smithy_runtime_api::client::result::SdkError<
          89  +
            crate::sigv4_event_stream::SignedEventError<E>,
          90  +
            ::aws_smithy_types::event_stream::RawMessage,
          91  +
        >,
          92  +
    >
          93  +
    where
          94  +
        E: std::error::Error + 'static,
          95  +
    {
          96  +
        self.inner.recv().await
          97  +
    }
          98  +
}
          99  +
         100  +
/// Wrapper for event stream messages that may be signed
         101  +
#[derive(Debug, Clone)]
         102  +
pub struct SignedEvent<T> {
         103  +
    /// The actual event message
         104  +
    pub message: T,
         105  +
    /// Signature information if the message was signed
         106  +
    pub signature: ::std::option::Option<crate::sigv4_event_stream::SignatureInfo>,
         107  +
}
         108  +
         109  +
/// Error wrapper for signed event stream errors
         110  +
#[derive(Debug)]
         111  +
pub enum SignedEventError<E> {
         112  +
    /// Error from the underlying event stream
         113  +
    Event(E),
         114  +
    /// Error extracting signed message
         115  +
    InvalidSignedEvent(crate::sigv4_event_stream::ExtractionError),
         116  +
}
         117  +
         118  +
impl<E> From<E> for SignedEventError<E> {
         119  +
    fn from(err: E) -> Self {
         120  +
        SignedEventError::Event(err)
         121  +
    }
         122  +
}
         123  +
         124  +
/// Information extracted from a signed event stream message
         125  +
#[non_exhaustive]
         126  +
#[derive(Debug, Clone, PartialEq)]
         127  +
pub struct SignatureInfo {
         128  +
    /// The chunk signature bytes from the `:chunk-signature` header
         129  +
    pub chunk_signature: Vec<u8>,
         130  +
    /// The timestamp from the `:date` header
         131  +
    pub timestamp: ::std::time::SystemTime,
         132  +
}
         133  +
         134  +
/// Unmarshaller wrapper that handles SigV4 signed event stream messages
         135  +
#[derive(Debug)]
         136  +
pub struct SigV4Unmarshaller<T> {
         137  +
    inner: T,
         138  +
}
         139  +
         140  +
impl<T> SigV4Unmarshaller<T> {
         141  +
    pub fn new(inner: T) -> Self {
         142  +
        Self { inner }
         143  +
    }
         144  +
}
         145  +
         146  +
impl<T> ::aws_smithy_eventstream::frame::UnmarshallMessage for SigV4Unmarshaller<T>
         147  +
where
         148  +
    T: ::aws_smithy_eventstream::frame::UnmarshallMessage,
         149  +
{
         150  +
    type Output = crate::sigv4_event_stream::SignedEvent<T::Output>;
         151  +
    type Error = crate::sigv4_event_stream::SignedEventError<T::Error>;
         152  +
         153  +
    fn unmarshall(
         154  +
        &self,
         155  +
        message: &::aws_smithy_types::event_stream::Message,
         156  +
    ) -> ::std::result::Result<
         157  +
        ::aws_smithy_eventstream::frame::UnmarshalledMessage<Self::Output, Self::Error>,
         158  +
        ::aws_smithy_eventstream::error::Error,
         159  +
    > {
         160  +
        // First, try to extract the signed message
         161  +
        match crate::sigv4_event_stream::extract_signed_message(message) {
         162  +
            ::std::result::Result::Ok(MaybeSignedMessage::Signed {
         163  +
                message: inner_message,
         164  +
                signature,
         165  +
            }) => {
         166  +
                // Process the inner message with the base unmarshaller
         167  +
                match self.inner.unmarshall(&inner_message) {
         168  +
                    ::std::result::Result::Ok(unmarshalled) => match unmarshalled {
         169  +
                        ::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(event) => {
         170  +
                            ::std::result::Result::Ok(
         171  +
                                ::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(
         172  +
                                    crate::sigv4_event_stream::SignedEvent {
         173  +
                                        message: event,
         174  +
                                        signature: ::std::option::Option::Some(signature),
         175  +
                                    },
         176  +
                                ),
         177  +
                            )
         178  +
                        }
         179  +
                        ::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(err) => {
         180  +
                            ::std::result::Result::Ok(
         181  +
                                ::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
         182  +
                                    crate::sigv4_event_stream::SignedEventError::Event(err),
         183  +
                                ),
         184  +
                            )
         185  +
                        }
         186  +
                    },
         187  +
                    ::std::result::Result::Err(err) => ::std::result::Result::Err(err),
         188  +
                }
         189  +
            }
         190  +
            ::std::result::Result::Ok(MaybeSignedMessage::Unsigned) => {
         191  +
                // Process unsigned message directly
         192  +
                match self.inner.unmarshall(message) {
         193  +
                    ::std::result::Result::Ok(unmarshalled) => match unmarshalled {
         194  +
                        ::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(event) => {
         195  +
                            ::std::result::Result::Ok(
         196  +
                                ::aws_smithy_eventstream::frame::UnmarshalledMessage::Event(
         197  +
                                    crate::sigv4_event_stream::SignedEvent {
         198  +
                                        message: event,
         199  +
                                        signature: ::std::option::Option::None,
         200  +
                                    },
         201  +
                                ),
         202  +
                            )
         203  +
                        }
         204  +
                        ::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(err) => {
         205  +
                            ::std::result::Result::Ok(
         206  +
                                ::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
         207  +
                                    crate::sigv4_event_stream::SignedEventError::Event(err),
         208  +
                                ),
         209  +
                            )
         210  +
                        }
         211  +
                    },
         212  +
                    ::std::result::Result::Err(err) => ::std::result::Result::Err(err),
         213  +
                }
         214  +
            }
         215  +
            ::std::result::Result::Err(extraction_err) => ::std::result::Result::Ok(
         216  +
                ::aws_smithy_eventstream::frame::UnmarshalledMessage::Error(
         217  +
                    crate::sigv4_event_stream::SignedEventError::InvalidSignedEvent(extraction_err),
         218  +
                ),
         219  +
            ),
         220  +
        }
         221  +
    }
         222  +
}
         223  +
         224  +
/// Result of extracting a potentially signed message
         225  +
#[derive(Debug)]
         226  +
pub enum MaybeSignedMessage {
         227  +
    /// Message was signed and has been extracted
         228  +
    Signed {
         229  +
        /// The inner message that was signed
         230  +
        message: ::aws_smithy_types::event_stream::Message,
         231  +
        /// Signature information from the outer message
         232  +
        signature: crate::sigv4_event_stream::SignatureInfo,
         233  +
    },
         234  +
    /// Message was not signed (no `:chunk-signature` header present)
         235  +
    Unsigned,
         236  +
}
         237  +
         238  +
/// Extracts the inner message from a potentially signed event stream message.
         239  +
pub fn extract_signed_message(
         240  +
    message: &::aws_smithy_types::event_stream::Message,
         241  +
) -> ::std::result::Result<MaybeSignedMessage, crate::sigv4_event_stream::ExtractionError> {
         242  +
    // Check if message has chunk signature
         243  +
    let mut chunk_signature = None;
         244  +
    let mut timestamp = None;
         245  +
         246  +
    for header in message.headers() {
         247  +
        match header.name().as_str() {
         248  +
            ":chunk-signature" => {
         249  +
                if let ::aws_smithy_types::event_stream::HeaderValue::ByteArray(bytes) =
         250  +
                    header.value()
         251  +
                {
         252  +
                    chunk_signature = Some(bytes.as_ref().to_vec());
         253  +
                }
         254  +
            }
         255  +
            ":date" => {
         256  +
                if let ::aws_smithy_types::event_stream::HeaderValue::Timestamp(ts) = header.value()
         257  +
                {
         258  +
                    timestamp = Some(::std::time::SystemTime::try_from(*ts).map_err(|_err| {
         259  +
                        crate::sigv4_event_stream::ExtractionError::InvalidTimestamp
         260  +
                    })?);
         261  +
                } else {
         262  +
                    return Err(crate::sigv4_event_stream::ExtractionError::InvalidTimestamp);
         263  +
                }
         264  +
            }
         265  +
            _ => {}
         266  +
        }
         267  +
    }
         268  +
         269  +
    let Some(chunk_signature) = chunk_signature else {
         270  +
        return Ok(MaybeSignedMessage::Unsigned);
         271  +
    };
         272  +
         273  +
    let Some(timestamp) = timestamp else {
         274  +
        return Err(crate::sigv4_event_stream::ExtractionError::InvalidTimestamp);
         275  +
    };
         276  +
         277  +
    // Extract inner message
         278  +
    let cursor = ::std::io::Cursor::new(message.payload());
         279  +
    let inner_message = ::aws_smithy_eventstream::frame::read_message_from(cursor)
         280  +
        .map_err(|err| crate::sigv4_event_stream::ExtractionError::InvalidPayload { error: err })?;
         281  +
         282  +
    Ok(MaybeSignedMessage::Signed {
         283  +
        message: inner_message,
         284  +
        signature: crate::sigv4_event_stream::SignatureInfo {
         285  +
            chunk_signature,
         286  +
            timestamp,
         287  +
        },
         288  +
    })
         289  +
}
         290  +
         291  +
/// Error type for signed message extraction operations
         292  +
#[non_exhaustive]
         293  +
#[derive(Debug)]
         294  +
pub enum ExtractionError {
         295  +
    /// The payload could not be decoded as a valid message
         296  +
    #[non_exhaustive]
         297  +
    InvalidPayload {
         298  +
        error: ::aws_smithy_eventstream::error::Error,
         299  +
    },
         300  +
    /// The timestamp header is missing or has an invalid format
         301  +
    #[non_exhaustive]
         302  +
    InvalidTimestamp,
         303  +
}
         304  +
         305  +
impl ::std::fmt::Display for ExtractionError {
         306  +
    fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
         307  +
        match self {
         308  +
            ExtractionError::InvalidPayload { error } => {
         309  +
                write!(f, "invalid payload: {}", error)
         310  +
            }
         311  +
            ExtractionError::InvalidTimestamp => {
         312  +
                write!(f, "invalid or missing timestamp header")
         313  +
            }
         314  +
        }
         315  +
    }
         316  +
}
         317  +
         318  +
impl ::std::error::Error for ExtractionError {
         319  +
    fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> {
         320  +
        match self {
         321  +
            ExtractionError::InvalidPayload { error } => ::std::option::Option::Some(error),
         322  +
            ExtractionError::InvalidTimestamp => ::std::option::Option::None,
         323  +
        }
         324  +
    }
         325  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response-http0x/rust-server-codegen/src/types.rs

@@ -0,1 +0,5 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
pub use ::aws_smithy_types::date_time::Format as DateTimeFormat;
           3  +
pub use ::aws_smithy_types::error::display::DisplayErrorContext;
           4  +
pub use ::aws_smithy_types::Blob;
           5  +
pub use ::aws_smithy_types::DateTime;

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response-http0x/rust-server-codegen/src/unconstrained.rs

@@ -0,1 +0,188 @@
           1  +
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
           3  +
impl crate::constrained::Constrained for crate::model::ComplexUnion {
           4  +
    type Unconstrained =
           5  +
        crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained;
           6  +
}
           7  +
           8  +
impl From<crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained>
           9  +
    for crate::constrained::MaybeConstrained<crate::model::ComplexUnion>
          10  +
{
          11  +
    fn from(
          12  +
        value: crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained,
          13  +
    ) -> Self {
          14  +
        Self::Unconstrained(value)
          15  +
    }
          16  +
}
          17  +
          18  +
pub(crate) mod complex_union_unconstrained {
          19  +
          20  +
    #[allow(clippy::enum_variant_names)]
          21  +
    #[derive(Debug, Clone)]
          22  +
    pub(crate) enum ComplexUnionUnconstrained {
          23  +
        ComplexStruct(crate::model::complex_struct::Builder),
          24  +
        List(::std::vec::Vec<::std::string::String>),
          25  +
        Map(::std::collections::HashMap<::std::string::String, i32>),
          26  +
        Structure(crate::model::simple_struct::Builder),
          27  +
        Union(crate::model::SimpleUnion),
          28  +
    }
          29  +
    impl ::std::convert::TryFrom<ComplexUnionUnconstrained> for crate::model::ComplexUnion {
          30  +
        type Error = crate::model::complex_union::ConstraintViolation;
          31  +
          32  +
        fn try_from(value: ComplexUnionUnconstrained) -> ::std::result::Result<Self, Self::Error> {
          33  +
            Ok(
          34  +
        match value {
          35  +
            crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained::ComplexStruct(unconstrained) => Self::ComplexStruct(
          36  +
                unconstrained
          37  +
                                        .try_into()
          38  +
                                        
          39  +
                                        
          40  +
                                        .map_err(Self::Error::ComplexStruct)?
          41  +
            ),
          42  +
            crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained::List(unconstrained) => Self::List(
          43  +
                unconstrained
          44  +
            ),
          45  +
            crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained::Map(unconstrained) => Self::Map(
          46  +
                unconstrained
          47  +
            ),
          48  +
            crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained::Structure(unconstrained) => Self::Structure(
          49  +
                unconstrained
          50  +
                                        .try_into()
          51  +
                                        
          52  +
                                        
          53  +
                                        .map_err(Self::Error::Structure)?
          54  +
            ),
          55  +
            crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained::Union(unconstrained) => Self::Union(
          56  +
                unconstrained
          57  +
            ),
          58  +
        }
          59  +
    )
          60  +
        }
          61  +
    }
          62  +
}
          63  +
pub(crate) mod complex_map_unconstrained {
          64  +
          65  +
    #[derive(Debug, Clone)]
          66  +
    pub(crate) struct ComplexMapUnconstrained(
          67  +
        pub(crate)  std::collections::HashMap<
          68  +
            ::std::string::String,
          69  +
            crate::unconstrained::complex_union_unconstrained::ComplexUnionUnconstrained,
          70  +
        >,
          71  +
    );
          72  +
          73  +
    impl From<ComplexMapUnconstrained>
          74  +
        for crate::constrained::MaybeConstrained<
          75  +
            crate::constrained::complex_map_constrained::ComplexMapConstrained,
          76  +
        >
          77  +
    {
          78  +
        fn from(value: ComplexMapUnconstrained) -> Self {
          79  +
            Self::Unconstrained(value)
          80  +
        }
          81  +
    }
          82  +
    impl std::convert::TryFrom<ComplexMapUnconstrained>
          83  +
        for crate::constrained::complex_map_constrained::ComplexMapConstrained
          84  +
    {
          85  +
        type Error = crate::model::complex_map::ConstraintViolation;
          86  +
        fn try_from(value: ComplexMapUnconstrained) -> std::result::Result<Self, Self::Error> {
          87  +
            let res: ::std::result::Result<
          88  +
                ::std::collections::HashMap<::std::string::String, crate::model::ComplexUnion>,
          89  +
                Self::Error,
          90  +
            > = value
          91  +
                .0
          92  +
                .into_iter()
          93  +
                .map(
          94  +
                    |(k, v)| match crate::model::ComplexUnion::try_from(v).map_err(Box::new) {
          95  +
                        Ok(v) => Ok((k, v)),
          96  +
                        Err(inner_constraint_violation) => {
          97  +
                            Err(Self::Error::Value(k, inner_constraint_violation))
          98  +
                        }
          99  +
                    },
         100  +
                )
         101  +
                .collect();
         102  +
            let hm = res?;
         103  +
            Ok(Self(hm))
         104  +
        }
         105  +
    }
         106  +
}
         107  +
pub(crate) mod complex_list_unconstrained {
         108  +
         109  +
    #[derive(Debug, Clone)]
         110  +
    pub(crate) struct ComplexListUnconstrained(
         111  +
        pub(crate) 
         112  +
            std::vec::Vec<crate::unconstrained::complex_map_unconstrained::ComplexMapUnconstrained>,
         113  +
    );
         114  +
         115  +
    impl From<ComplexListUnconstrained>
         116  +
        for crate::constrained::MaybeConstrained<
         117  +
            crate::constrained::complex_list_constrained::ComplexListConstrained,
         118  +
        >
         119  +
    {
         120  +
        fn from(value: ComplexListUnconstrained) -> Self {
         121  +
            Self::Unconstrained(value)
         122  +
        }
         123  +
    }
         124  +
    impl std::convert::TryFrom<ComplexListUnconstrained>
         125  +
        for crate::constrained::complex_list_constrained::ComplexListConstrained
         126  +
    {
         127  +
        type Error = crate::model::complex_list::ConstraintViolation;
         128  +
        fn try_from(value: ComplexListUnconstrained) -> std::result::Result<Self, Self::Error> {
         129  +
            let res: ::std::result::Result<
         130  +
                ::std::vec::Vec<crate::constrained::complex_map_constrained::ComplexMapConstrained>,
         131  +
                (usize, crate::model::complex_map::ConstraintViolation),
         132  +
            > = value
         133  +
                .0
         134  +
                .into_iter()
         135  +
                .enumerate()
         136  +
                .map(|(idx, inner)| {
         137  +
                    inner
         138  +
                        .try_into()
         139  +
                        .map_err(|inner_violation| (idx, inner_violation))
         140  +
                })
         141  +
                .collect();
         142  +
            let inner = res
         143  +
                .map_err(|(idx, inner_violation)| (idx, Box::new(inner_violation)))
         144  +
                .map_err(|(idx, inner_violation)| Self::Error::Member(idx, inner_violation))?;
         145  +
            Ok(Self(inner))
         146  +
        }
         147  +
    }
         148  +
}
         149  +
pub(crate) mod struct_list_unconstrained {
         150  +
         151  +
    #[derive(Debug, Clone)]
         152  +
    pub(crate) struct StructListUnconstrained(
         153  +
        pub(crate) std::vec::Vec<crate::model::simple_struct::Builder>,
         154  +
    );
         155  +
         156  +
    impl From<StructListUnconstrained>
         157  +
        for crate::constrained::MaybeConstrained<
         158  +
            crate::constrained::struct_list_constrained::StructListConstrained,
         159  +
        >
         160  +
    {
         161  +
        fn from(value: StructListUnconstrained) -> Self {
         162  +
            Self::Unconstrained(value)
         163  +
        }
         164  +
    }
         165  +
    impl std::convert::TryFrom<StructListUnconstrained>
         166  +
        for crate::constrained::struct_list_constrained::StructListConstrained
         167  +
    {
         168  +
        type Error = crate::model::struct_list::ConstraintViolation;
         169  +
        fn try_from(value: StructListUnconstrained) -> std::result::Result<Self, Self::Error> {
         170  +
            let res: ::std::result::Result<
         171  +
                ::std::vec::Vec<crate::model::SimpleStruct>,
         172  +
                (usize, crate::model::simple_struct::ConstraintViolation),
         173  +
            > = value
         174  +
                .0
         175  +
                .into_iter()
         176  +
                .enumerate()
         177  +
                .map(|(idx, inner)| {
         178  +
                    inner
         179  +
                        .try_into()
         180  +
                        .map_err(|inner_violation| (idx, inner_violation))
         181  +
                })
         182  +
                .collect();
         183  +
            let inner =
         184  +
                res.map_err(|(idx, inner_violation)| Self::Error::Member(idx, inner_violation))?;
         185  +
            Ok(Self(inner))
         186  +
        }
         187  +
    }
         188  +
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response/rust-server-codegen/Cargo.toml

@@ -1,1 +60,66 @@
   13     13   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-cbor"
   14     14   
[dependencies.aws-smithy-eventstream]
   15     15   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-eventstream"
   16     16   
[dependencies.aws-smithy-http]
   17     17   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-http"
   18     18   
features = ["event-stream"]
   19     19   
[dependencies.aws-smithy-http-server]
   20     20   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-http-server"
   21     21   
[dependencies.aws-smithy-runtime-api]
   22     22   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-runtime-api"
   23         -
features = ["client", "http-02x"]
          23  +
features = ["http-1x", "client"]
   24     24   
[dependencies.aws-smithy-types]
   25     25   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-types"
          26  +
features = ["http-body-1-x"]
          27  +
[dependencies.bytes]
          28  +
version = "1.4.0"
   26     29   
[dependencies.futures-util]
   27     30   
version = "0.3"
   28         -
[dependencies.http]
   29         -
version = "0.2.9"
   30         -
[dependencies.hyper]
   31         -
version = "0.14.26"
          31  +
[dependencies.http-1x]
          32  +
version = "1"
          33  +
package = "http"
          34  +
[dependencies.http-body-1x]
          35  +
version = "1"
          36  +
package = "http-body"
          37  +
[dependencies.http-body-util]
          38  +
version = "0.1.3"
   32     39   
[dependencies.mime]
   33     40   
version = "0.3"
   34     41   
[dependencies.pin-project-lite]
   35     42   
version = "0.2"
   36     43   
[dependencies.tower]
   37     44   
version = "0.4"
   38     45   
[dependencies.tracing]
   39     46   
version = "0.1"
   40     47   
[dev-dependencies.aws-smithy-protocol-test]
   41     48   
path = "/home/build/workspace/smithy-rs/rust-runtime/aws-smithy-protocol-test"
   42         -
[dev-dependencies.bytes]
   43         -
version = "1.4.0"
          49  +
features = ["http-1x"]
   44     50   
[dev-dependencies.hyper]
   45         -
version = "0.14.12"
          51  +
version = "1"
   46     52   
[dev-dependencies.pretty_assertions]
   47     53   
version = "1.3.0"
   48     54   
[dev-dependencies.tokio]
   49     55   
version = "1.23.1"
   50     56   
features = ["macros", "test-util", "rt-multi-thread"]
   51     57   
[dev-dependencies.tracing-test]
   52     58   
version = "0.2.5"
   53     59   
features = ["no-env-filter"]
   54     60   
[features]
   55     61   
rt-tokio = ["aws-smithy-types/rt-tokio"]

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response/rust-server-codegen/src/lib.rs

@@ -19,19 +128,131 @@
   39     39   
)]
   40     40   
//! The [`crate::input`], [`crate::output`], and [`crate::error`]
   41     41   
//! modules provide the types used in each operation.
   42     42   
//!
   43     43   
//! ### Running on Hyper
   44     44   
//!
   45     45   
//! ```rust,no_run
   46     46   
//! # use std::net::SocketAddr;
   47     47   
//! # async fn dummy() {
   48     48   
//! use rpcv2cbor_extras_no_initial_response::{RpcV2CborService, RpcV2CborServiceConfig};
          49  +
//! use rpcv2cbor_extras_no_initial_response::serve;
          50  +
//! use ::tokio::net::TcpListener;
   49     51   
//!
   50     52   
//! # let app = RpcV2CborService::builder(
   51     53   
//! #     RpcV2CborServiceConfig::builder()
   52     54   
//! #         .build()
   53     55   
//! # ).build_unchecked();
   54         -
//! let server = app.into_make_service();
   55     56   
//! let bind: SocketAddr = "127.0.0.1:6969".parse()
   56     57   
//!     .expect("unable to parse the server bind address and port");
   57         -
//! ::hyper::Server::bind(&bind).serve(server).await.unwrap();
          58  +
//! let listener = TcpListener::bind(bind).await
          59  +
//!     .expect("failed to bind TCP listener");
          60  +
//! serve(listener, app.into_make_service()).await.unwrap();
   58     61   
//! # }
   59     62   
//! ```
   60     63   
//!
   61     64   
//! ### Running on Lambda
   62     65   
//!
   63     66   
//! ```rust,ignore
   64     67   
//! use rpcv2cbor_extras_no_initial_response::server::routing::LambdaHandler;
   65     68   
//! use rpcv2cbor_extras_no_initial_response::RpcV2CborService;
   66     69   
//!
   67     70   
//! # async fn dummy() {
   68     71   
//! # let app = RpcV2CborService::builder(
   69     72   
//! #     RpcV2CborServiceConfig::builder()
   70     73   
//! #         .build()
   71     74   
//! # ).build_unchecked();
   72     75   
//! let handler = LambdaHandler::new(app);
   73     76   
//! lambda_http::run(handler).await.unwrap();
   74     77   
//! # }
   75     78   
//! ```
   76     79   
//!
   77     80   
//! # Building the RpcV2CborService
   78     81   
//!
   79     82   
//! To construct [`RpcV2CborService`] we use [`RpcV2CborServiceBuilder`] returned by [`RpcV2CborService::builder`].
   80     83   
//!
   81     84   
//! ## Plugins
   82     85   
//!
   83     86   
//! The [`RpcV2CborService::builder`] method, returning [`RpcV2CborServiceBuilder`],
   84     87   
//! accepts a config object on which plugins can be registered.
   85     88   
//! Plugins allow you to build middleware which is aware of the operation it is being applied to.
   86     89   
//!
   87     90   
//! ```rust,no_run
   88     91   
//! # use rpcv2cbor_extras_no_initial_response::server::plugin::IdentityPlugin as LoggingPlugin;
   89     92   
//! # use rpcv2cbor_extras_no_initial_response::server::plugin::IdentityPlugin as MetricsPlugin;
   90         -
//! # use ::hyper::Body;
          93  +
//! # use ::hyper::body::Incoming;
   91     94   
//! use rpcv2cbor_extras_no_initial_response::server::plugin::HttpPlugins;
   92     95   
//! use rpcv2cbor_extras_no_initial_response::{RpcV2CborService, RpcV2CborServiceConfig, RpcV2CborServiceBuilder};
   93     96   
//!
   94     97   
//! let http_plugins = HttpPlugins::new()
   95     98   
//!         .push(LoggingPlugin)
   96     99   
//!         .push(MetricsPlugin);
   97    100   
//! let config = RpcV2CborServiceConfig::builder().build();
   98         -
//! let builder: RpcV2CborServiceBuilder<Body, _, _, _> = RpcV2CborService::builder(config);
         101  +
//! let builder: RpcV2CborServiceBuilder<::hyper::body::Incoming, _, _, _> = RpcV2CborService::builder(config);
   99    102   
//! ```
  100    103   
//!
  101    104   
//! Check out [`crate::server::plugin`] to learn more about plugins.
  102    105   
//!
  103    106   
//! ## Handlers
  104    107   
//!
  105    108   
//! [`RpcV2CborServiceBuilder`] provides a setter method for each operation in your Smithy model. The setter methods expect an async function as input, matching the signature for the corresponding operation in your Smithy model.
  106    109   
//! We call these async functions **handlers**. This is where your application business logic lives.
  107    110   
//!
  108    111   
//! Every handler must take an `Input`, and optional [`extractor arguments`](crate::server::request), while returning:
@@ -135,138 +273,280 @@
  155    158   
//! [`RpcV2CborServiceBuilder::build`] requires you to provide a handler for every single operation in your Smithy model. It will return an error if that is not the case.
  156    159   
//!
  157    160   
//! [`RpcV2CborServiceBuilder::build_unchecked`], instead, does not require exhaustiveness. The server will automatically return 500 Internal Server Error to all requests for operations that do not have a registered handler.
  158    161   
//! [`RpcV2CborServiceBuilder::build_unchecked`] is particularly useful if you are deploying your Smithy service as a collection of Lambda functions, where each Lambda is only responsible for a subset of the operations in the Smithy service (or even a single one!).
  159    162   
//!
  160    163   
//! # Example
  161    164   
//!
  162    165   
//! ```rust,no_run
  163    166   
//! # use std::net::SocketAddr;
  164    167   
//! use rpcv2cbor_extras_no_initial_response::{RpcV2CborService, RpcV2CborServiceConfig};
         168  +
//! use rpcv2cbor_extras_no_initial_response::serve;
         169  +
//! use ::tokio::net::TcpListener;
  165    170   
//!
  166    171   
//! #[::tokio::main]
  167    172   
//! pub async fn main() {
  168    173   
//!    let config = RpcV2CborServiceConfig::builder().build();
  169    174   
//!    let app = RpcV2CborService::builder(config)
  170    175   
//!        .complex_struct_operation(complex_struct_operation)
  171    176   
//!        .empty_struct_operation(empty_struct_operation)
  172    177   
//!        .error_serialization_operation(error_serialization_operation)
  173    178   
//!        .recursive_union_operation(recursive_union_operation)
  174    179   
//!        .simple_struct_operation(simple_struct_operation)
  175    180   
//!        .single_member_struct_operation(single_member_struct_operation)
  176    181   
//!        .streaming_operation(streaming_operation)
  177    182   
//!        .streaming_operation_with_initial_data(streaming_operation_with_initial_data)
  178    183   
//!        .streaming_operation_with_initial_response(streaming_operation_with_initial_response)
  179    184   
//!        .streaming_operation_with_optional_data(streaming_operation_with_optional_data)
  180    185   
//!        .build()
  181    186   
//!        .expect("failed to build an instance of RpcV2CborService");
  182    187   
//!
  183    188   
//!    let bind: SocketAddr = "127.0.0.1:6969".parse()
  184    189   
//!        .expect("unable to parse the server bind address and port");
  185         -
//!    let server = ::hyper::Server::bind(&bind).serve(app.into_make_service());
         190  +
//!    let listener = TcpListener::bind(bind).await
         191  +
//!        .expect("failed to bind TCP listener");
  186    192   
//!    # let server = async { Ok::<_, ()>(()) };
  187    193   
//!
  188    194   
//!    // Run your service!
  189         -
//!    if let Err(err) = server.await {
         195  +
//!    if let Err(err) = serve(listener, app.into_make_service()).await {
  190    196   
//!        eprintln!("server error: {:?}", err);
  191    197   
//!    }
  192    198   
//! }
  193    199   
//!
  194    200   
//! use rpcv2cbor_extras_no_initial_response::{input, output, error};
  195    201   
//!
  196    202   
//! async fn complex_struct_operation(input: input::ComplexStructOperationInput) -> Result<output::ComplexStructOperationOutput, error::ComplexStructOperationError> {
  197    203   
//!     todo!()
  198    204   
//! }
  199    205   
//!
  200    206   
//! async fn empty_struct_operation(input: input::EmptyStructOperationInput) -> output::EmptyStructOperationOutput {
  201    207   
//!     todo!()
  202    208   
//! }
  203    209   
//!
  204    210   
//! async fn error_serialization_operation(input: input::ErrorSerializationOperationInput) -> Result<output::ErrorSerializationOperationOutput, error::ErrorSerializationOperationError> {
  205    211   
//!     todo!()
  206    212   
//! }
  207    213   
//!
  208    214   
//! async fn recursive_union_operation(input: input::RecursiveUnionOperationInput) -> output::RecursiveUnionOperationOutput {
  209    215   
//!     todo!()
  210    216   
//! }
  211    217   
//!
  212    218   
//! async fn simple_struct_operation(input: input::SimpleStructOperationInput) -> Result<output::SimpleStructOperationOutput, error::SimpleStructOperationError> {
  213    219   
//!     todo!()
  214    220   
//! }
  215    221   
//!
  216    222   
//! async fn single_member_struct_operation(input: input::SingleMemberStructOperationInput) -> output::SingleMemberStructOperationOutput {
  217    223   
//!     todo!()
  218    224   
//! }
  219    225   
//!
  220    226   
//! async fn streaming_operation(input: input::StreamingOperationInput) -> Result<output::StreamingOperationOutput, error::StreamingOperationError> {
  221    227   
//!     todo!()
  222    228   
//! }
  223    229   
//!
  224    230   
//! async fn streaming_operation_with_initial_data(input: input::StreamingOperationWithInitialDataInput) -> Result<output::StreamingOperationWithInitialDataOutput, error::StreamingOperationWithInitialDataError> {
  225    231   
//!     todo!()
  226    232   
//! }
  227    233   
//!
  228    234   
//! async fn streaming_operation_with_initial_response(input: input::StreamingOperationWithInitialResponseInput) -> Result<output::StreamingOperationWithInitialResponseOutput, error::StreamingOperationWithInitialResponseError> {
  229    235   
//!     todo!()
  230    236   
//! }
  231    237   
//!
  232    238   
//! async fn streaming_operation_with_optional_data(input: input::StreamingOperationWithOptionalDataInput) -> Result<output::StreamingOperationWithOptionalDataOutput, error::StreamingOperationWithOptionalDataError> {
  233    239   
//!     todo!()
  234    240   
//! }
  235    241   
//!
  236    242   
//! ```
  237    243   
//!
  238         -
//! [`serve`]: https://docs.rs/hyper/0.14.16/hyper/server/struct.Builder.html#method.serve
         244  +
//! [`serve`]: crate::serve
         245  +
//! [hyper server]: https://docs.rs/hyper/latest/hyper/server/index.html
  239    246   
//! [`tower::make::MakeService`]: https://docs.rs/tower/latest/tower/make/trait.MakeService.html
  240    247   
//! [HTTP binding traits]: https://smithy.io/2.0/spec/http-bindings.html
  241    248   
//! [operations]: https://smithy.io/2.0/spec/service-types.html#operation
  242         -
//! [hyper server]: https://docs.rs/hyper/latest/hyper/server/index.html
  243    249   
//! [Service]: https://docs.rs/tower-service/latest/tower_service/trait.Service.html
         250  +
pub use crate::server::serve::serve;
  244    251   
pub use crate::service::{
  245    252   
    MissingOperationsError, RpcV2CborService, RpcV2CborServiceBuilder, RpcV2CborServiceConfig,
  246    253   
    RpcV2CborServiceConfigBuilder,
  247    254   
};
  248    255   
  249    256   
/// Contains the types that are re-exported from the `aws-smithy-http-server` crate.
  250    257   
pub mod server {
  251    258   
    // Re-export all types from the `aws-smithy-http-server` crate.
  252    259   
    pub use ::aws_smithy_http_server::*;
  253    260   
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response/rust-server-codegen/src/operation.rs

@@ -4,4 +72,77 @@
   24     24   
   25     25   
impl<B>
   26     26   
    ::aws_smithy_http_server::request::FromRequest<
   27     27   
        ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
   28     28   
        B,
   29     29   
    > for crate::input::StreamingOperationWithOptionalDataInput
   30     30   
where
   31     31   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   32     32   
    B: 'static,
   33     33   
   34         -
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
          34  +
    B: ::http_body_1x::Body<Data = ::bytes::Bytes>
          35  +
        + ::std::marker::Send
          36  +
        + ::std::marker::Sync
          37  +
        + 'static,
          38  +
    B::Error: Into<::aws_smithy_types::body::Error> + 'static,
          39  +
   35     40   
    B::Data: Send,
   36     41   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
   37     42   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   38     43   
{
   39     44   
    type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
   40     45   
    type Future = StreamingOperationWithOptionalDataInputFuture;
   41     46   
   42         -
    fn from_request(request: ::http::Request<B>) -> Self::Future {
          47  +
    fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
   43     48   
        let fut = async move {
   44     49   
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
   45     50   
                request.headers(),
   46     51   
                &crate::mimes::CONTENT_TYPE_APPLICATION_VND_AMAZON_EVENTSTREAM,
   47     52   
            ) && !::aws_smithy_http_server::protocol::accept_header_classifier(
   48     53   
                request.headers(),
   49     54   
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
   50     55   
            ) {
   51     56   
                return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
   52     57   
            }
@@ -106,111 +174,184 @@
  126    131   
  127    132   
impl<B>
  128    133   
    ::aws_smithy_http_server::request::FromRequest<
  129    134   
        ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
  130    135   
        B,
  131    136   
    > for crate::input::StreamingOperationWithInitialResponseInput
  132    137   
where
  133    138   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
  134    139   
    B: 'static,
  135    140   
  136         -
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
         141  +
    B: ::http_body_1x::Body<Data = ::bytes::Bytes>
         142  +
        + ::std::marker::Send
         143  +
        + ::std::marker::Sync
         144  +
        + 'static,
         145  +
    B::Error: Into<::aws_smithy_types::body::Error> + 'static,
         146  +
  137    147   
    B::Data: Send,
  138    148   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
  139    149   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
  140    150   
{
  141    151   
    type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
  142    152   
    type Future = StreamingOperationWithInitialResponseInputFuture;
  143    153   
  144         -
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         154  +
    fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
  145    155   
        let fut = async move {
  146    156   
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
  147    157   
                request.headers(),
  148    158   
                &crate::mimes::CONTENT_TYPE_APPLICATION_VND_AMAZON_EVENTSTREAM,
  149    159   
            ) && !::aws_smithy_http_server::protocol::accept_header_classifier(
  150    160   
                request.headers(),
  151    161   
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
  152    162   
            ) {
  153    163   
                return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
  154    164   
            }
@@ -208,218 +276,291 @@
  228    238   
  229    239   
impl<B>
  230    240   
    ::aws_smithy_http_server::request::FromRequest<
  231    241   
        ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
  232    242   
        B,
  233    243   
    > for crate::input::StreamingOperationWithInitialDataInput
  234    244   
where
  235    245   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
  236    246   
    B: 'static,
  237    247   
  238         -
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
         248  +
    B: ::http_body_1x::Body<Data = ::bytes::Bytes>
         249  +
        + ::std::marker::Send
         250  +
        + ::std::marker::Sync
         251  +
        + 'static,
         252  +
    B::Error: Into<::aws_smithy_types::body::Error> + 'static,
         253  +
  239    254   
    B::Data: Send,
  240    255   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
  241    256   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
  242    257   
{
  243    258   
    type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
  244    259   
    type Future = StreamingOperationWithInitialDataInputFuture;
  245    260   
  246         -
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         261  +
    fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
  247    262   
        let fut = async move {
  248    263   
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
  249    264   
                request.headers(),
  250    265   
                &crate::mimes::CONTENT_TYPE_APPLICATION_VND_AMAZON_EVENTSTREAM,
  251    266   
            ) && !::aws_smithy_http_server::protocol::accept_header_classifier(
  252    267   
                request.headers(),
  253    268   
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
  254    269   
            ) {
  255    270   
                return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
  256    271   
            }
@@ -310,325 +378,398 @@
  330    345   
  331    346   
impl<B>
  332    347   
    ::aws_smithy_http_server::request::FromRequest<
  333    348   
        ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
  334    349   
        B,
  335    350   
    > for crate::input::StreamingOperationInput
  336    351   
where
  337    352   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
  338    353   
    B: 'static,
  339    354   
  340         -
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
         355  +
    B: ::http_body_1x::Body<Data = ::bytes::Bytes>
         356  +
        + ::std::marker::Send
         357  +
        + ::std::marker::Sync
         358  +
        + 'static,
         359  +
    B::Error: Into<::aws_smithy_types::body::Error> + 'static,
         360  +
  341    361   
    B::Data: Send,
  342    362   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
  343    363   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
  344    364   
{
  345    365   
    type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
  346    366   
    type Future = StreamingOperationInputFuture;
  347    367   
  348         -
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         368  +
    fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
  349    369   
        let fut = async move {
  350    370   
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
  351    371   
                request.headers(),
  352    372   
                &crate::mimes::CONTENT_TYPE_APPLICATION_VND_AMAZON_EVENTSTREAM,
  353    373   
            ) && !::aws_smithy_http_server::protocol::accept_header_classifier(
  354    374   
                request.headers(),
  355    375   
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
  356    376   
            ) {
  357    377   
                return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
  358    378   
            }
@@ -425,445 +485,505 @@
  445    465   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
  446    466   
    B: 'static,
  447    467   
  448    468   
    B::Data: Send,
  449    469   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
  450    470   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
  451    471   
{
  452    472   
    type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
  453    473   
    type Future = RecursiveUnionOperationInputFuture;
  454    474   
  455         -
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         475  +
    fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
  456    476   
        let fut = async move {
  457    477   
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
  458    478   
                request.headers(),
  459    479   
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
  460    480   
            ) {
  461    481   
                return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
  462    482   
            }
  463    483   
            crate::protocol_serde::shape_recursive_union_operation::de_recursive_union_operation_http_request(request)
  464    484   
                            .await
  465    485   
        };
@@ -594,614 +988,1024 @@
  614    634   
                            )
  615    635   
                        ,
  616    636   
                    }
  617    637   
                )
  618    638   
            ,
  619    639   
        }
  620    640   
        ;
  621    641   
        use ::aws_smithy_http_server::response::IntoResponse;
  622    642   
        let http_response = output.into_response();
  623    643   
        ::pretty_assertions::assert_eq!(
  624         -
            http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
         644  +
            ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
  625    645   
            http_response.status()
  626    646   
        );
  627    647   
        let expected_headers = [
  628    648   
            ("Content-Type", "application/cbor"),
  629    649   
            ("smithy-protocol", "rpc-v2-cbor"),
  630    650   
        ];
  631    651   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  632    652   
            http_response.headers(),
  633    653   
            expected_headers,
  634    654   
        ));
  635         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
         655  +
        use ::http_body_util::BodyExt;
         656  +
        let body = http_response
         657  +
            .into_body()
         658  +
            .collect()
  636    659   
            .await
  637         -
            .expect("unable to extract body to bytes");
         660  +
            .expect("unable to collect body")
         661  +
            .to_bytes();
  638    662   
        ::aws_smithy_protocol_test::assert_ok(
  639    663   
        ::aws_smithy_protocol_test::validate_body(&body, "v2ZuZXN0ZWS/Y2Zvb2RGb28xZ3ZhcmlhbnS/Z2Nob2ljZTFrT3V0ZXJDaG9pY2X/Zm5lc3RlZL9jYmFyZEJhcjFvcmVjdXJzaXZlTWVtYmVyv2Nmb29kRm9vMmd2YXJpYW50v2djaG9pY2Uyv2Nmb29kRm9vM2ZuZXN0ZWS/Y2JhcmRCYXIzb3JlY3Vyc2l2ZU1lbWJlcr9jZm9vZEZvbzRndmFyaWFudL9nY2hvaWNlMWtJbm5lckNob2ljZf//////Zm5lc3RlZL9jYmFyZEJhcjL//////w==", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
  640    664   
        );
  641    665   
    }
  642    666   
}
  643    667   
  644    668   
::pin_project_lite::pin_project! {
  645    669   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
  646    670   
    /// [`SingleMemberStructOperationInput`](crate::input::SingleMemberStructOperationInput) using modelled bindings.
  647    671   
    pub struct SingleMemberStructOperationInputFuture {
  648    672   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SingleMemberStructOperationInput, ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
  649    673   
    }
  650    674   
}
  651    675   
  652    676   
impl std::future::Future for SingleMemberStructOperationInputFuture {
  653    677   
    type Output = Result<
  654    678   
        crate::input::SingleMemberStructOperationInput,
  655    679   
        ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
  656    680   
    >;
  657    681   
  658    682   
    fn poll(
  659    683   
        self: std::pin::Pin<&mut Self>,
  660    684   
        cx: &mut std::task::Context<'_>,
  661    685   
    ) -> std::task::Poll<Self::Output> {
  662    686   
        let this = self.project();
  663    687   
        this.inner.as_mut().poll(cx)
  664    688   
    }
  665    689   
}
  666    690   
  667    691   
impl<B>
  668    692   
    ::aws_smithy_http_server::request::FromRequest<
  669    693   
        ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
  670    694   
        B,
  671    695   
    > for crate::input::SingleMemberStructOperationInput
  672    696   
where
  673    697   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
  674    698   
    B: 'static,
  675    699   
  676    700   
    B::Data: Send,
  677    701   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
  678    702   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
  679    703   
{
  680    704   
    type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
  681    705   
    type Future = SingleMemberStructOperationInputFuture;
  682    706   
  683         -
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         707  +
    fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
  684    708   
        let fut = async move {
  685    709   
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
  686    710   
                request.headers(),
  687    711   
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
  688    712   
            ) {
  689    713   
                return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
  690    714   
            }
  691    715   
            crate::protocol_serde::shape_single_member_struct_operation::de_single_member_struct_operation_http_request(request)
  692    716   
                            .await
  693    717   
        };
  694    718   
        use ::futures_util::future::TryFutureExt;
  695    719   
        let fut = fut.map_err(
  696    720   
            |e: ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
  697    721   
                ::tracing::debug!(error = %e, "failed to deserialize request");
  698    722   
                ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(
  699    723   
                    e,
  700    724   
                )
  701    725   
            },
  702    726   
        );
  703    727   
        SingleMemberStructOperationInputFuture {
  704    728   
            inner: Box::pin(fut),
  705    729   
        }
  706    730   
    }
  707    731   
}
  708    732   
impl
  709    733   
    ::aws_smithy_http_server::response::IntoResponse<
  710    734   
        ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
  711    735   
    > for crate::output::SingleMemberStructOperationOutput
  712    736   
{
  713    737   
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
  714    738   
        match crate::protocol_serde::shape_single_member_struct_operation::ser_single_member_struct_operation_http_response(self) {
  715    739   
                        Ok(response) => response,
  716    740   
                        Err(e) => {
  717    741   
                            ::tracing::error!(error = %e, "failed to serialize response");
  718    742   
                            ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
  719    743   
                        }
  720    744   
                    }
  721    745   
    }
  722    746   
}
  723    747   
  724    748   
#[allow(unreachable_code, unused_variables)]
  725    749   
#[cfg(test)]
  726    750   
mod single_member_struct_operation_test {
  727    751   
  728    752   
    /// When additional tokens are found past where we expect the end of the body,
  729    753   
    /// the request should be rejected with a serialization exception.
  730    754   
    /// Test ID: AdditionalTokensSingleMemberStruct
  731    755   
    #[::tokio::test]
  732    756   
    #[::tracing_test::traced_test]
  733    757   
    async fn additional_tokens_single_member_struct_malformed_request() {
  734    758   
        {
  735    759   
            #[allow(unused_mut)]
  736         -
            let mut http_request = http::Request::builder()
         760  +
            let mut http_request = ::http_1x::Request::builder()
  737    761   
                .uri("/service/RpcV2CborService/operation/SingleMemberStructOperation")
  738    762   
                .method("POST")
  739    763   
                .header("smithy-protocol", "rpc-v2-cbor")
  740    764   
                .header("Accept", "application/cbor")
  741    765   
                .header("Content-Type", "application/cbor")
  742         -
                .body(::aws_smithy_http_server::body::Body::from(
  743         -
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  744         -
                        "v/+//w==".as_bytes(),
  745         -
                        ::aws_smithy_protocol_test::MediaType::from("unknown"),
         766  +
                .body(::aws_smithy_http_server::body::boxed(
         767  +
                    ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
         768  +
                        &::aws_smithy_protocol_test::decode_body_data(
         769  +
                            "v/+//w==".as_bytes(),
         770  +
                            ::aws_smithy_protocol_test::MediaType::from("unknown"),
         771  +
                        ),
  746    772   
                    )),
  747    773   
                ))
  748    774   
                .unwrap();
  749    775   
            #[allow(unused_mut)]
  750    776   
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  751    777   
            let config = crate::service::RpcV2CborServiceConfig::builder().build();
  752         -
            let service = crate::service::RpcV2CborService::builder::<::hyper::body::Body, _, _, _>(config)
         778  +
            let service = crate::service::RpcV2CborService::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
  753    779   
                            .single_member_struct_operation(move |input: crate::input::SingleMemberStructOperationInput| {
  754    780   
                                let sender = sender.clone();
  755    781   
                                async move {
  756    782   
                                    let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::SingleMemberStructOperationOutput };
  757    783   
                                    sender.send(()).await.expect("receiver dropped early");
  758    784   
                                    result
  759    785   
                                }
  760    786   
                            })
  761    787   
                            .build_unchecked();
  762    788   
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  763    789   
                .await
  764    790   
                .expect("unable to make an HTTP request");
  765    791   
            ::pretty_assertions::assert_eq!(
  766         -
                http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
         792  +
                ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
  767    793   
                http_response.status()
  768    794   
            );
  769         -
            let body = ::hyper::body::to_bytes(http_response.into_body())
         795  +
            use ::http_body_util::BodyExt;
         796  +
            let body = http_response
         797  +
                .into_body()
         798  +
                .collect()
  770    799   
                .await
  771         -
                .expect("unable to extract body to bytes");
         800  +
                .expect("unable to collect body")
         801  +
                .to_bytes();
  772    802   
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  773    803   
                &body,
  774    804   
                "oA==",
  775    805   
                ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  776    806   
            ));
  777    807   
        }
  778    808   
    }
  779    809   
}
  780    810   
  781    811   
::pin_project_lite::pin_project! {
  782    812   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
  783    813   
    /// [`EmptyStructOperationInput`](crate::input::EmptyStructOperationInput) using modelled bindings.
  784    814   
    pub struct EmptyStructOperationInputFuture {
  785    815   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EmptyStructOperationInput, ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
  786    816   
    }
  787    817   
}
  788    818   
  789    819   
impl std::future::Future for EmptyStructOperationInputFuture {
  790    820   
    type Output = Result<
  791    821   
        crate::input::EmptyStructOperationInput,
  792    822   
        ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
  793    823   
    >;
  794    824   
  795    825   
    fn poll(
  796    826   
        self: std::pin::Pin<&mut Self>,
  797    827   
        cx: &mut std::task::Context<'_>,
  798    828   
    ) -> std::task::Poll<Self::Output> {
  799    829   
        let this = self.project();
  800    830   
        this.inner.as_mut().poll(cx)
  801    831   
    }
  802    832   
}
  803    833   
  804    834   
impl<B>
  805    835   
    ::aws_smithy_http_server::request::FromRequest<
  806    836   
        ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
  807    837   
        B,
  808    838   
    > for crate::input::EmptyStructOperationInput
  809    839   
where
  810    840   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
  811    841   
    B: 'static,
  812    842   
  813    843   
    B::Data: Send,
  814    844   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
  815    845   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
  816    846   
{
  817    847   
    type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
  818    848   
    type Future = EmptyStructOperationInputFuture;
  819    849   
  820         -
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         850  +
    fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
  821    851   
        let fut = async move {
  822    852   
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
  823    853   
                request.headers(),
  824    854   
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
  825    855   
            ) {
  826    856   
                return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
  827    857   
            }
  828    858   
            crate::protocol_serde::shape_empty_struct_operation::de_empty_struct_operation_http_request(request)
  829    859   
                            .await
  830    860   
        };
  831    861   
        use ::futures_util::future::TryFutureExt;
  832    862   
        let fut = fut.map_err(
  833    863   
            |e: ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
  834    864   
                ::tracing::debug!(error = %e, "failed to deserialize request");
  835    865   
                ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(
  836    866   
                    e,
  837    867   
                )
  838    868   
            },
  839    869   
        );
  840    870   
        EmptyStructOperationInputFuture {
  841    871   
            inner: Box::pin(fut),
  842    872   
        }
  843    873   
    }
  844    874   
}
  845    875   
impl
  846    876   
    ::aws_smithy_http_server::response::IntoResponse<
  847    877   
        ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
  848    878   
    > for crate::output::EmptyStructOperationOutput
  849    879   
{
  850    880   
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
  851    881   
        match crate::protocol_serde::shape_empty_struct_operation::ser_empty_struct_operation_http_response(self) {
  852    882   
                        Ok(response) => response,
  853    883   
                        Err(e) => {
  854    884   
                            ::tracing::error!(error = %e, "failed to serialize response");
  855    885   
                            ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
  856    886   
                        }
  857    887   
                    }
  858    888   
    }
  859    889   
}
  860    890   
  861    891   
#[allow(unreachable_code, unused_variables)]
  862    892   
#[cfg(test)]
  863    893   
mod empty_struct_operation_test {
  864    894   
  865    895   
    /// When additional tokens are found past where we expect the end of the body,
  866    896   
    /// the request should be rejected with a serialization exception.
  867    897   
    /// Test ID: AdditionalTokensEmptyStruct
  868    898   
    #[::tokio::test]
  869    899   
    #[::tracing_test::traced_test]
  870    900   
    #[should_panic]
  871    901   
    async fn additional_tokens_empty_struct_malformed_request() {
  872    902   
        {
  873    903   
            #[allow(unused_mut)]
  874         -
            let mut http_request = http::Request::builder()
         904  +
            let mut http_request = ::http_1x::Request::builder()
  875    905   
                .uri("/service/RpcV2CborService/operation/EmptyStructOperation")
  876    906   
                .method("POST")
  877    907   
                .header("smithy-protocol", "rpc-v2-cbor")
  878    908   
                .header("Accept", "application/cbor")
  879    909   
                .header("Content-Type", "application/cbor")
  880         -
                .body(::aws_smithy_http_server::body::Body::from(
  881         -
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
  882         -
                        "v/+//w==".as_bytes(),
  883         -
                        ::aws_smithy_protocol_test::MediaType::from("unknown"),
         910  +
                .body(::aws_smithy_http_server::body::boxed(
         911  +
                    ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
         912  +
                        &::aws_smithy_protocol_test::decode_body_data(
         913  +
                            "v/+//w==".as_bytes(),
         914  +
                            ::aws_smithy_protocol_test::MediaType::from("unknown"),
         915  +
                        ),
  884    916   
                    )),
  885    917   
                ))
  886    918   
                .unwrap();
  887    919   
            #[allow(unused_mut)]
  888    920   
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  889    921   
            let config = crate::service::RpcV2CborServiceConfig::builder().build();
  890         -
            let service = crate::service::RpcV2CborService::builder::<::hyper::body::Body, _, _, _>(config)
         922  +
            let service = crate::service::RpcV2CborService::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
  891    923   
                            .empty_struct_operation(move |input: crate::input::EmptyStructOperationInput| {
  892    924   
                                let sender = sender.clone();
  893    925   
                                async move {
  894    926   
                                    let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::EmptyStructOperationOutput };
  895    927   
                                    sender.send(()).await.expect("receiver dropped early");
  896    928   
                                    result
  897    929   
                                }
  898    930   
                            })
  899    931   
                            .build_unchecked();
  900    932   
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  901    933   
                .await
  902    934   
                .expect("unable to make an HTTP request");
  903    935   
            ::pretty_assertions::assert_eq!(
  904         -
                http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
         936  +
                ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
  905    937   
                http_response.status()
  906    938   
            );
  907         -
            let body = ::hyper::body::to_bytes(http_response.into_body())
         939  +
            use ::http_body_util::BodyExt;
         940  +
            let body = http_response
         941  +
                .into_body()
         942  +
                .collect()
  908    943   
                .await
  909         -
                .expect("unable to extract body to bytes");
         944  +
                .expect("unable to collect body")
         945  +
                .to_bytes();
  910    946   
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  911    947   
                &body,
  912    948   
                "oA==",
  913    949   
                ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
  914    950   
            ));
  915    951   
        }
  916    952   
    }
  917    953   
}
  918    954   
  919    955   
::pin_project_lite::pin_project! {
  920    956   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
  921    957   
    /// [`ComplexStructOperationInput`](crate::input::ComplexStructOperationInput) using modelled bindings.
  922    958   
    pub struct ComplexStructOperationInputFuture {
  923    959   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ComplexStructOperationInput, ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
  924    960   
    }
  925    961   
}
  926    962   
  927    963   
impl std::future::Future for ComplexStructOperationInputFuture {
  928    964   
    type Output = Result<
  929    965   
        crate::input::ComplexStructOperationInput,
  930    966   
        ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
  931    967   
    >;
  932    968   
  933    969   
    fn poll(
  934    970   
        self: std::pin::Pin<&mut Self>,
  935    971   
        cx: &mut std::task::Context<'_>,
  936    972   
    ) -> std::task::Poll<Self::Output> {
  937    973   
        let this = self.project();
  938    974   
        this.inner.as_mut().poll(cx)
  939    975   
    }
  940    976   
}
  941    977   
  942    978   
impl<B>
  943    979   
    ::aws_smithy_http_server::request::FromRequest<
  944    980   
        ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
  945    981   
        B,
  946    982   
    > for crate::input::ComplexStructOperationInput
  947    983   
where
  948    984   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
  949    985   
    B: 'static,
  950    986   
  951    987   
    B::Data: Send,
  952    988   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
  953    989   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
  954    990   
{
  955    991   
    type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
  956    992   
    type Future = ComplexStructOperationInputFuture;
  957    993   
  958         -
    fn from_request(request: ::http::Request<B>) -> Self::Future {
         994  +
    fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
  959    995   
        let fut = async move {
  960    996   
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
  961    997   
                request.headers(),
  962    998   
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
  963    999   
            ) {
  964   1000   
                return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
  965   1001   
            }
  966   1002   
            crate::protocol_serde::shape_complex_struct_operation::de_complex_struct_operation_http_request(request)
  967   1003   
                            .await
  968   1004   
        };
@@ -1026,1062 +1086,1122 @@
 1046   1082   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
 1047   1083   
    B: 'static,
 1048   1084   
 1049   1085   
    B::Data: Send,
 1050   1086   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
 1051   1087   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
 1052   1088   
{
 1053   1089   
    type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
 1054   1090   
    type Future = ErrorSerializationOperationInputFuture;
 1055   1091   
 1056         -
    fn from_request(request: ::http::Request<B>) -> Self::Future {
        1092  +
    fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
 1057   1093   
        let fut = async move {
 1058   1094   
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
 1059   1095   
                request.headers(),
 1060   1096   
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
 1061   1097   
            ) {
 1062   1098   
                return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
 1063   1099   
            }
 1064   1100   
            crate::protocol_serde::shape_error_serialization_operation::de_error_serialization_operation_http_request(request)
 1065   1101   
                            .await
 1066   1102   
        };
@@ -1107,1143 +1268,1314 @@
 1127   1163   
    async fn operation_output_serialization_questionably_includes_type_field_response() {
 1128   1164   
        let output = crate::output::ErrorSerializationOperationOutput {
 1129   1165   
            error_shape: ::std::option::Option::Some(crate::error::ValidationException {
 1130   1166   
                message: "ValidationException message field".to_owned(),
 1131   1167   
                field_list: ::std::option::Option::None,
 1132   1168   
            }),
 1133   1169   
        };
 1134   1170   
        use ::aws_smithy_http_server::response::IntoResponse;
 1135   1171   
        let http_response = output.into_response();
 1136   1172   
        ::pretty_assertions::assert_eq!(
 1137         -
            http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
        1173  +
            ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
 1138   1174   
            http_response.status()
 1139   1175   
        );
 1140         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
        1176  +
        use ::http_body_util::BodyExt;
        1177  +
        let body = http_response
        1178  +
            .into_body()
        1179  +
            .collect()
 1141   1180   
            .await
 1142         -
            .expect("unable to extract body to bytes");
        1181  +
            .expect("unable to collect body")
        1182  +
            .to_bytes();
 1143   1183   
        ::aws_smithy_protocol_test::assert_ok(
 1144   1184   
        ::aws_smithy_protocol_test::validate_body(&body, "v2plcnJvclNoYXBlv2ZfX3R5cGV4JHNtaXRoeS5mcmFtZXdvcmsjVmFsaWRhdGlvbkV4Y2VwdGlvbmdtZXNzYWdleCFWYWxpZGF0aW9uRXhjZXB0aW9uIG1lc3NhZ2UgZmllbGT//w==", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
 1145   1185   
        );
 1146   1186   
    }
 1147   1187   
 1148   1188   
    /// When invalid input is provided the request should be rejected with
 1149   1189   
    /// a validation exception, and a `__type` field should be included
 1150   1190   
    /// Test ID: ErrorSerializationIncludesTypeField
 1151   1191   
    #[::tokio::test]
 1152   1192   
    #[::tracing_test::traced_test]
 1153   1193   
    async fn error_serialization_includes_type_field_malformed_request() {
 1154   1194   
        {
 1155   1195   
            #[allow(unused_mut)]
 1156         -
            let mut http_request = http::Request::builder()
        1196  +
            let mut http_request = ::http_1x::Request::builder()
 1157   1197   
                .uri("/service/RpcV2CborService/operation/ErrorSerializationOperation")
 1158   1198   
                .method("POST")
 1159   1199   
                .header("smithy-protocol", "rpc-v2-cbor")
 1160   1200   
                .header("Accept", "application/cbor")
 1161   1201   
                .header("Content-Type", "application/cbor")
 1162         -
                .body(::aws_smithy_http_server::body::Body::from(
 1163         -
                    ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
 1164         -
                        "oA==".as_bytes(),
 1165         -
                        ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
        1202  +
                .body(::aws_smithy_http_server::body::boxed(
        1203  +
                    ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
        1204  +
                        &::aws_smithy_protocol_test::decode_body_data(
        1205  +
                            "oA==".as_bytes(),
        1206  +
                            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
        1207  +
                        ),
 1166   1208   
                    )),
 1167   1209   
                ))
 1168   1210   
                .unwrap();
 1169   1211   
            #[allow(unused_mut)]
 1170   1212   
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
 1171   1213   
            let config = crate::service::RpcV2CborServiceConfig::builder().build();
 1172         -
            let service = crate::service::RpcV2CborService::builder::<::hyper::body::Body, _, _, _>(config)
        1214  +
            let service = crate::service::RpcV2CborService::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
 1173   1215   
                            .error_serialization_operation(move |input: crate::input::ErrorSerializationOperationInput| {
 1174   1216   
                                let sender = sender.clone();
 1175   1217   
                                async move {
 1176   1218   
                                    let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::ErrorSerializationOperationOutput, crate::error::ErrorSerializationOperationError> };
 1177   1219   
                                    sender.send(()).await.expect("receiver dropped early");
 1178   1220   
                                    result
 1179   1221   
                                }
 1180   1222   
                            })
 1181   1223   
                            .build_unchecked();
 1182   1224   
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
 1183   1225   
                .await
 1184   1226   
                .expect("unable to make an HTTP request");
 1185   1227   
            ::pretty_assertions::assert_eq!(
 1186         -
                http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
        1228  +
                ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
 1187   1229   
                http_response.status()
 1188   1230   
            );
 1189         -
            let body = ::hyper::body::to_bytes(http_response.into_body())
        1231  +
            use ::http_body_util::BodyExt;
        1232  +
            let body = http_response
        1233  +
                .into_body()
        1234  +
                .collect()
 1190   1235   
                .await
 1191         -
                .expect("unable to extract body to bytes");
        1236  +
                .expect("unable to collect body")
        1237  +
                .to_bytes();
 1192   1238   
            ::aws_smithy_protocol_test::assert_ok(
 1193   1239   
            ::aws_smithy_protocol_test::validate_body(&body, "v2ZfX3R5cGV4JHNtaXRoeS5mcmFtZXdvcmsjVmFsaWRhdGlvbkV4Y2VwdGlvbmdtZXNzYWdleGsxIHZhbGlkYXRpb24gZXJyb3IgZGV0ZWN0ZWQuIFZhbHVlIGF0ICcvcmVxdWlyZWRCbG9iJyBmYWlsZWQgdG8gc2F0aXNmeSBjb25zdHJhaW50OiBNZW1iZXIgbXVzdCBub3QgYmUgbnVsbGlmaWVsZExpc3SBv2RwYXRobS9yZXF1aXJlZEJsb2JnbWVzc2FnZXhOVmFsdWUgYXQgJy9yZXF1aXJlZEJsb2InIGZhaWxlZCB0byBzYXRpc2Z5IGNvbnN0cmFpbnQ6IE1lbWJlciBtdXN0IG5vdCBiZSBudWxs//8=", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
 1194   1240   
            );
 1195   1241   
        }
 1196   1242   
    }
 1197   1243   
}
 1198   1244   
 1199   1245   
::pin_project_lite::pin_project! {
 1200   1246   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
 1201   1247   
    /// [`SimpleStructOperationInput`](crate::input::SimpleStructOperationInput) using modelled bindings.
 1202   1248   
    pub struct SimpleStructOperationInputFuture {
 1203   1249   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SimpleStructOperationInput, ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
 1204   1250   
    }
 1205   1251   
}
 1206   1252   
 1207   1253   
impl std::future::Future for SimpleStructOperationInputFuture {
 1208   1254   
    type Output = Result<
 1209   1255   
        crate::input::SimpleStructOperationInput,
 1210   1256   
        ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
 1211   1257   
    >;
 1212   1258   
 1213   1259   
    fn poll(
 1214   1260   
        self: std::pin::Pin<&mut Self>,
 1215   1261   
        cx: &mut std::task::Context<'_>,
 1216   1262   
    ) -> std::task::Poll<Self::Output> {
 1217   1263   
        let this = self.project();
 1218   1264   
        this.inner.as_mut().poll(cx)
 1219   1265   
    }
 1220   1266   
}
 1221   1267   
 1222   1268   
impl<B>
 1223   1269   
    ::aws_smithy_http_server::request::FromRequest<
 1224   1270   
        ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
 1225   1271   
        B,
 1226   1272   
    > for crate::input::SimpleStructOperationInput
 1227   1273   
where
 1228   1274   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
 1229   1275   
    B: 'static,
 1230   1276   
 1231   1277   
    B::Data: Send,
 1232   1278   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
 1233   1279   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
 1234   1280   
{
 1235   1281   
    type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
 1236   1282   
    type Future = SimpleStructOperationInputFuture;
 1237   1283   
 1238         -
    fn from_request(request: ::http::Request<B>) -> Self::Future {
        1284  +
    fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
 1239   1285   
        let fut = async move {
 1240   1286   
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
 1241   1287   
                request.headers(),
 1242   1288   
                &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
 1243   1289   
            ) {
 1244   1290   
                return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
 1245   1291   
            }
 1246   1292   
            crate::protocol_serde::shape_simple_struct_operation::de_simple_struct_operation_http_request(request)
 1247   1293   
                            .await
 1248   1294   
        };
@@ -1369,1415 +1442,1492 @@
 1389   1435   
                ::aws_smithy_types::DateTime::from_fractional_secs(1546300800, 0_f64)
 1390   1436   
            ,
 1391   1437   
            required_enum:
 1392   1438   
                "DIAMOND".parse::<crate::model::Suit>().expect("static value validated to member")
 1393   1439   
            ,
 1394   1440   
        }
 1395   1441   
        ;
 1396   1442   
        use ::aws_smithy_http_server::response::IntoResponse;
 1397   1443   
        let http_response = output.into_response();
 1398   1444   
        ::pretty_assertions::assert_eq!(
 1399         -
            http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
        1445  +
            ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
 1400   1446   
            http_response.status()
 1401   1447   
        );
 1402   1448   
        let expected_headers = [
 1403   1449   
            ("Content-Type", "application/cbor"),
 1404   1450   
            ("smithy-protocol", "rpc-v2-cbor"),
 1405   1451   
        ];
 1406   1452   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
 1407   1453   
            http_response.headers(),
 1408   1454   
            expected_headers,
 1409   1455   
        ));
 1410         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
        1456  +
        use ::http_body_util::BodyExt;
        1457  +
        let body = http_response
        1458  +
            .into_body()
        1459  +
            .collect()
 1411   1460   
            .await
 1412         -
            .expect("unable to extract body to bytes");
        1461  +
            .expect("unable to collect body")
        1462  +
            .to_bytes();
 1413   1463   
        ::aws_smithy_protocol_test::assert_ok(
 1414   1464   
        ::aws_smithy_protocol_test::validate_body(&body, "v2RibG9iS2Jsb2JieSBibG9iZ2Jvb2xlYW70ZnN0cmluZ3hwVGhlcmUgYXJlIHRocmVlIHRoaW5ncyBhbGwgd2lzZSBtZW4gZmVhcjogdGhlIHNlYSBpbiBzdG9ybSwgYSBuaWdodCB3aXRoIG5vIG1vb24sIGFuZCB0aGUgYW5nZXIgb2YgYSBnZW50bGUgbWFuLmRieXRlGEVlc2hvcnQYRmdpbnRlZ2VyGEdkbG9uZxhIZWZsb2F0+j8wo9dmZG91Ymxl+z/mTQE6kqMFaXRpbWVzdGFtcMH7QdcKq2AAAABkZW51bWdESUFNT05EbHJlcXVpcmVkQmxvYktibG9iYnkgYmxvYm9yZXF1aXJlZEJvb2xlYW70bnJlcXVpcmVkU3RyaW5neHBUaGVyZSBhcmUgdGhyZWUgdGhpbmdzIGFsbCB3aXNlIG1lbiBmZWFyOiB0aGUgc2VhIGluIHN0b3JtLCBhIG5pZ2h0IHdpdGggbm8gbW9vbiwgYW5kIHRoZSBhbmdlciBvZiBhIGdlbnRsZSBtYW4ubHJlcXVpcmVkQnl0ZRhFbXJlcXVpcmVkU2hvcnQYRm9yZXF1aXJlZEludGVnZXIYR2xyZXF1aXJlZExvbmcYSG1yZXF1aXJlZEZsb2F0+j8wo9ducmVxdWlyZWREb3VibGX7P+ZNATqSowVxcmVxdWlyZWRUaW1lc3RhbXDB+0HXCqtgAAAAbHJlcXVpcmVkRW51bWdESUFNT05E/w==", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
 1415   1465   
        );
 1416   1466   
    }
 1417   1467   
    /// Test ID: SimpleStructWithOptionsSetToNone
 1418   1468   
    #[::tokio::test]
 1419   1469   
    #[::tracing_test::traced_test]
 1420   1470   
    async fn simple_struct_with_options_set_to_none_response() {
 1421   1471   
        let output =crate::output::SimpleStructOperationOutput {
 1422   1472   
            required_blob:
@@ -1463,1513 +1511,1565 @@
 1483   1533   
                ::std::option::Option::None
 1484   1534   
            ,
 1485   1535   
            r#enum:
 1486   1536   
                ::std::option::Option::None
 1487   1537   
            ,
 1488   1538   
        }
 1489   1539   
        ;
 1490   1540   
        use ::aws_smithy_http_server::response::IntoResponse;
 1491   1541   
        let http_response = output.into_response();
 1492   1542   
        ::pretty_assertions::assert_eq!(
 1493         -
            http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
        1543  +
            ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
 1494   1544   
            http_response.status()
 1495   1545   
        );
 1496   1546   
        let expected_headers = [
 1497   1547   
            ("Content-Type", "application/cbor"),
 1498   1548   
            ("smithy-protocol", "rpc-v2-cbor"),
 1499   1549   
        ];
 1500   1550   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
 1501   1551   
            http_response.headers(),
 1502   1552   
            expected_headers,
 1503   1553   
        ));
 1504         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
        1554  +
        use ::http_body_util::BodyExt;
        1555  +
        let body = http_response
        1556  +
            .into_body()
        1557  +
            .collect()
 1505   1558   
            .await
 1506         -
            .expect("unable to extract body to bytes");
        1559  +
            .expect("unable to collect body")
        1560  +
            .to_bytes();
 1507   1561   
        ::aws_smithy_protocol_test::assert_ok(
 1508   1562   
        ::aws_smithy_protocol_test::validate_body(&body, "v2xyZXF1aXJlZEJsb2JLYmxvYmJ5IGJsb2JvcmVxdWlyZWRCb29sZWFu9G5yZXF1aXJlZFN0cmluZ3hwVGhlcmUgYXJlIHRocmVlIHRoaW5ncyBhbGwgd2lzZSBtZW4gZmVhcjogdGhlIHNlYSBpbiBzdG9ybSwgYSBuaWdodCB3aXRoIG5vIG1vb24sIGFuZCB0aGUgYW5nZXIgb2YgYSBnZW50bGUgbWFuLmxyZXF1aXJlZEJ5dGUYRW1yZXF1aXJlZFNob3J0GEZvcmVxdWlyZWRJbnRlZ2VyGEdscmVxdWlyZWRMb25nGEhtcmVxdWlyZWRGbG9hdPo/MKPXbnJlcXVpcmVkRG91Ymxl+z/mTQE6kqMFcXJlcXVpcmVkVGltZXN0YW1wwftB1wqrYAAAAGxyZXF1aXJlZEVudW1nRElBTU9ORP8=", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
 1509   1563   
        );
 1510   1564   
    }
 1511   1565   
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response/rust-server-codegen/src/protocol_serde/shape_complex_struct_operation.rs

@@ -1,1 +130,133 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_complex_struct_operation_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           4  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::ComplexStructOperationInput,
    7      7   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10     10   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12     12   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
   13     13   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input = crate::input::complex_struct_operation_input::Builder::default();
   18     18   
        #[allow(unused_variables)]
   19     19   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     20   
            uri, headers, body, ..
   21     21   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          22  +
        let bytes = {
          23  +
            use ::http_body_util::BodyExt;
          24  +
            body.collect().await?.to_bytes()
          25  +
        };
   23     26   
        if !bytes.is_empty() {
   24     27   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     28   
                &headers,
   26     29   
                Some("application/cbor"),
   27     30   
            )?;
   28     31   
            input =
   29     32   
                crate::protocol_serde::shape_complex_struct_operation::de_complex_struct_operation(
   30     33   
                    bytes.as_ref(),
   31     34   
                    input,
   32     35   
                )?;
   33     36   
        }
   34     37   
        input.build()?
   35     38   
    })
   36     39   
}
   37     40   
   38     41   
#[allow(clippy::unnecessary_wraps)]
   39     42   
pub fn ser_complex_struct_operation_http_response(
   40     43   
    #[allow(unused_variables)] output: crate::output::ComplexStructOperationOutput,
   41     44   
) -> std::result::Result<
   42     45   
    ::aws_smithy_http_server::response::Response,
   43     46   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   44     47   
> {
   45     48   
    Ok({
   46     49   
        #[allow(unused_mut)]
   47         -
        let mut builder = ::http::Response::builder();
          50  +
        let mut builder = ::http_1x::Response::builder();
   48     51   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     52   
            builder,
   50         -
            ::http::header::CONTENT_TYPE,
          53  +
            ::http_1x::header::CONTENT_TYPE,
   51     54   
            "application/cbor",
   52     55   
        );
   53     56   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   54     57   
            builder,
   55         -
            ::http::header::HeaderName::from_static("smithy-protocol"),
          58  +
            ::http_1x::header::HeaderName::from_static("smithy-protocol"),
   56     59   
            "rpc-v2-cbor",
   57     60   
        );
   58     61   
        let http_status: u16 = 200;
   59     62   
        builder = builder.status(http_status);
   60     63   
        let payload =
   61     64   
            crate::protocol_serde::shape_complex_struct_operation_output::ser_complex_struct_operation_output_output_output(&output)?
   62     65   
        ;
   63     66   
        let content_length = payload.len();
   64     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   65     68   
            builder,
   66         -
            ::http::header::CONTENT_LENGTH,
          69  +
            ::http_1x::header::CONTENT_LENGTH,
   67     70   
            content_length,
   68     71   
        );
   69     72   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
   70     73   
        builder.body(body)?
   71     74   
    })
   72     75   
}
   73     76   
   74     77   
#[allow(clippy::unnecessary_wraps)]
   75     78   
pub fn ser_complex_struct_operation_http_error(
   76     79   
    error: &crate::error::ComplexStructOperationError,
   77     80   
) -> std::result::Result<
   78     81   
    ::aws_smithy_http_server::response::Response,
   79     82   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   80     83   
> {
   81     84   
    Ok({
   82     85   
        match error {
   83     86   
            crate::error::ComplexStructOperationError::ValidationException(output) => {
   84     87   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
   85     88   
                #[allow(unused_mut)]
   86         -
                let mut builder = ::http::Response::builder();
          89  +
                let mut builder = ::http_1x::Response::builder();
   87     90   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   88     91   
                    builder,
   89         -
                    ::http::header::CONTENT_TYPE,
          92  +
                    ::http_1x::header::CONTENT_TYPE,
   90     93   
                    "application/cbor",
   91     94   
                );
   92     95   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   93     96   
                    builder,
   94         -
                    ::http::header::HeaderName::from_static("smithy-protocol"),
          97  +
                    ::http_1x::header::HeaderName::from_static("smithy-protocol"),
   95     98   
                    "rpc-v2-cbor",
   96     99   
                );
   97    100   
                let content_length = payload.len();
   98    101   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   99    102   
                    builder,
  100         -
                    ::http::header::CONTENT_LENGTH,
         103  +
                    ::http_1x::header::CONTENT_LENGTH,
  101    104   
                    content_length,
  102    105   
                );
  103    106   
                builder
  104    107   
                    .status(400)
  105    108   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  106    109   
            }
  107    110   
        }
  108    111   
    })
  109    112   
}
  110    113   

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response/rust-server-codegen/src/protocol_serde/shape_empty_struct_operation.rs

@@ -1,1 +60,60 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_empty_struct_operation_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           4  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::EmptyStructOperationInput,
    7      7   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10     10   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12     12   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
   13     13   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input = crate::input::empty_struct_operation_input::Builder::default();
   18     18   
        #[allow(unused_variables)]
   19     19   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     20   
            uri, headers, body, ..
   21     21   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22     22   
        input.build()
   23     23   
    })
   24     24   
}
   25     25   
   26     26   
#[allow(clippy::unnecessary_wraps)]
   27     27   
pub fn ser_empty_struct_operation_http_response(
   28     28   
    #[allow(unused_variables)] output: crate::output::EmptyStructOperationOutput,
   29     29   
) -> std::result::Result<
   30     30   
    ::aws_smithy_http_server::response::Response,
   31     31   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   32     32   
> {
   33     33   
    Ok({
   34     34   
        #[allow(unused_mut)]
   35         -
        let mut builder = ::http::Response::builder();
          35  +
        let mut builder = ::http_1x::Response::builder();
   36     36   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   37     37   
            builder,
   38         -
            ::http::header::CONTENT_TYPE,
          38  +
            ::http_1x::header::CONTENT_TYPE,
   39     39   
            "application/cbor",
   40     40   
        );
   41     41   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   42     42   
            builder,
   43         -
            ::http::header::HeaderName::from_static("smithy-protocol"),
          43  +
            ::http_1x::header::HeaderName::from_static("smithy-protocol"),
   44     44   
            "rpc-v2-cbor",
   45     45   
        );
   46     46   
        let http_status: u16 = 200;
   47     47   
        builder = builder.status(http_status);
   48     48   
        let payload =
   49     49   
            crate::protocol_serde::shape_empty_struct_operation_output::ser_empty_struct_operation_output_output_output(&output)?
   50     50   
        ;
   51     51   
        let content_length = payload.len();
   52     52   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   53     53   
            builder,
   54         -
            ::http::header::CONTENT_LENGTH,
          54  +
            ::http_1x::header::CONTENT_LENGTH,
   55     55   
            content_length,
   56     56   
        );
   57     57   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
   58     58   
        builder.body(body)?
   59     59   
    })
   60     60   
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response/rust-server-codegen/src/protocol_serde/shape_error_serialization_operation.rs

@@ -1,1 +126,129 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_error_serialization_operation_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           4  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::ErrorSerializationOperationInput,
    7      7   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10     10   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12     12   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
   13     13   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input = crate::input::error_serialization_operation_input::Builder::default();
   18     18   
        #[allow(unused_variables)]
   19     19   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     20   
            uri, headers, body, ..
   21     21   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          22  +
        let bytes = {
          23  +
            use ::http_body_util::BodyExt;
          24  +
            body.collect().await?.to_bytes()
          25  +
        };
   23     26   
        if !bytes.is_empty() {
   24     27   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     28   
                &headers,
   26     29   
                Some("application/cbor"),
   27     30   
            )?;
   28     31   
            input = crate::protocol_serde::shape_error_serialization_operation::de_error_serialization_operation(bytes.as_ref(), input)?;
   29     32   
        }
   30     33   
        input.build()?
   31     34   
    })
   32     35   
}
   33     36   
   34     37   
#[allow(clippy::unnecessary_wraps)]
   35     38   
pub fn ser_error_serialization_operation_http_response(
   36     39   
    #[allow(unused_variables)] output: crate::output::ErrorSerializationOperationOutput,
   37     40   
) -> std::result::Result<
   38     41   
    ::aws_smithy_http_server::response::Response,
   39     42   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   40     43   
> {
   41     44   
    Ok({
   42     45   
        #[allow(unused_mut)]
   43         -
        let mut builder = ::http::Response::builder();
          46  +
        let mut builder = ::http_1x::Response::builder();
   44     47   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     48   
            builder,
   46         -
            ::http::header::CONTENT_TYPE,
          49  +
            ::http_1x::header::CONTENT_TYPE,
   47     50   
            "application/cbor",
   48     51   
        );
   49     52   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     53   
            builder,
   51         -
            ::http::header::HeaderName::from_static("smithy-protocol"),
          54  +
            ::http_1x::header::HeaderName::from_static("smithy-protocol"),
   52     55   
            "rpc-v2-cbor",
   53     56   
        );
   54     57   
        let http_status: u16 = 200;
   55     58   
        builder = builder.status(http_status);
   56     59   
        let payload =
   57     60   
            crate::protocol_serde::shape_error_serialization_operation_output::ser_error_serialization_operation_output_output_output(&output)?
   58     61   
        ;
   59     62   
        let content_length = payload.len();
   60     63   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   61     64   
            builder,
   62         -
            ::http::header::CONTENT_LENGTH,
          65  +
            ::http_1x::header::CONTENT_LENGTH,
   63     66   
            content_length,
   64     67   
        );
   65     68   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
   66     69   
        builder.body(body)?
   67     70   
    })
   68     71   
}
   69     72   
   70     73   
#[allow(clippy::unnecessary_wraps)]
   71     74   
pub fn ser_error_serialization_operation_http_error(
   72     75   
    error: &crate::error::ErrorSerializationOperationError,
   73     76   
) -> std::result::Result<
   74     77   
    ::aws_smithy_http_server::response::Response,
   75     78   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   76     79   
> {
   77     80   
    Ok({
   78     81   
        match error {
   79     82   
            crate::error::ErrorSerializationOperationError::ValidationException(output) => {
   80     83   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
   81     84   
                #[allow(unused_mut)]
   82         -
                let mut builder = ::http::Response::builder();
          85  +
                let mut builder = ::http_1x::Response::builder();
   83     86   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84     87   
                    builder,
   85         -
                    ::http::header::CONTENT_TYPE,
          88  +
                    ::http_1x::header::CONTENT_TYPE,
   86     89   
                    "application/cbor",
   87     90   
                );
   88     91   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   89     92   
                    builder,
   90         -
                    ::http::header::HeaderName::from_static("smithy-protocol"),
          93  +
                    ::http_1x::header::HeaderName::from_static("smithy-protocol"),
   91     94   
                    "rpc-v2-cbor",
   92     95   
                );
   93     96   
                let content_length = payload.len();
   94     97   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   95     98   
                    builder,
   96         -
                    ::http::header::CONTENT_LENGTH,
          99  +
                    ::http_1x::header::CONTENT_LENGTH,
   97    100   
                    content_length,
   98    101   
                );
   99    102   
                builder
  100    103   
                    .status(400)
  101    104   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  102    105   
            }
  103    106   
        }
  104    107   
    })
  105    108   
}
  106    109   

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response/rust-server-codegen/src/protocol_serde/shape_recursive_union_operation.rs

@@ -1,1 +92,95 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_recursive_union_operation_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           4  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::RecursiveUnionOperationInput,
    7      7   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10     10   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12     12   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
   13     13   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input = crate::input::recursive_union_operation_input::Builder::default();
   18     18   
        #[allow(unused_variables)]
   19     19   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     20   
            uri, headers, body, ..
   21     21   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          22  +
        let bytes = {
          23  +
            use ::http_body_util::BodyExt;
          24  +
            body.collect().await?.to_bytes()
          25  +
        };
   23     26   
        if !bytes.is_empty() {
   24     27   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     28   
                &headers,
   26     29   
                Some("application/cbor"),
   27     30   
            )?;
   28     31   
            input = crate::protocol_serde::shape_recursive_union_operation::de_recursive_union_operation(bytes.as_ref(), input)?;
   29     32   
        }
   30     33   
        input.build()
   31     34   
    })
   32     35   
}
   33     36   
   34     37   
#[allow(clippy::unnecessary_wraps)]
   35     38   
pub fn ser_recursive_union_operation_http_response(
   36     39   
    #[allow(unused_variables)] output: crate::output::RecursiveUnionOperationOutput,
   37     40   
) -> std::result::Result<
   38     41   
    ::aws_smithy_http_server::response::Response,
   39     42   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   40     43   
> {
   41     44   
    Ok({
   42     45   
        #[allow(unused_mut)]
   43         -
        let mut builder = ::http::Response::builder();
          46  +
        let mut builder = ::http_1x::Response::builder();
   44     47   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     48   
            builder,
   46         -
            ::http::header::CONTENT_TYPE,
          49  +
            ::http_1x::header::CONTENT_TYPE,
   47     50   
            "application/cbor",
   48     51   
        );
   49     52   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     53   
            builder,
   51         -
            ::http::header::HeaderName::from_static("smithy-protocol"),
          54  +
            ::http_1x::header::HeaderName::from_static("smithy-protocol"),
   52     55   
            "rpc-v2-cbor",
   53     56   
        );
   54     57   
        let http_status: u16 = 200;
   55     58   
        builder = builder.status(http_status);
   56     59   
        let payload =
   57     60   
            crate::protocol_serde::shape_recursive_union_operation_output::ser_recursive_union_operation_output_output_output(&output)?
   58     61   
        ;
   59     62   
        let content_length = payload.len();
   60     63   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   61     64   
            builder,
   62         -
            ::http::header::CONTENT_LENGTH,
          65  +
            ::http_1x::header::CONTENT_LENGTH,
   63     66   
            content_length,
   64     67   
        );
   65     68   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
   66     69   
        builder.body(body)?
   67     70   
    })
   68     71   
}
   69     72   
   70     73   
pub(crate) fn de_recursive_union_operation(
   71     74   
    value: &[u8],
   72     75   
    mut builder: crate::input::recursive_union_operation_input::Builder,

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response/rust-server-codegen/src/protocol_serde/shape_simple_struct_operation.rs

@@ -1,1 +130,133 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_simple_struct_operation_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           4  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::SimpleStructOperationInput,
    7      7   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10     10   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12     12   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
   13     13   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input = crate::input::simple_struct_operation_input::Builder::default();
   18     18   
        #[allow(unused_variables)]
   19     19   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     20   
            uri, headers, body, ..
   21     21   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          22  +
        let bytes = {
          23  +
            use ::http_body_util::BodyExt;
          24  +
            body.collect().await?.to_bytes()
          25  +
        };
   23     26   
        if !bytes.is_empty() {
   24     27   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     28   
                &headers,
   26     29   
                Some("application/cbor"),
   27     30   
            )?;
   28     31   
            input =
   29     32   
                crate::protocol_serde::shape_simple_struct_operation::de_simple_struct_operation(
   30     33   
                    bytes.as_ref(),
   31     34   
                    input,
   32     35   
                )?;
   33     36   
        }
   34     37   
        input.build()?
   35     38   
    })
   36     39   
}
   37     40   
   38     41   
#[allow(clippy::unnecessary_wraps)]
   39     42   
pub fn ser_simple_struct_operation_http_response(
   40     43   
    #[allow(unused_variables)] output: crate::output::SimpleStructOperationOutput,
   41     44   
) -> std::result::Result<
   42     45   
    ::aws_smithy_http_server::response::Response,
   43     46   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   44     47   
> {
   45     48   
    Ok({
   46     49   
        #[allow(unused_mut)]
   47         -
        let mut builder = ::http::Response::builder();
          50  +
        let mut builder = ::http_1x::Response::builder();
   48     51   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     52   
            builder,
   50         -
            ::http::header::CONTENT_TYPE,
          53  +
            ::http_1x::header::CONTENT_TYPE,
   51     54   
            "application/cbor",
   52     55   
        );
   53     56   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   54     57   
            builder,
   55         -
            ::http::header::HeaderName::from_static("smithy-protocol"),
          58  +
            ::http_1x::header::HeaderName::from_static("smithy-protocol"),
   56     59   
            "rpc-v2-cbor",
   57     60   
        );
   58     61   
        let http_status: u16 = 200;
   59     62   
        builder = builder.status(http_status);
   60     63   
        let payload =
   61     64   
            crate::protocol_serde::shape_simple_struct_operation_output::ser_simple_struct_operation_output_output_output(&output)?
   62     65   
        ;
   63     66   
        let content_length = payload.len();
   64     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   65     68   
            builder,
   66         -
            ::http::header::CONTENT_LENGTH,
          69  +
            ::http_1x::header::CONTENT_LENGTH,
   67     70   
            content_length,
   68     71   
        );
   69     72   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
   70     73   
        builder.body(body)?
   71     74   
    })
   72     75   
}
   73     76   
   74     77   
#[allow(clippy::unnecessary_wraps)]
   75     78   
pub fn ser_simple_struct_operation_http_error(
   76     79   
    error: &crate::error::SimpleStructOperationError,
   77     80   
) -> std::result::Result<
   78     81   
    ::aws_smithy_http_server::response::Response,
   79     82   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   80     83   
> {
   81     84   
    Ok({
   82     85   
        match error {
   83     86   
            crate::error::SimpleStructOperationError::ValidationException(output) => {
   84     87   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
   85     88   
                #[allow(unused_mut)]
   86         -
                let mut builder = ::http::Response::builder();
          89  +
                let mut builder = ::http_1x::Response::builder();
   87     90   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   88     91   
                    builder,
   89         -
                    ::http::header::CONTENT_TYPE,
          92  +
                    ::http_1x::header::CONTENT_TYPE,
   90     93   
                    "application/cbor",
   91     94   
                );
   92     95   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   93     96   
                    builder,
   94         -
                    ::http::header::HeaderName::from_static("smithy-protocol"),
          97  +
                    ::http_1x::header::HeaderName::from_static("smithy-protocol"),
   95     98   
                    "rpc-v2-cbor",
   96     99   
                );
   97    100   
                let content_length = payload.len();
   98    101   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   99    102   
                    builder,
  100         -
                    ::http::header::CONTENT_LENGTH,
         103  +
                    ::http_1x::header::CONTENT_LENGTH,
  101    104   
                    content_length,
  102    105   
                );
  103    106   
                builder
  104    107   
                    .status(400)
  105    108   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  106    109   
            }
  107    110   
        }
  108    111   
    })
  109    112   
}
  110    113   

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response/rust-server-codegen/src/protocol_serde/shape_single_member_struct_operation.rs

@@ -1,1 +92,95 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_single_member_struct_operation_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           4  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::SingleMemberStructOperationInput,
    7      7   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10     10   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12     12   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
   13     13   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input = crate::input::single_member_struct_operation_input::Builder::default();
   18     18   
        #[allow(unused_variables)]
   19     19   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     20   
            uri, headers, body, ..
   21     21   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          22  +
        let bytes = {
          23  +
            use ::http_body_util::BodyExt;
          24  +
            body.collect().await?.to_bytes()
          25  +
        };
   23     26   
        if !bytes.is_empty() {
   24     27   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     28   
                &headers,
   26     29   
                Some("application/cbor"),
   27     30   
            )?;
   28     31   
            input = crate::protocol_serde::shape_single_member_struct_operation::de_single_member_struct_operation(bytes.as_ref(), input)?;
   29     32   
        }
   30     33   
        input.build()
   31     34   
    })
   32     35   
}
   33     36   
   34     37   
#[allow(clippy::unnecessary_wraps)]
   35     38   
pub fn ser_single_member_struct_operation_http_response(
   36     39   
    #[allow(unused_variables)] output: crate::output::SingleMemberStructOperationOutput,
   37     40   
) -> std::result::Result<
   38     41   
    ::aws_smithy_http_server::response::Response,
   39     42   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   40     43   
> {
   41     44   
    Ok({
   42     45   
        #[allow(unused_mut)]
   43         -
        let mut builder = ::http::Response::builder();
          46  +
        let mut builder = ::http_1x::Response::builder();
   44     47   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   45     48   
            builder,
   46         -
            ::http::header::CONTENT_TYPE,
          49  +
            ::http_1x::header::CONTENT_TYPE,
   47     50   
            "application/cbor",
   48     51   
        );
   49     52   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     53   
            builder,
   51         -
            ::http::header::HeaderName::from_static("smithy-protocol"),
          54  +
            ::http_1x::header::HeaderName::from_static("smithy-protocol"),
   52     55   
            "rpc-v2-cbor",
   53     56   
        );
   54     57   
        let http_status: u16 = 200;
   55     58   
        builder = builder.status(http_status);
   56     59   
        let payload =
   57     60   
            crate::protocol_serde::shape_single_member_struct_operation_output::ser_single_member_struct_operation_output_output_output(&output)?
   58     61   
        ;
   59     62   
        let content_length = payload.len();
   60     63   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   61     64   
            builder,
   62         -
            ::http::header::CONTENT_LENGTH,
          65  +
            ::http_1x::header::CONTENT_LENGTH,
   63     66   
            content_length,
   64     67   
        );
   65     68   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
   66     69   
        builder.body(body)?
   67     70   
    })
   68     71   
}
   69     72   
   70     73   
pub(crate) fn de_single_member_struct_operation(
   71     74   
    value: &[u8],
   72     75   
    mut builder: crate::input::single_member_struct_operation_input::Builder,

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response/rust-server-codegen/src/protocol_serde/shape_streaming_operation.rs

@@ -1,1 +118,122 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_streaming_operation_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           4  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::StreamingOperationInput,
    7      7   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10     10   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11         -
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
          11  +
    B: ::http_body_1x::Body<Data = ::bytes::Bytes>
          12  +
        + ::std::marker::Send
          13  +
        + ::std::marker::Sync
          14  +
        + 'static,
          15  +
    B::Error: Into<::aws_smithy_types::body::Error> + 'static,
          16  +
   12     17   
    B::Data: Send,
   13     18   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
   14     19   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   15     20   
{
   16     21   
    Ok({
   17     22   
        #[allow(unused_mut)]
   18     23   
        let mut input = crate::input::streaming_operation_input::Builder::default();
   19     24   
        #[allow(unused_variables)]
   20     25   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     26   
            uri, headers, body, ..
   22     27   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   23     28   
        if let Some(value) = {
   24     29   
            let mut receiver =
   25     30   
                crate::protocol_serde::shape_streaming_operation_input::de_events_payload(
   26         -
                    &mut body.into().into_inner(),
          31  +
                    &mut ::aws_smithy_types::body::SdkBody::from_body_1_x(body),
   27     32   
                )?;
   28     33   
            if let Some(_initial_event) = receiver
   29     34   
                                                .try_recv_initial(::aws_smithy_http::event_stream::InitialMessageType::Request)
   30     35   
                                                .await
   31     36   
                                                .map_err(
   32     37   
                                                    |ev_error| ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::ConstraintViolation(
   33     38   
                                                        #[allow(clippy::useless_conversion)]
   34     39   
                                                        format!("{ev_error}").into()
   35     40   
                                                    )
   36     41   
                                                )? {
   37     42   
                                                
   38     43   
                                            }
   39     44   
            Some(receiver)
   40     45   
        } {
   41     46   
            input = input.set_events(value)
   42     47   
        }
   43     48   
        input.build()?
   44     49   
    })
   45     50   
}
   46     51   
   47     52   
#[allow(clippy::unnecessary_wraps)]
   48     53   
pub fn ser_streaming_operation_http_response(
   49     54   
    #[allow(unused_variables)] output: crate::output::StreamingOperationOutput,
   50     55   
) -> std::result::Result<
   51     56   
    ::aws_smithy_http_server::response::Response,
   52     57   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   53     58   
> {
   54     59   
    Ok({
   55     60   
        #[allow(unused_mut)]
   56         -
        let mut builder = ::http::Response::builder();
          61  +
        let mut builder = ::http_1x::Response::builder();
   57     62   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   58     63   
            builder,
   59         -
            ::http::header::CONTENT_TYPE,
          64  +
            ::http_1x::header::CONTENT_TYPE,
   60     65   
            "application/vnd.amazon.eventstream",
   61     66   
        );
   62     67   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   63     68   
            builder,
   64         -
            ::http::header::HeaderName::from_static("smithy-protocol"),
          69  +
            ::http_1x::header::HeaderName::from_static("smithy-protocol"),
   65     70   
            "rpc-v2-cbor",
   66     71   
        );
   67     72   
        let http_status: u16 = 200;
   68     73   
        builder = builder.status(http_status);
   69         -
        let body = ::aws_smithy_http_server::body::boxed(
   70         -
            ::aws_smithy_http_server::body::Body::wrap_stream({
          74  +
        let body =
          75  +
            ::aws_smithy_http_server::body::boxed(::aws_smithy_http_server::body::wrap_stream({
   71     76   
                let error_marshaller = crate::event_stream_serde::EventsErrorMarshaller::new();
   72     77   
                let marshaller = crate::event_stream_serde::EventsMarshaller::new();
   73     78   
                let signer = ::aws_smithy_eventstream::frame::NoOpSigner {};
   74     79   
                output
   75     80   
                    .events
   76     81   
                    .into_body_stream(marshaller, error_marshaller, signer)
   77         -
            }),
   78         -
        );
          82  +
            }));
   79     83   
        builder.body(body)?
   80     84   
    })
   81     85   
}
   82     86   
   83     87   
#[allow(clippy::unnecessary_wraps)]
   84     88   
pub fn ser_streaming_operation_http_error(
   85     89   
    error: &crate::error::StreamingOperationError,
   86     90   
) -> std::result::Result<
   87     91   
    ::aws_smithy_http_server::response::Response,
   88     92   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   89     93   
> {
   90     94   
    Ok({
   91     95   
        match error {
   92     96   
            crate::error::StreamingOperationError::ValidationException(output) => {
   93     97   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
   94     98   
                #[allow(unused_mut)]
   95         -
                let mut builder = ::http::Response::builder();
          99  +
                let mut builder = ::http_1x::Response::builder();
   96    100   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   97    101   
                    builder,
   98         -
                    ::http::header::CONTENT_TYPE,
         102  +
                    ::http_1x::header::CONTENT_TYPE,
   99    103   
                    "application/vnd.amazon.eventstream",
  100    104   
                );
  101    105   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  102    106   
                    builder,
  103         -
                    ::http::header::HeaderName::from_static("smithy-protocol"),
         107  +
                    ::http_1x::header::HeaderName::from_static("smithy-protocol"),
  104    108   
                    "rpc-v2-cbor",
  105    109   
                );
  106    110   
                let content_length = payload.len();
  107    111   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  108    112   
                    builder,
  109         -
                    ::http::header::CONTENT_LENGTH,
         113  +
                    ::http_1x::header::CONTENT_LENGTH,
  110    114   
                    content_length,
  111    115   
                );
  112    116   
                builder
  113    117   
                    .status(400)
  114    118   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  115    119   
            }
  116    120   
        }
  117    121   
    })
  118    122   
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response/rust-server-codegen/src/protocol_serde/shape_streaming_operation_with_initial_data.rs

@@ -1,1 +137,141 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_streaming_operation_with_initial_data_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           4  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::StreamingOperationWithInitialDataInput,
    7      7   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10     10   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11         -
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
          11  +
    B: ::http_body_1x::Body<Data = ::bytes::Bytes>
          12  +
        + ::std::marker::Send
          13  +
        + ::std::marker::Sync
          14  +
        + 'static,
          15  +
    B::Error: Into<::aws_smithy_types::body::Error> + 'static,
          16  +
   12     17   
    B::Data: Send,
   13     18   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
   14     19   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   15     20   
{
   16     21   
    Ok({
   17     22   
        #[allow(unused_mut)]
   18     23   
        let mut input =
   19     24   
            crate::input::streaming_operation_with_initial_data_input::Builder::default();
   20     25   
        #[allow(unused_variables)]
   21     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   22     27   
            uri, headers, body, ..
   23     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   24     29   
        if let Some(value) = {
   25         -
            let mut receiver = crate::protocol_serde::shape_streaming_operation_with_initial_data_input::de_events_payload(&mut body.into().into_inner())?;
          30  +
            let mut receiver = crate::protocol_serde::shape_streaming_operation_with_initial_data_input::de_events_payload(&mut ::aws_smithy_types::body::SdkBody::from_body_1_x(body))?;
   26     31   
            if let Some(_initial_event) = receiver
   27     32   
                                                .try_recv_initial(::aws_smithy_http::event_stream::InitialMessageType::Request)
   28     33   
                                                .await
   29     34   
                                                .map_err(
   30     35   
                                                    |ev_error| ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::ConstraintViolation(
   31     36   
                                                        #[allow(clippy::useless_conversion)]
   32     37   
                                                        format!("{ev_error}").into()
   33     38   
                                                    )
   34     39   
                                                )? {
   35     40   
                                                input = crate::protocol_serde::shape_streaming_operation_with_initial_data::de_streaming_operation_with_initial_data(_initial_event.payload(), input)?;
   36     41   
                                            }
   37     42   
            Some(receiver)
   38     43   
        } {
   39     44   
            input = input.set_events(value)
   40     45   
        }
   41     46   
        input.build()?
   42     47   
    })
   43     48   
}
   44     49   
   45     50   
#[allow(clippy::unnecessary_wraps)]
   46     51   
pub fn ser_streaming_operation_with_initial_data_http_response(
   47     52   
    #[allow(unused_variables)] output: crate::output::StreamingOperationWithInitialDataOutput,
   48     53   
) -> std::result::Result<
   49     54   
    ::aws_smithy_http_server::response::Response,
   50     55   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   51     56   
> {
   52     57   
    Ok({
   53     58   
        #[allow(unused_mut)]
   54         -
        let mut builder = ::http::Response::builder();
          59  +
        let mut builder = ::http_1x::Response::builder();
   55     60   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   56     61   
            builder,
   57         -
            ::http::header::CONTENT_TYPE,
          62  +
            ::http_1x::header::CONTENT_TYPE,
   58     63   
            "application/vnd.amazon.eventstream",
   59     64   
        );
   60     65   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   61     66   
            builder,
   62         -
            ::http::header::HeaderName::from_static("smithy-protocol"),
          67  +
            ::http_1x::header::HeaderName::from_static("smithy-protocol"),
   63     68   
            "rpc-v2-cbor",
   64     69   
        );
   65     70   
        let http_status: u16 = 200;
   66     71   
        builder = builder.status(http_status);
   67         -
        let body = ::aws_smithy_http_server::body::boxed(
   68         -
            ::aws_smithy_http_server::body::Body::wrap_stream({
          72  +
        let body =
          73  +
            ::aws_smithy_http_server::body::boxed(::aws_smithy_http_server::body::wrap_stream({
   69     74   
                let error_marshaller = crate::event_stream_serde::EventsErrorMarshaller::new();
   70     75   
                let marshaller = crate::event_stream_serde::EventsMarshaller::new();
   71     76   
                let signer = ::aws_smithy_eventstream::frame::NoOpSigner {};
   72     77   
                output
   73     78   
                    .events
   74     79   
                    .into_body_stream(marshaller, error_marshaller, signer)
   75         -
            }),
   76         -
        );
          80  +
            }));
   77     81   
        builder.body(body)?
   78     82   
    })
   79     83   
}
   80     84   
   81     85   
#[allow(clippy::unnecessary_wraps)]
   82     86   
pub fn ser_streaming_operation_with_initial_data_http_error(
   83     87   
    error: &crate::error::StreamingOperationWithInitialDataError,
   84     88   
) -> std::result::Result<
   85     89   
    ::aws_smithy_http_server::response::Response,
   86     90   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   87     91   
> {
   88     92   
    Ok({
   89     93   
        match error {
   90     94   
            crate::error::StreamingOperationWithInitialDataError::ValidationException(output) => {
   91     95   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
   92     96   
                #[allow(unused_mut)]
   93         -
                let mut builder = ::http::Response::builder();
          97  +
                let mut builder = ::http_1x::Response::builder();
   94     98   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   95     99   
                    builder,
   96         -
                    ::http::header::CONTENT_TYPE,
         100  +
                    ::http_1x::header::CONTENT_TYPE,
   97    101   
                    "application/vnd.amazon.eventstream",
   98    102   
                );
   99    103   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  100    104   
                    builder,
  101         -
                    ::http::header::HeaderName::from_static("smithy-protocol"),
         105  +
                    ::http_1x::header::HeaderName::from_static("smithy-protocol"),
  102    106   
                    "rpc-v2-cbor",
  103    107   
                );
  104    108   
                let content_length = payload.len();
  105    109   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  106    110   
                    builder,
  107         -
                    ::http::header::CONTENT_LENGTH,
         111  +
                    ::http_1x::header::CONTENT_LENGTH,
  108    112   
                    content_length,
  109    113   
                );
  110    114   
                builder
  111    115   
                    .status(400)
  112    116   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  113    117   
            }
  114    118   
        }
  115    119   
    })
  116    120   
}
  117    121   

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response/rust-server-codegen/src/protocol_serde/shape_streaming_operation_with_initial_response.rs

@@ -1,1 +118,122 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_streaming_operation_with_initial_response_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           4  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::StreamingOperationWithInitialResponseInput,
    7      7   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10     10   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11         -
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
          11  +
    B: ::http_body_1x::Body<Data = ::bytes::Bytes>
          12  +
        + ::std::marker::Send
          13  +
        + ::std::marker::Sync
          14  +
        + 'static,
          15  +
    B::Error: Into<::aws_smithy_types::body::Error> + 'static,
          16  +
   12     17   
    B::Data: Send,
   13     18   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
   14     19   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   15     20   
{
   16     21   
    Ok({
   17     22   
        #[allow(unused_mut)]
   18     23   
        let mut input =
   19     24   
            crate::input::streaming_operation_with_initial_response_input::Builder::default();
   20     25   
        #[allow(unused_variables)]
   21     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   22     27   
            uri, headers, body, ..
   23     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   24     29   
        if let Some(value) = {
   25         -
            let mut receiver = crate::protocol_serde::shape_streaming_operation_with_initial_response_input::de_events_payload(&mut body.into().into_inner())?;
          30  +
            let mut receiver = crate::protocol_serde::shape_streaming_operation_with_initial_response_input::de_events_payload(&mut ::aws_smithy_types::body::SdkBody::from_body_1_x(body))?;
   26     31   
            if let Some(_initial_event) = receiver
   27     32   
                                                .try_recv_initial(::aws_smithy_http::event_stream::InitialMessageType::Request)
   28     33   
                                                .await
   29     34   
                                                .map_err(
   30     35   
                                                    |ev_error| ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::ConstraintViolation(
   31     36   
                                                        #[allow(clippy::useless_conversion)]
   32     37   
                                                        format!("{ev_error}").into()
   33     38   
                                                    )
   34     39   
                                                )? {
   35     40   
                                                
   36     41   
                                            }
   37     42   
            Some(receiver)
   38     43   
        } {
   39     44   
            input = input.set_events(value)
   40     45   
        }
   41     46   
        input.build()?
   42     47   
    })
   43     48   
}
   44     49   
   45     50   
#[allow(clippy::unnecessary_wraps)]
   46     51   
pub fn ser_streaming_operation_with_initial_response_http_response(
   47     52   
    #[allow(unused_variables)] output: crate::output::StreamingOperationWithInitialResponseOutput,
   48     53   
) -> std::result::Result<
   49     54   
    ::aws_smithy_http_server::response::Response,
   50     55   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   51     56   
> {
   52     57   
    Ok({
   53     58   
        #[allow(unused_mut)]
   54         -
        let mut builder = ::http::Response::builder();
          59  +
        let mut builder = ::http_1x::Response::builder();
   55     60   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   56     61   
            builder,
   57         -
            ::http::header::CONTENT_TYPE,
          62  +
            ::http_1x::header::CONTENT_TYPE,
   58     63   
            "application/vnd.amazon.eventstream",
   59     64   
        );
   60     65   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   61     66   
            builder,
   62         -
            ::http::header::HeaderName::from_static("smithy-protocol"),
          67  +
            ::http_1x::header::HeaderName::from_static("smithy-protocol"),
   63     68   
            "rpc-v2-cbor",
   64     69   
        );
   65     70   
        let http_status: u16 = 200;
   66     71   
        builder = builder.status(http_status);
   67         -
        let body = ::aws_smithy_http_server::body::boxed(
   68         -
            ::aws_smithy_http_server::body::Body::wrap_stream({
          72  +
        let body =
          73  +
            ::aws_smithy_http_server::body::boxed(::aws_smithy_http_server::body::wrap_stream({
   69     74   
                let error_marshaller = crate::event_stream_serde::EventsErrorMarshaller::new();
   70     75   
                let marshaller = crate::event_stream_serde::EventsMarshaller::new();
   71     76   
                let signer = ::aws_smithy_eventstream::frame::NoOpSigner {};
   72     77   
                output
   73     78   
                    .events
   74     79   
                    .into_body_stream(marshaller, error_marshaller, signer)
   75         -
            }),
   76         -
        );
          80  +
            }));
   77     81   
        builder.body(body)?
   78     82   
    })
   79     83   
}
   80     84   
   81     85   
#[allow(clippy::unnecessary_wraps)]
   82     86   
pub fn ser_streaming_operation_with_initial_response_http_error(
   83     87   
    error: &crate::error::StreamingOperationWithInitialResponseError,
   84     88   
) -> std::result::Result<
   85     89   
    ::aws_smithy_http_server::response::Response,
   86     90   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   87     91   
> {
   88     92   
    Ok({
   89     93   
        match error {
   90     94   
            crate::error::StreamingOperationWithInitialResponseError::ValidationException(
   91     95   
                output,
   92     96   
            ) => {
   93     97   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
   94     98   
                #[allow(unused_mut)]
   95         -
                let mut builder = ::http::Response::builder();
          99  +
                let mut builder = ::http_1x::Response::builder();
   96    100   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   97    101   
                    builder,
   98         -
                    ::http::header::CONTENT_TYPE,
         102  +
                    ::http_1x::header::CONTENT_TYPE,
   99    103   
                    "application/vnd.amazon.eventstream",
  100    104   
                );
  101    105   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  102    106   
                    builder,
  103         -
                    ::http::header::HeaderName::from_static("smithy-protocol"),
         107  +
                    ::http_1x::header::HeaderName::from_static("smithy-protocol"),
  104    108   
                    "rpc-v2-cbor",
  105    109   
                );
  106    110   
                let content_length = payload.len();
  107    111   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  108    112   
                    builder,
  109         -
                    ::http::header::CONTENT_LENGTH,
         113  +
                    ::http_1x::header::CONTENT_LENGTH,
  110    114   
                    content_length,
  111    115   
                );
  112    116   
                builder
  113    117   
                    .status(400)
  114    118   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  115    119   
            }
  116    120   
        }
  117    121   
    })
  118    122   
}

tmp-codegen-diff/codegen-server-test/rpcv2Cbor_extras_no_initial_response/rust-server-codegen/src/protocol_serde/shape_streaming_operation_with_optional_data.rs

@@ -1,1 +137,141 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_streaming_operation_with_optional_data_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           4  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::StreamingOperationWithOptionalDataInput,
    7      7   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10     10   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11         -
    B: Into<::aws_smithy_types::byte_stream::ByteStream>,
          11  +
    B: ::http_body_1x::Body<Data = ::bytes::Bytes>
          12  +
        + ::std::marker::Send
          13  +
        + ::std::marker::Sync
          14  +
        + 'static,
          15  +
    B::Error: Into<::aws_smithy_types::body::Error> + 'static,
          16  +
   12     17   
    B::Data: Send,
   13     18   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
   14     19   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   15     20   
{
   16     21   
    Ok({
   17     22   
        #[allow(unused_mut)]
   18     23   
        let mut input =
   19     24   
            crate::input::streaming_operation_with_optional_data_input::Builder::default();
   20     25   
        #[allow(unused_variables)]
   21     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   22     27   
            uri, headers, body, ..
   23     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   24     29   
        if let Some(value) = {
   25         -
            let mut receiver = crate::protocol_serde::shape_streaming_operation_with_optional_data_input::de_events_payload(&mut body.into().into_inner())?;
          30  +
            let mut receiver = crate::protocol_serde::shape_streaming_operation_with_optional_data_input::de_events_payload(&mut ::aws_smithy_types::body::SdkBody::from_body_1_x(body))?;
   26     31   
            if let Some(_initial_event) = receiver
   27     32   
                                                .try_recv_initial(::aws_smithy_http::event_stream::InitialMessageType::Request)
   28     33   
                                                .await
   29     34   
                                                .map_err(
   30     35   
                                                    |ev_error| ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::ConstraintViolation(
   31     36   
                                                        #[allow(clippy::useless_conversion)]
   32     37   
                                                        format!("{ev_error}").into()
   33     38   
                                                    )
   34     39   
                                                )? {
   35     40   
                                                input = crate::protocol_serde::shape_streaming_operation_with_optional_data::de_streaming_operation_with_optional_data(_initial_event.payload(), input)?;
   36     41   
                                            }
   37     42   
            Some(receiver)
   38     43   
        } {
   39     44   
            input = input.set_events(value)
   40     45   
        }
   41     46   
        input.build()?
   42     47   
    })
   43     48   
}
   44     49   
   45     50   
#[allow(clippy::unnecessary_wraps)]
   46     51   
pub fn ser_streaming_operation_with_optional_data_http_response(
   47     52   
    #[allow(unused_variables)] output: crate::output::StreamingOperationWithOptionalDataOutput,
   48     53   
) -> std::result::Result<
   49     54   
    ::aws_smithy_http_server::response::Response,
   50     55   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   51     56   
> {
   52     57   
    Ok({
   53     58   
        #[allow(unused_mut)]
   54         -
        let mut builder = ::http::Response::builder();
          59  +
        let mut builder = ::http_1x::Response::builder();
   55     60   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   56     61   
            builder,
   57         -
            ::http::header::CONTENT_TYPE,
          62  +
            ::http_1x::header::CONTENT_TYPE,
   58     63   
            "application/vnd.amazon.eventstream",
   59     64   
        );
   60     65   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   61     66   
            builder,
   62         -
            ::http::header::HeaderName::from_static("smithy-protocol"),
          67  +
            ::http_1x::header::HeaderName::from_static("smithy-protocol"),
   63     68   
            "rpc-v2-cbor",
   64     69   
        );
   65     70   
        let http_status: u16 = 200;
   66     71   
        builder = builder.status(http_status);
   67         -
        let body = ::aws_smithy_http_server::body::boxed(
   68         -
            ::aws_smithy_http_server::body::Body::wrap_stream({
          72  +
        let body =
          73  +
            ::aws_smithy_http_server::body::boxed(::aws_smithy_http_server::body::wrap_stream({
   69     74   
                let error_marshaller = crate::event_stream_serde::EventsErrorMarshaller::new();
   70     75   
                let marshaller = crate::event_stream_serde::EventsMarshaller::new();
   71     76   
                let signer = ::aws_smithy_eventstream::frame::NoOpSigner {};
   72     77   
                output
   73     78   
                    .events
   74     79   
                    .into_body_stream(marshaller, error_marshaller, signer)
   75         -
            }),
   76         -
        );
          80  +
            }));
   77     81   
        builder.body(body)?
   78     82   
    })
   79     83   
}
   80     84   
   81     85   
#[allow(clippy::unnecessary_wraps)]
   82     86   
pub fn ser_streaming_operation_with_optional_data_http_error(
   83     87   
    error: &crate::error::StreamingOperationWithOptionalDataError,
   84     88   
) -> std::result::Result<
   85     89   
    ::aws_smithy_http_server::response::Response,
   86     90   
    ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::ResponseRejection,
   87     91   
> {
   88     92   
    Ok({
   89     93   
        match error {
   90     94   
            crate::error::StreamingOperationWithOptionalDataError::ValidationException(output) => {
   91     95   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
   92     96   
                #[allow(unused_mut)]
   93         -
                let mut builder = ::http::Response::builder();
          97  +
                let mut builder = ::http_1x::Response::builder();
   94     98   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   95     99   
                    builder,
   96         -
                    ::http::header::CONTENT_TYPE,
         100  +
                    ::http_1x::header::CONTENT_TYPE,
   97    101   
                    "application/vnd.amazon.eventstream",
   98    102   
                );
   99    103   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  100    104   
                    builder,
  101         -
                    ::http::header::HeaderName::from_static("smithy-protocol"),
         105  +
                    ::http_1x::header::HeaderName::from_static("smithy-protocol"),
  102    106   
                    "rpc-v2-cbor",
  103    107   
                );
  104    108   
                let content_length = payload.len();
  105    109   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  106    110   
                    builder,
  107         -
                    ::http::header::CONTENT_LENGTH,
         111  +
                    ::http_1x::header::CONTENT_LENGTH,
  108    112   
                    content_length,
  109    113   
                );
  110    114   
                builder
  111    115   
                    .status(400)
  112    116   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
  113    117   
            }
  114    118   
        }
  115    119   
    })
  116    120   
}
  117    121