Server Test

Server Test

rev. ce76c569583a3fdee1e9d39e082a8d5efd7b13b7 (ignoring whitespace)

Files changed:

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

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

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

@@ -1,1 +1241,368 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[cfg(test)]
    3         -
#[allow(unreachable_code, unused_variables)]
    4         -
mod server_case_insensitive_error_operation_test {
    5         -
    /// Upper case error modeled lower case.
    6         -
    /// Test ID: ServiceLevelErrorServer
    7         -
    #[::tokio::test]
    8         -
    async fn service_level_error_server_response() {
    9         -
        let output = crate::error::ExtraError {};
   10         -
        let output = crate::error::CaseInsensitiveErrorOperationError::ExtraError(output);
   11         -
        use ::aws_smithy_http_server::response::IntoResponse;
   12         -
        let http_response = output.into_response();
   13         -
        ::pretty_assertions::assert_eq!(
   14         -
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
   15         -
            http_response.status()
   16         -
        );
   17         -
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
   18         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
   19         -
            http_response.headers(),
   20         -
            expected_headers,
   21         -
        ));
   22         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
   23         -
            .await
   24         -
            .expect("unable to extract body to bytes");
   25         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
   26         -
            &body,
   27         -
            "{}",
   28         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
   29         -
        ));
   30         -
    }
   31         -
}
   32         -
#[cfg(test)]
   33         -
#[allow(unreachable_code, unused_variables)]
   34         -
mod server_empty_struct_with_content_on_wire_op_test {
   35         -
    /// Upper case error modeled lower case.
   36         -
    /// Test ID: ServiceLevelErrorServer
   37         -
    #[::tokio::test]
   38         -
    async fn service_level_error_server_response() {
   39         -
        let output = crate::error::ExtraError {};
   40         -
        let output = crate::error::EmptyStructWithContentOnWireOpError::ExtraError(output);
   41         -
        use ::aws_smithy_http_server::response::IntoResponse;
   42         -
        let http_response = output.into_response();
   43         -
        ::pretty_assertions::assert_eq!(
   44         -
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
   45         -
            http_response.status()
   46         -
        );
   47         -
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
   48         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
   49         -
            http_response.headers(),
   50         -
            expected_headers,
   51         -
        ));
   52         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
   53         -
            .await
   54         -
            .expect("unable to extract body to bytes");
   55         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
   56         -
            &body,
   57         -
            "{}",
   58         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
   59         -
        ));
           2  +
static CONTENT_TYPE_HTTPSTRINGPAYLOAD2: ::once_cell::sync::Lazy<::mime::Mime> =
           3  +
    ::once_cell::sync::Lazy::new(|| {
           4  +
        "text/plain"
           5  +
            .parse::<::mime::Mime>()
           6  +
            .expect("BUG: MIME parsing failed, content_type is not valid")
           7  +
    });
           8  +
::pin_project_lite::pin_project! {
           9  +
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
          10  +
    /// [`HttpStringPayload2Input`](crate::input::HttpStringPayload2Input) using modelled bindings.
          11  +
    pub struct HttpStringPayload2InputFuture {
          12  +
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::HttpStringPayload2Input, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
   60     13   
    }
   61     14   
}
   62         -
#[cfg(test)]
   63         -
#[allow(unreachable_code, unused_variables)]
   64         -
mod server_enum_query_test {
   65         -
    /// Test ID: EnumQueryRequest
   66         -
    #[::tokio::test]
   67         -
    async fn enum_query_request_request() {
   68         -
        #[allow(unused_mut)]
   69         -
        let mut http_request = http::Request::builder()
   70         -
            .uri("/foo/enumvalue")
   71         -
            .method("GET")
   72         -
            .body(::aws_smithy_http_server::body::Body::empty())
   73         -
            .unwrap();
   74         -
        #[allow(unused_mut)]
   75         -
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
   76         -
        let config = crate::service::RestJsonExtrasConfig::builder().build();
   77         -
        let service =
   78         -
            crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
   79         -
                .enum_query(move |input: crate::input::EnumQueryInput| {
   80         -
                    let sender = sender.clone();
   81         -
                    async move {
   82         -
                        let result = {
   83         -
                            let expected = crate::input::EnumQueryInput {
   84         -
                                r#enum: "enumvalue"
   85         -
                                    .parse::<crate::model::StringEnum>()
   86         -
                                    .expect("static value validated to member"),
   87         -
                            };
   88         -
                            ::pretty_assertions::assert_eq!(input, expected);
   89         -
                            let response = crate::output::EnumQueryOutput {};
   90         -
                            Ok(response)
   91         -
                        };
   92         -
                        sender.send(()).await.expect("receiver dropped early");
   93         -
                        result
   94         -
                    }
   95         -
                })
   96         -
                .build_unchecked();
   97         -
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
   98         -
            .await
   99         -
            .expect("unable to make an HTTP request");
  100         -
        assert!(receiver.recv().await.is_some());
  101         -
    }
  102         -
    /// Upper case error modeled lower case.
  103         -
    /// Test ID: ServiceLevelErrorServer
  104         -
    #[::tokio::test]
  105         -
    async fn service_level_error_server_response() {
  106         -
        let output = crate::error::ExtraError {};
  107         -
        let output = crate::error::EnumQueryError::ExtraError(output);
  108         -
        use ::aws_smithy_http_server::response::IntoResponse;
  109         -
        let http_response = output.into_response();
  110         -
        ::pretty_assertions::assert_eq!(
  111         -
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
  112         -
            http_response.status()
  113         -
        );
  114         -
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
  115         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  116         -
            http_response.headers(),
  117         -
            expected_headers,
  118         -
        ));
  119         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
  120         -
            .await
  121         -
            .expect("unable to extract body to bytes");
  122         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  123         -
            &body,
  124         -
            "{}",
  125         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  126         -
        ));
          15  +
          16  +
impl std::future::Future for HttpStringPayload2InputFuture {
          17  +
    type Output = Result<
          18  +
        crate::input::HttpStringPayload2Input,
          19  +
        ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
          20  +
    >;
          21  +
          22  +
    fn poll(
          23  +
        self: std::pin::Pin<&mut Self>,
          24  +
        cx: &mut std::task::Context<'_>,
          25  +
    ) -> std::task::Poll<Self::Output> {
          26  +
        let this = self.project();
          27  +
        this.inner.as_mut().poll(cx)
  127     28   
    }
  128     29   
}
  129         -
#[cfg(test)]
  130         -
#[allow(unreachable_code, unused_variables)]
  131         -
mod server_escaped_string_values_test {
  132         -
    /// Test ID: EscapedStringValuesRequest
  133         -
    #[::tokio::test]
  134         -
    async fn escaped_string_values_request_request() {
  135         -
        #[allow(unused_mut)]
  136         -
        let mut http_request = http::Request::builder()
  137         -
            .uri("/escaped-string-values")
  138         -
            .method("POST")
  139         -
            .header("Content-Type", "application/json")
  140         -
            .body(::aws_smithy_http_server::body::Body::from(
  141         -
                ::bytes::Bytes::from_static(
  142         -
                    "{\"enum\":\"has\\\"quotes\",\"also\\\"has\\\"quotes\":\"test\"}".as_bytes(),
  143         -
                ),
  144         -
            ))
  145         -
            .unwrap();
  146         -
        #[allow(unused_mut)]
  147         -
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  148         -
        let config = crate::service::RestJsonExtrasConfig::builder().build();
  149         -
        let service =
  150         -
            crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
  151         -
                .escaped_string_values(move |input: crate::input::EscapedStringValuesInput| {
  152         -
                    let sender = sender.clone();
  153         -
                    async move {
  154         -
                        let result = {
  155         -
                            let expected = crate::input::EscapedStringValuesInput {
  156         -
                                r#enum: ::std::option::Option::Some(
  157         -
                                    "has\"quotes"
  158         -
                                        .parse::<crate::model::EnumWithEscapedChars>()
  159         -
                                        .expect("static value validated to member"),
  160         -
                                ),
  161         -
                                some_string: ::std::option::Option::Some("test".to_owned()),
  162         -
                            };
  163         -
                            ::pretty_assertions::assert_eq!(input, expected);
  164         -
                            let response = crate::output::EscapedStringValuesOutput {
  165         -
                                r#enum: ::std::option::Option::None,
  166         -
                                some_string: ::std::option::Option::None,
  167         -
                            };
  168         -
                            Ok(response)
  169         -
                        };
  170         -
                        sender.send(()).await.expect("receiver dropped early");
  171         -
                        result
          30  +
          31  +
impl<B>
          32  +
    ::aws_smithy_http_server::request::FromRequest<
          33  +
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
          34  +
        B,
          35  +
    > for crate::input::HttpStringPayload2Input
          36  +
where
          37  +
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          38  +
    B: 'static,
          39  +
          40  +
    B::Data: Send,
          41  +
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          42  +
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          43  +
{
          44  +
    type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
          45  +
    type Future = HttpStringPayload2InputFuture;
          46  +
          47  +
    fn from_request(request: ::http::Request<B>) -> Self::Future {
          48  +
        let fut = async move {
          49  +
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
          50  +
                request.headers(),
          51  +
                &CONTENT_TYPE_HTTPSTRINGPAYLOAD2,
          52  +
            ) {
          53  +
                return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
  172     54   
            }
  173         -
                })
  174         -
                .build_unchecked();
  175         -
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
          55  +
            crate::protocol_serde::shape_http_string_payload2::de_http_string_payload2_http_request(
          56  +
                request,
          57  +
            )
  176     58   
            .await
  177         -
            .expect("unable to make an HTTP request");
  178         -
        assert!(receiver.recv().await.is_some());
  179         -
    }
  180         -
    /// Test ID: EscapedStringValuesResponse
  181         -
    #[::tokio::test]
  182         -
    async fn escaped_string_values_response_response() {
  183         -
        let output = crate::output::EscapedStringValuesOutput {
  184         -
            r#enum: ::std::option::Option::Some(
  185         -
                "has\"quotes"
  186         -
                    .parse::<crate::model::EnumWithEscapedChars>()
  187         -
                    .expect("static value validated to member"),
  188         -
            ),
  189         -
            some_string: ::std::option::Option::Some("test".to_owned()),
          59  +
            .map_err(Into::into)
  190     60   
        };
  191         -
        use ::aws_smithy_http_server::response::IntoResponse;
  192         -
        let http_response = output.into_response();
  193         -
        ::pretty_assertions::assert_eq!(
  194         -
            http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
  195         -
            http_response.status()
  196         -
        );
  197         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
  198         -
            .await
  199         -
            .expect("unable to extract body to bytes");
  200         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  201         -
            &body,
  202         -
            "{\"enum\":\"has\\\"quotes\",\"also\\\"has\\\"quotes\":\"test\"}",
  203         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  204         -
        ));
  205         -
    }
  206         -
    /// Upper case error modeled lower case.
  207         -
    /// Test ID: ServiceLevelErrorServer
  208         -
    #[::tokio::test]
  209         -
    async fn service_level_error_server_response() {
  210         -
        let output = crate::error::ExtraError {};
  211         -
        let output = crate::error::EscapedStringValuesError::ExtraError(output);
  212         -
        use ::aws_smithy_http_server::response::IntoResponse;
  213         -
        let http_response = output.into_response();
  214         -
        ::pretty_assertions::assert_eq!(
  215         -
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
  216         -
            http_response.status()
  217         -
        );
  218         -
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
  219         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  220         -
            http_response.headers(),
  221         -
            expected_headers,
  222         -
        ));
  223         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
  224         -
            .await
  225         -
            .expect("unable to extract body to bytes");
  226         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  227         -
            &body,
  228         -
            "{}",
  229         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  230         -
        ));
  231         -
    }
  232         -
}
  233         -
#[cfg(test)]
  234         -
#[allow(unreachable_code, unused_variables)]
  235         -
mod server_http_enum_payload2_test {
  236         -
    /// Test ID: RestJsonEnumPayloadRequest2
  237         -
    #[::tokio::test]
  238         -
    async fn rest_json_enum_payload_request2_request() {
  239         -
        #[allow(unused_mut)]
  240         -
        let mut http_request = http::Request::builder()
  241         -
            .uri("/EnumPayload2")
  242         -
            .method("POST")
  243         -
            .header("Content-Type", "text/plain")
  244         -
            .body(::aws_smithy_http_server::body::Body::from(
  245         -
                ::bytes::Bytes::from_static("enumvalue".as_bytes()),
  246         -
            ))
  247         -
            .unwrap();
  248         -
        #[allow(unused_mut)]
  249         -
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  250         -
        let config = crate::service::RestJsonExtrasConfig::builder().build();
  251         -
        let service =
  252         -
            crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
  253         -
                .http_enum_payload2(move |input: crate::input::HttpEnumPayload2Input| {
  254         -
                    let sender = sender.clone();
  255         -
                    async move {
  256         -
                        let result = {
  257         -
                            let expected = crate::input::HttpEnumPayload2Input {
  258         -
                                payload: ::std::option::Option::Some(
  259         -
                                    "enumvalue"
  260         -
                                        .parse::<crate::model::StringEnum>()
  261         -
                                        .expect("static value validated to member"),
  262         -
                                ),
  263         -
                            };
  264         -
                            ::pretty_assertions::assert_eq!(input, expected);
  265         -
                            let response = crate::output::HttpEnumPayload2Output {
  266         -
                                payload: ::std::option::Option::None,
  267         -
                            };
  268         -
                            Ok(response)
  269         -
                        };
  270         -
                        sender.send(()).await.expect("receiver dropped early");
  271         -
                        result
  272         -
                    }
  273         -
                })
  274         -
                .build_unchecked();
  275         -
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  276         -
            .await
  277         -
            .expect("unable to make an HTTP request");
  278         -
        assert!(receiver.recv().await.is_some());
  279         -
    }
  280         -
    /// Test ID: RestJsonEnumPayloadResponse2
  281         -
    #[::tokio::test]
  282         -
    async fn rest_json_enum_payload_response2_response() {
  283         -
        let output = crate::output::HttpEnumPayload2Output {
  284         -
            payload: ::std::option::Option::Some(
  285         -
                "enumvalue"
  286         -
                    .parse::<crate::model::StringEnum>()
  287         -
                    .expect("static value validated to member"),
  288         -
            ),
  289         -
        };
  290         -
        use ::aws_smithy_http_server::response::IntoResponse;
  291         -
        let http_response = output.into_response();
  292         -
        ::pretty_assertions::assert_eq!(
  293         -
            http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
  294         -
            http_response.status()
  295         -
        );
  296         -
        let expected_headers = [("Content-Type", "text/plain")];
  297         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  298         -
            http_response.headers(),
  299         -
            expected_headers,
  300         -
        ));
  301         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
  302         -
            .await
  303         -
            .expect("unable to extract body to bytes");
  304         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  305         -
            &body,
  306         -
            "enumvalue",
  307         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  308         -
        ));
  309         -
    }
  310         -
    /// Upper case error modeled lower case.
  311         -
    /// Test ID: ServiceLevelErrorServer
  312         -
    #[::tokio::test]
  313         -
    async fn service_level_error_server_response() {
  314         -
        let output = crate::error::ExtraError {};
  315         -
        let output = crate::error::HttpEnumPayload2Error::ExtraError(output);
  316         -
        use ::aws_smithy_http_server::response::IntoResponse;
  317         -
        let http_response = output.into_response();
  318         -
        ::pretty_assertions::assert_eq!(
  319         -
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
  320         -
            http_response.status()
  321         -
        );
  322         -
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
  323         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  324         -
            http_response.headers(),
  325         -
            expected_headers,
  326         -
        ));
  327         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
  328         -
            .await
  329         -
            .expect("unable to extract body to bytes");
  330         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  331         -
            &body,
  332         -
            "{}",
  333         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  334         -
        ));
  335         -
    }
  336         -
}
  337         -
#[cfg(test)]
  338         -
#[allow(unreachable_code, unused_variables)]
  339         -
mod server_http_payload_traits2_test {
  340         -
    /// Servers must accept no content type for blob inputs
  341         -
    /// without the media type trait.
  342         -
    /// Test ID: RestJsonHttpPayloadTraitsWithBlobAcceptsNoContentType
  343         -
    #[::tokio::test]
  344         -
    async fn rest_json_http_payload_traits_with_blob_accepts_no_content_type_request() {
  345         -
        #[allow(unused_mut)]
  346         -
        let mut http_request = http::Request::builder()
  347         -
            .uri("/HttpPayloadTraits")
  348         -
            .method("POST")
  349         -
            .header("X-Foo", "Foo")
  350         -
            .body(::aws_smithy_http_server::body::Body::from(
  351         -
                ::bytes::Bytes::from_static("This is definitely a jpeg".as_bytes()),
  352         -
            ))
  353         -
            .unwrap();
  354         -
        #[allow(unused_mut)]
  355         -
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  356         -
        let config = crate::service::RestJsonExtrasConfig::builder().build();
  357         -
        let service =
  358         -
            crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
  359         -
                .http_payload_traits2(move |input: crate::input::HttpPayloadTraits2Input| {
  360         -
                    let sender = sender.clone();
  361         -
                    async move {
  362         -
                        let result = {
  363         -
                            let expected = crate::input::HttpPayloadTraits2Input {
  364         -
                                foo: ::std::option::Option::Some("Foo".to_owned()),
  365         -
                                blob: ::std::option::Option::Some(::aws_smithy_types::Blob::new(
  366         -
                                    "This is definitely a jpeg",
  367         -
                                )),
  368         -
                            };
  369         -
                            ::pretty_assertions::assert_eq!(input, expected);
  370         -
                            let response = crate::output::HttpPayloadTraits2Output {
  371         -
                                foo: ::std::option::Option::None,
  372         -
                                blob: ::std::option::Option::None,
  373         -
                            };
  374         -
                            Ok(response)
  375         -
                        };
  376         -
                        sender.send(()).await.expect("receiver dropped early");
  377         -
                        result
  378         -
                    }
  379         -
                })
  380         -
                .build_unchecked();
  381         -
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  382         -
            .await
  383         -
            .expect("unable to make an HTTP request");
  384         -
        assert!(receiver.recv().await.is_some());
  385         -
    }
  386         -
    /// Upper case error modeled lower case.
  387         -
    /// Test ID: ServiceLevelErrorServer
  388         -
    #[::tokio::test]
  389         -
    async fn service_level_error_server_response() {
  390         -
        let output = crate::error::ExtraError {};
  391         -
        let output = crate::error::HttpPayloadTraits2Error::ExtraError(output);
  392         -
        use ::aws_smithy_http_server::response::IntoResponse;
  393         -
        let http_response = output.into_response();
  394         -
        ::pretty_assertions::assert_eq!(
  395         -
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
  396         -
            http_response.status()
  397         -
        );
  398         -
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
  399         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  400         -
            http_response.headers(),
  401         -
            expected_headers,
  402         -
        ));
  403         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
  404         -
            .await
  405         -
            .expect("unable to extract body to bytes");
  406         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  407         -
            &body,
  408         -
            "{}",
  409         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  410         -
        ));
  411         -
    }
  412         -
}
  413         -
#[cfg(test)]
  414         -
#[allow(unreachable_code, unused_variables)]
  415         -
mod server_http_string_payload2_test {
  416         -
    /// Test ID: RestJsonStringPayloadRequest2
  417         -
    #[::tokio::test]
  418         -
    async fn rest_json_string_payload_request2_request() {
  419         -
        #[allow(unused_mut)]
  420         -
        let mut http_request = http::Request::builder()
  421         -
            .uri("/StringPayload2")
  422         -
            .method("POST")
  423         -
            .header("Content-Type", "text/plain")
  424         -
            .body(::aws_smithy_http_server::body::Body::from(
  425         -
                ::bytes::Bytes::from_static("rawstring".as_bytes()),
  426         -
            ))
  427         -
            .unwrap();
  428         -
        #[allow(unused_mut)]
  429         -
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  430         -
        let config = crate::service::RestJsonExtrasConfig::builder().build();
  431         -
        let service =
  432         -
            crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
  433         -
                .http_string_payload2(move |input: crate::input::HttpStringPayload2Input| {
  434         -
                    let sender = sender.clone();
  435         -
                    async move {
  436         -
                        let result = {
  437         -
                            let expected = crate::input::HttpStringPayload2Input {
  438         -
                                payload: ::std::option::Option::Some("rawstring".to_owned()),
  439         -
                            };
  440         -
                            ::pretty_assertions::assert_eq!(input, expected);
  441         -
                            let response = crate::output::HttpStringPayload2Output {
  442         -
                                payload: ::std::option::Option::None,
  443         -
                            };
  444         -
                            Ok(response)
  445         -
                        };
  446         -
                        sender.send(()).await.expect("receiver dropped early");
  447         -
                        result
  448         -
                    }
  449         -
                })
  450         -
                .build_unchecked();
  451         -
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  452         -
            .await
  453         -
            .expect("unable to make an HTTP request");
  454         -
        assert!(receiver.recv().await.is_some());
  455         -
    }
  456         -
    /// Test ID: RestJsonStringPayloadResponse2
  457         -
    #[::tokio::test]
  458         -
    async fn rest_json_string_payload_response2_response() {
  459         -
        let output = crate::output::HttpStringPayload2Output {
  460         -
            payload: ::std::option::Option::Some("rawstring".to_owned()),
  461         -
        };
  462         -
        use ::aws_smithy_http_server::response::IntoResponse;
  463         -
        let http_response = output.into_response();
  464         -
        ::pretty_assertions::assert_eq!(
  465         -
            http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
  466         -
            http_response.status()
  467         -
        );
  468         -
        let expected_headers = [("Content-Type", "text/plain")];
  469         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  470         -
            http_response.headers(),
  471         -
            expected_headers,
  472         -
        ));
  473         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
  474         -
            .await
  475         -
            .expect("unable to extract body to bytes");
  476         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  477         -
            &body,
  478         -
            "rawstring",
  479         -
            ::aws_smithy_protocol_test::MediaType::from("text/plain"),
  480         -
        ));
  481         -
    }
  482         -
    /// Upper case error modeled lower case.
  483         -
    /// Test ID: ServiceLevelErrorServer
  484         -
    #[::tokio::test]
  485         -
    async fn service_level_error_server_response() {
  486         -
        let output = crate::error::ExtraError {};
  487         -
        let output = crate::error::HttpStringPayload2Error::ExtraError(output);
  488         -
        use ::aws_smithy_http_server::response::IntoResponse;
  489         -
        let http_response = output.into_response();
  490         -
        ::pretty_assertions::assert_eq!(
  491         -
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
  492         -
            http_response.status()
  493         -
        );
  494         -
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
  495         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  496         -
            http_response.headers(),
  497         -
            expected_headers,
  498         -
        ));
  499         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
  500         -
            .await
  501         -
            .expect("unable to extract body to bytes");
  502         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  503         -
            &body,
  504         -
            "{}",
  505         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  506         -
        ));
  507         -
    }
  508         -
    /// Serializes a string in the HTTP payload without a content-type header
  509         -
    /// Test ID: RestJsonStringPayloadNoContentType2
  510         -
    #[::tokio::test]
  511         -
    async fn rest_json_string_payload_no_content_type2_malformed_request() {
  512         -
        {
  513         -
            #[allow(unused_mut)]
  514         -
            let mut http_request = http::Request::builder()
  515         -
                .uri("/StringPayload2")
  516         -
                .method("POST")
  517         -
                .body(::aws_smithy_http_server::body::Body::from(
  518         -
                    ::bytes::Bytes::from_static("rawstring".as_bytes()),
  519         -
                ))
  520         -
                .unwrap();
  521         -
            #[allow(unused_mut)]
  522         -
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  523         -
            let config = crate::service::RestJsonExtrasConfig::builder().build();
  524         -
            let service = crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
  525         -
                            .http_string_payload2(move |input: crate::input::HttpStringPayload2Input| {
  526         -
                                let sender = sender.clone();
  527         -
                                async move {
  528         -
                                    let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::HttpStringPayload2Output, crate::error::HttpStringPayload2Error> };
  529         -
                                    sender.send(()).await.expect("receiver dropped early");
  530         -
                                    result
  531         -
                                }
  532         -
                            })
  533         -
                            .build_unchecked();
  534         -
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  535         -
                .await
  536         -
                .expect("unable to make an HTTP request");
  537         -
            ::pretty_assertions::assert_eq!(
  538         -
                http::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
  539         -
                http_response.status()
  540         -
            );
  541         -
            let expected_headers = [("x-amzn-errortype", "UnsupportedMediaTypeException")];
  542         -
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  543         -
                http_response.headers(),
  544         -
                expected_headers,
  545         -
            ));
  546         -
        }
  547         -
    }
  548         -
    /// Serializes a string in the HTTP payload without the expected content-type header
  549         -
    /// Test ID: RestJsonStringPayloadWrongContentType2
  550         -
    #[::tokio::test]
  551         -
    async fn rest_json_string_payload_wrong_content_type2_malformed_request() {
  552         -
        {
  553         -
            #[allow(unused_mut)]
  554         -
            let mut http_request = http::Request::builder()
  555         -
                .uri("/StringPayload2")
  556         -
                .method("POST")
  557         -
                .header("Content-Type", "application/json")
  558         -
                .body(::aws_smithy_http_server::body::Body::from(
  559         -
                    ::bytes::Bytes::from_static("rawstring".as_bytes()),
  560         -
                ))
  561         -
                .unwrap();
  562         -
            #[allow(unused_mut)]
  563         -
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  564         -
            let config = crate::service::RestJsonExtrasConfig::builder().build();
  565         -
            let service = crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
  566         -
                            .http_string_payload2(move |input: crate::input::HttpStringPayload2Input| {
  567         -
                                let sender = sender.clone();
  568         -
                                async move {
  569         -
                                    let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::HttpStringPayload2Output, crate::error::HttpStringPayload2Error> };
  570         -
                                    sender.send(()).await.expect("receiver dropped early");
  571         -
                                    result
  572         -
                                }
  573         -
                            })
  574         -
                            .build_unchecked();
  575         -
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  576         -
                .await
  577         -
                .expect("unable to make an HTTP request");
  578         -
            ::pretty_assertions::assert_eq!(
  579         -
                http::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
  580         -
                http_response.status()
  581         -
            );
  582         -
            let expected_headers = [("x-amzn-errortype", "UnsupportedMediaTypeException")];
  583         -
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  584         -
                http_response.headers(),
  585         -
                expected_headers,
  586         -
            ));
  587         -
        }
  588         -
    }
  589         -
    /// Serializes a string in the HTTP payload with an unstatisfiable accept header
  590         -
    /// Test ID: RestJsonStringPayloadUnsatisfiableAccept2
  591         -
    #[::tokio::test]
  592         -
    async fn rest_json_string_payload_unsatisfiable_accept2_malformed_request() {
  593         -
        {
  594         -
            #[allow(unused_mut)]
  595         -
            let mut http_request = http::Request::builder()
  596         -
                .uri("/StringPayload2")
  597         -
                .method("POST")
  598         -
                .header("Accept", "application/json")
  599         -
                .header("Content-Type", "text/plain")
  600         -
                .body(::aws_smithy_http_server::body::Body::from(
  601         -
                    ::bytes::Bytes::from_static("rawstring".as_bytes()),
  602         -
                ))
  603         -
                .unwrap();
  604         -
            #[allow(unused_mut)]
  605         -
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  606         -
            let config = crate::service::RestJsonExtrasConfig::builder().build();
  607         -
            let service = crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
  608         -
                            .http_string_payload2(move |input: crate::input::HttpStringPayload2Input| {
  609         -
                                let sender = sender.clone();
  610         -
                                async move {
  611         -
                                    let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::HttpStringPayload2Output, crate::error::HttpStringPayload2Error> };
  612         -
                                    sender.send(()).await.expect("receiver dropped early");
  613         -
                                    result
  614         -
                                }
  615         -
                            })
  616         -
                            .build_unchecked();
  617         -
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  618         -
                .await
  619         -
                .expect("unable to make an HTTP request");
  620         -
            ::pretty_assertions::assert_eq!(
  621         -
                http::StatusCode::from_u16(406).expect("invalid expected HTTP status code"),
  622         -
                http_response.status()
  623         -
            );
  624         -
            let expected_headers = [("x-amzn-errortype", "NotAcceptableException")];
  625         -
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  626         -
                http_response.headers(),
  627         -
                expected_headers,
  628         -
            ));
  629         -
        }
  630         -
    }
  631         -
}
  632         -
#[cfg(test)]
  633         -
#[allow(unreachable_code, unused_variables)]
  634         -
mod server_malformed_content_type_with_body2_test {
  635         -
    /// Upper case error modeled lower case.
  636         -
    /// Test ID: ServiceLevelErrorServer
  637         -
    #[::tokio::test]
  638         -
    async fn service_level_error_server_response() {
  639         -
        let output = crate::error::ExtraError {};
  640         -
        let output = crate::error::MalformedContentTypeWithBody2Error::ExtraError(output);
  641         -
        use ::aws_smithy_http_server::response::IntoResponse;
  642         -
        let http_response = output.into_response();
  643         -
        ::pretty_assertions::assert_eq!(
  644         -
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
  645         -
            http_response.status()
  646         -
        );
  647         -
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
  648         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  649         -
            http_response.headers(),
  650         -
            expected_headers,
  651         -
        ));
  652         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
  653         -
            .await
  654         -
            .expect("unable to extract body to bytes");
  655         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  656         -
            &body,
  657         -
            "{}",
  658         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  659         -
        ));
  660         -
    }
  661         -
    /// When there is modeled input, the content type must be application/json
  662         -
    /// Test ID: RestJsonWithBodyExpectsApplicationJsonContentTypeNoHeaders
  663         -
    #[::tokio::test]
  664         -
    async fn rest_json_with_body_expects_application_json_content_type_no_headers_malformed_request(
  665         -
    ) {
  666         -
        {
  667         -
            #[allow(unused_mut)]
  668         -
            let mut http_request = http::Request::builder()
  669         -
                .uri("/MalformedContentTypeWithBody")
  670         -
                .method("POST")
  671         -
                .body(::aws_smithy_http_server::body::Body::from(
  672         -
                    ::bytes::Bytes::from_static("{}".as_bytes()),
  673         -
                ))
  674         -
                .unwrap();
  675         -
            #[allow(unused_mut)]
  676         -
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  677         -
            let config = crate::service::RestJsonExtrasConfig::builder().build();
  678         -
            let service = crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
  679         -
                            .malformed_content_type_with_body2(move |input: crate::input::MalformedContentTypeWithBody2Input| {
  680         -
                                let sender = sender.clone();
  681         -
                                async move {
  682         -
                                    let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedContentTypeWithBody2Output, crate::error::MalformedContentTypeWithBody2Error> };
  683         -
                                    sender.send(()).await.expect("receiver dropped early");
  684         -
                                    result
  685         -
                                }
  686         -
                            })
  687         -
                            .build_unchecked();
  688         -
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  689         -
                .await
  690         -
                .expect("unable to make an HTTP request");
  691         -
            ::pretty_assertions::assert_eq!(
  692         -
                http::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
  693         -
                http_response.status()
  694         -
            );
  695         -
            let expected_headers = [("x-amzn-errortype", "UnsupportedMediaTypeException")];
  696         -
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  697         -
                http_response.headers(),
  698         -
                expected_headers,
  699         -
            ));
  700         -
        }
  701         -
    }
  702         -
}
  703         -
#[cfg(test)]
  704         -
#[allow(unreachable_code, unused_variables)]
  705         -
mod server_map_with_enum_key_op_test {
  706         -
    /// Test ID: MapWithEnumKeyRequest
  707         -
    #[::tokio::test]
  708         -
    async fn map_with_enum_key_request_request() {
  709         -
        #[allow(unused_mut)]
  710         -
        let mut http_request = http::Request::builder()
  711         -
            .uri("/map-with-enum-key")
  712         -
            .method("POST")
  713         -
            .header("Content-Type", "application/json")
  714         -
            .body(::aws_smithy_http_server::body::Body::from(
  715         -
                ::bytes::Bytes::from_static("{\"map\":{\"enumvalue\":\"something\"}}".as_bytes()),
  716         -
            ))
  717         -
            .unwrap();
  718         -
        #[allow(unused_mut)]
  719         -
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  720         -
        let config = crate::service::RestJsonExtrasConfig::builder().build();
  721         -
        let service =
  722         -
            crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
  723         -
                .map_with_enum_key_op(move |input: crate::input::MapWithEnumKeyOpInput| {
  724         -
                    let sender = sender.clone();
  725         -
                    async move {
  726         -
                        let result = {
  727         -
                            let expected = crate::input::MapWithEnumKeyOpInput {
  728         -
                                map: ::std::option::Option::Some({
  729         -
                                    let mut ret = ::std::collections::HashMap::new();
  730         -
                                    ret.insert(
  731         -
                                        "enumvalue"
  732         -
                                            .parse::<crate::model::StringEnum>()
  733         -
                                            .expect("static value validated to member"),
  734         -
                                        "something".to_owned(),
  735         -
                                    );
  736         -
                                    ret
  737         -
                                }),
  738         -
                            };
  739         -
                            ::pretty_assertions::assert_eq!(input, expected);
  740         -
                            let response = crate::output::MapWithEnumKeyOpOutput {
  741         -
                                map: ::std::option::Option::None,
  742         -
                            };
  743         -
                            Ok(response)
  744         -
                        };
  745         -
                        sender.send(()).await.expect("receiver dropped early");
  746         -
                        result
  747         -
                    }
  748         -
                })
  749         -
                .build_unchecked();
  750         -
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  751         -
            .await
  752         -
            .expect("unable to make an HTTP request");
  753         -
        assert!(receiver.recv().await.is_some());
  754         -
    }
  755         -
    /// Test ID: MapWithEnumKeyResponse
  756         -
    #[::tokio::test]
  757         -
    async fn map_with_enum_key_response_response() {
  758         -
        let output = crate::output::MapWithEnumKeyOpOutput {
  759         -
            map: ::std::option::Option::Some({
  760         -
                let mut ret = ::std::collections::HashMap::new();
  761         -
                ret.insert(
  762         -
                    "enumvalue"
  763         -
                        .parse::<crate::model::StringEnum>()
  764         -
                        .expect("static value validated to member"),
  765         -
                    "something".to_owned(),
  766         -
                );
  767         -
                ret
  768         -
            }),
  769         -
        };
  770         -
        use ::aws_smithy_http_server::response::IntoResponse;
  771         -
        let http_response = output.into_response();
  772         -
        ::pretty_assertions::assert_eq!(
  773         -
            http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
  774         -
            http_response.status()
  775         -
        );
  776         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
  777         -
            .await
  778         -
            .expect("unable to extract body to bytes");
  779         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  780         -
            &body,
  781         -
            "{\"map\":{\"enumvalue\":\"something\"}}",
  782         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  783         -
        ));
  784         -
    }
  785         -
    /// Upper case error modeled lower case.
  786         -
    /// Test ID: ServiceLevelErrorServer
  787         -
    #[::tokio::test]
  788         -
    async fn service_level_error_server_response() {
  789         -
        let output = crate::error::ExtraError {};
  790         -
        let output = crate::error::MapWithEnumKeyOpError::ExtraError(output);
  791         -
        use ::aws_smithy_http_server::response::IntoResponse;
  792         -
        let http_response = output.into_response();
  793         -
        ::pretty_assertions::assert_eq!(
  794         -
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
  795         -
            http_response.status()
  796         -
        );
  797         -
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
  798         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  799         -
            http_response.headers(),
  800         -
            expected_headers,
  801         -
        ));
  802         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
  803         -
            .await
  804         -
            .expect("unable to extract body to bytes");
  805         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  806         -
            &body,
  807         -
            "{}",
  808         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  809         -
        ));
  810         -
    }
  811         -
}
  812         -
#[cfg(test)]
  813         -
#[allow(unreachable_code, unused_variables)]
  814         -
mod server_null_in_non_sparse_test {
  815         -
    /// Upper case error modeled lower case.
  816         -
    /// Test ID: ServiceLevelErrorServer
  817         -
    #[::tokio::test]
  818         -
    async fn service_level_error_server_response() {
  819         -
        let output = crate::error::ExtraError {};
  820         -
        let output = crate::error::NullInNonSparseError::ExtraError(output);
  821         -
        use ::aws_smithy_http_server::response::IntoResponse;
  822         -
        let http_response = output.into_response();
  823         -
        ::pretty_assertions::assert_eq!(
  824         -
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
  825         -
            http_response.status()
  826         -
        );
  827         -
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
  828         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  829         -
            http_response.headers(),
  830         -
            expected_headers,
  831         -
        ));
  832         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
  833         -
            .await
  834         -
            .expect("unable to extract body to bytes");
  835         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  836         -
            &body,
  837         -
            "{}",
  838         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  839         -
        ));
  840         -
    }
  841         -
}
  842         -
#[cfg(test)]
  843         -
#[allow(unreachable_code, unused_variables)]
  844         -
mod server_primitive_int_header_test {
  845         -
    /// Test ID: DeserPrimitiveHeader
  846         -
    #[::tokio::test]
  847         -
    async fn deser_primitive_header_response() {
  848         -
        let output = crate::output::PrimitiveIntHeaderOutput { field: 123 };
  849         -
        use ::aws_smithy_http_server::response::IntoResponse;
  850         -
        let http_response = output.into_response();
  851         -
        ::pretty_assertions::assert_eq!(
  852         -
            http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
  853         -
            http_response.status()
  854         -
        );
  855         -
        let expected_headers = [("x-field", "123")];
  856         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  857         -
            http_response.headers(),
  858         -
            expected_headers,
  859         -
        ));
  860         -
    }
  861         -
    /// Test ID: DeserPrimitiveHeaderMissing
  862         -
    #[::tokio::test]
  863         -
    async fn deser_primitive_header_missing_response() {
  864         -
        let output = crate::output::PrimitiveIntHeaderOutput { field: 0 };
  865         -
        use ::aws_smithy_http_server::response::IntoResponse;
  866         -
        let http_response = output.into_response();
  867         -
        ::pretty_assertions::assert_eq!(
  868         -
            http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
  869         -
            http_response.status()
  870         -
        );
  871         -
    }
  872         -
    /// Upper case error modeled lower case.
  873         -
    /// Test ID: ServiceLevelErrorServer
  874         -
    #[::tokio::test]
  875         -
    async fn service_level_error_server_response() {
  876         -
        let output = crate::error::ExtraError {};
  877         -
        let output = crate::error::PrimitiveIntHeaderError::ExtraError(output);
  878         -
        use ::aws_smithy_http_server::response::IntoResponse;
  879         -
        let http_response = output.into_response();
  880         -
        ::pretty_assertions::assert_eq!(
  881         -
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
  882         -
            http_response.status()
  883         -
        );
  884         -
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
  885         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  886         -
            http_response.headers(),
  887         -
            expected_headers,
  888         -
        ));
  889         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
  890         -
            .await
  891         -
            .expect("unable to extract body to bytes");
  892         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  893         -
            &body,
  894         -
            "{}",
  895         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  896         -
        ));
          61  +
        use ::futures_util::future::TryFutureExt;
          62  +
        let fut = fut.map_err(
          63  +
            |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
          64  +
                ::tracing::debug!(error = %e, "failed to deserialize request");
          65  +
                ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
          66  +
                    e,
          67  +
                )
          68  +
            },
          69  +
        );
          70  +
        HttpStringPayload2InputFuture {
          71  +
            inner: Box::pin(fut),
          72  +
        }
  897     73   
    }
  898     74   
}
  899         -
#[cfg(test)]
  900         -
#[allow(unreachable_code, unused_variables)]
  901         -
mod server_primitive_int_op_test {
  902         -
    /// Upper case error modeled lower case.
  903         -
    /// Test ID: ServiceLevelErrorServer
  904         -
    #[::tokio::test]
  905         -
    async fn service_level_error_server_response() {
  906         -
        let output = crate::error::ExtraError {};
  907         -
        let output = crate::error::PrimitiveIntOpError::ExtraError(output);
  908         -
        use ::aws_smithy_http_server::response::IntoResponse;
  909         -
        let http_response = output.into_response();
  910         -
        ::pretty_assertions::assert_eq!(
  911         -
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
  912         -
            http_response.status()
          75  +
impl
          76  +
    ::aws_smithy_http_server::response::IntoResponse<
          77  +
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
          78  +
    > for crate::output::HttpStringPayload2Output
          79  +
{
          80  +
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
          81  +
        match crate::protocol_serde::shape_http_string_payload2::ser_http_string_payload2_http_response(self) {
          82  +
                        Ok(response) => response,
          83  +
                        Err(e) => {
          84  +
                            ::tracing::error!(error = %e, "failed to serialize response");
          85  +
                            ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
          86  +
                        }
          87  +
                    }
          88  +
    }
          89  +
}
          90  +
impl
          91  +
    ::aws_smithy_http_server::response::IntoResponse<
          92  +
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
          93  +
    > for crate::error::HttpStringPayload2Error
          94  +
{
          95  +
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
          96  +
        match crate::protocol_serde::shape_http_string_payload2::ser_http_string_payload2_http_error(
          97  +
            &self,
          98  +
        ) {
          99  +
            Ok(mut response) => {
         100  +
                response.extensions_mut().insert(
         101  +
                    ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
  913    102   
                );
  914         -
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
  915         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  916         -
            http_response.headers(),
  917         -
            expected_headers,
  918         -
        ));
  919         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
  920         -
            .await
  921         -
            .expect("unable to extract body to bytes");
  922         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  923         -
            &body,
  924         -
            "{}",
  925         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  926         -
        ));
         103  +
                response
         104  +
            }
         105  +
            Err(e) => {
         106  +
                ::tracing::error!(error = %e, "failed to serialize response");
         107  +
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
         108  +
            }
         109  +
        }
  927    110   
    }
  928    111   
}
  929         -
#[cfg(test)]
         112  +
  930    113   
#[allow(unreachable_code, unused_variables)]
  931         -
mod server_query_precedence_test {
  932         -
    /// Servers put all query params in map
  933         -
    /// Test ID: RestJsonServersPutAllQueryParamsInMap
         114  +
#[cfg(test)]
         115  +
mod http_string_payload2_test {
         116  +
         117  +
    /// Test ID: RestJsonStringPayloadRequest2
  934    118   
    #[::tokio::test]
  935         -
    async fn rest_json_servers_put_all_query_params_in_map_request() {
         119  +
    #[::tracing_test::traced_test]
         120  +
    async fn rest_json_string_payload_request2_request() {
  936    121   
        #[allow(unused_mut)]
  937    122   
        let mut http_request = http::Request::builder()
  938         -
            .uri("/Precedence")
         123  +
            .uri("/StringPayload2")
  939    124   
            .method("POST")
         125  +
            .header("Content-Type", "text/plain")
  940    126   
            .body(::aws_smithy_http_server::body::Body::from(
  941         -
                ::bytes::Bytes::from_static("".as_bytes()),
         127  +
                ::bytes::Bytes::from_static("rawstring".as_bytes()),
  942    128   
            ))
  943    129   
            .unwrap();
  944         -
        *http_request.uri_mut() = "/Precedence?bar=named&qux=fromMap".parse().unwrap();
  945    130   
        #[allow(unused_mut)]
  946    131   
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
  947    132   
        let config = crate::service::RestJsonExtrasConfig::builder().build();
  948    133   
        let service =
  949    134   
            crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
  950         -
                .query_precedence(move |input: crate::input::QueryPrecedenceInput| {
         135  +
                .http_string_payload2(move |input: crate::input::HttpStringPayload2Input| {
  951    136   
                    let sender = sender.clone();
  952    137   
                    async move {
  953    138   
                        let result = {
  954         -
                            let expected = crate::input::QueryPrecedenceInput {
  955         -
                                foo: ::std::option::Option::Some("named".to_owned()),
  956         -
                                baz: ::std::option::Option::Some({
  957         -
                                    let mut ret = ::std::collections::HashMap::new();
  958         -
                                    ret.insert("bar".to_owned(), "named".to_owned());
  959         -
                                    ret.insert("qux".to_owned(), "fromMap".to_owned());
  960         -
                                    ret
  961         -
                                }),
         139  +
                            let expected = crate::input::HttpStringPayload2Input {
         140  +
                                payload: ::std::option::Option::Some("rawstring".to_owned()),
  962    141   
                            };
  963    142   
                            ::pretty_assertions::assert_eq!(input, expected);
  964         -
                            let response = crate::output::QueryPrecedenceOutput {};
         143  +
                            let response = crate::output::HttpStringPayload2Output {
         144  +
                                payload: ::std::option::Option::None,
         145  +
                            };
  965    146   
                            Ok(response)
  966    147   
                        };
  967    148   
                        sender.send(()).await.expect("receiver dropped early");
  968    149   
                        result
  969    150   
                    }
  970    151   
                })
  971    152   
                .build_unchecked();
  972    153   
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
  973    154   
            .await
  974    155   
            .expect("unable to make an HTTP request");
  975         -
        assert!(receiver.recv().await.is_some());
         156  +
        assert!(
         157  +
            receiver.recv().await.is_some(),
         158  +
            "we expected operation handler to be invoked but it was not entered"
         159  +
        );
  976    160   
    }
  977         -
    /// Upper case error modeled lower case.
  978         -
    /// Test ID: ServiceLevelErrorServer
         161  +
    /// Test ID: RestJsonStringPayloadResponse2
  979    162   
    #[::tokio::test]
  980         -
    async fn service_level_error_server_response() {
  981         -
        let output = crate::error::ExtraError {};
  982         -
        let output = crate::error::QueryPrecedenceError::ExtraError(output);
         163  +
    #[::tracing_test::traced_test]
         164  +
    async fn rest_json_string_payload_response2_response() {
         165  +
        let output = crate::output::HttpStringPayload2Output {
         166  +
            payload: ::std::option::Option::Some("rawstring".to_owned()),
         167  +
        };
  983    168   
        use ::aws_smithy_http_server::response::IntoResponse;
  984    169   
        let http_response = output.into_response();
  985    170   
        ::pretty_assertions::assert_eq!(
  986         -
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
         171  +
            http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
  987    172   
            http_response.status()
  988    173   
        );
  989         -
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
         174  +
        let expected_headers = [("Content-Type", "text/plain")];
  990    175   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
  991    176   
            http_response.headers(),
  992    177   
            expected_headers,
  993    178   
        ));
  994    179   
        let body = ::hyper::body::to_bytes(http_response.into_body())
  995    180   
            .await
  996    181   
            .expect("unable to extract body to bytes");
  997    182   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  998    183   
            &body,
  999         -
            "{}",
 1000         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
         184  +
            "rawstring",
         185  +
            ::aws_smithy_protocol_test::MediaType::from("text/plain"),
 1001    186   
        ));
 1002    187   
    }
 1003         -
}
 1004         -
#[cfg(test)]
 1005         -
#[allow(unreachable_code, unused_variables)]
 1006         -
mod server_status_response_test {
 1007    188   
    /// Upper case error modeled lower case.
 1008    189   
    /// Test ID: ServiceLevelErrorServer
 1009    190   
    #[::tokio::test]
         191  +
    #[::tracing_test::traced_test]
 1010    192   
    async fn service_level_error_server_response() {
 1011    193   
        let output = crate::error::ExtraError {};
 1012         -
        let output = crate::error::StatusResponseError::ExtraError(output);
         194  +
        let output = crate::error::HttpStringPayload2Error::ExtraError(output);
 1013    195   
        use ::aws_smithy_http_server::response::IntoResponse;
 1014    196   
        let http_response = output.into_response();
 1015    197   
        ::pretty_assertions::assert_eq!(
 1016    198   
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
 1017    199   
            http_response.status()
 1018    200   
        );
 1019    201   
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
 1020    202   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
 1021    203   
            http_response.headers(),
 1022    204   
            expected_headers,
 1023    205   
        ));
 1024    206   
        let body = ::hyper::body::to_bytes(http_response.into_body())
 1025    207   
            .await
 1026    208   
            .expect("unable to extract body to bytes");
 1027    209   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
 1028    210   
            &body,
 1029    211   
            "{}",
 1030    212   
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
 1031    213   
        ));
 1032    214   
    }
 1033         -
}
 1034         -
#[cfg(test)]
 1035         -
#[allow(unreachable_code, unused_variables)]
 1036         -
mod server_string_payload_test {
 1037         -
    /// Test ID: StringPayload
         215  +
    /// Serializes a string in the HTTP payload without a content-type header
         216  +
    /// Test ID: RestJsonStringPayloadNoContentType2
 1038    217   
    #[::tokio::test]
 1039         -
    async fn string_payload_request() {
         218  +
    #[::tracing_test::traced_test]
         219  +
    async fn rest_json_string_payload_no_content_type2_malformed_request() {
         220  +
        {
 1040    221   
            #[allow(unused_mut)]
 1041    222   
            let mut http_request = http::Request::builder()
 1042         -
            .uri("/StringPayload")
         223  +
                .uri("/StringPayload2")
 1043    224   
                .method("POST")
 1044         -
            .header("Content-Type", "text/plain")
 1045    225   
                .body(::aws_smithy_http_server::body::Body::from(
 1046    226   
                    ::bytes::Bytes::from_static("rawstring".as_bytes()),
 1047    227   
                ))
 1048    228   
                .unwrap();
 1049    229   
            #[allow(unused_mut)]
 1050    230   
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
 1051    231   
            let config = crate::service::RestJsonExtrasConfig::builder().build();
 1052         -
        let service =
 1053         -
            crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
 1054         -
                .string_payload(move |input: crate::input::StringPayloadInput| {
 1055         -
                    let sender = sender.clone();
 1056         -
                    async move {
 1057         -
                        let result = {
 1058         -
                            let expected = crate::input::StringPayloadInput {
 1059         -
                                payload: ::std::option::Option::Some("rawstring".to_owned()),
 1060         -
                            };
 1061         -
                            ::pretty_assertions::assert_eq!(input, expected);
 1062         -
                            let response = crate::output::StringPayloadOutput {
 1063         -
                                payload: ::std::option::Option::None,
 1064         -
                            };
 1065         -
                            Ok(response)
 1066         -
                        };
 1067         -
                        sender.send(()).await.expect("receiver dropped early");
 1068         -
                        result
 1069         -
                    }
 1070         -
                })
 1071         -
                .build_unchecked();
 1072         -
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
 1073         -
            .await
 1074         -
            .expect("unable to make an HTTP request");
 1075         -
        assert!(receiver.recv().await.is_some());
 1076         -
    }
 1077         -
    /// Upper case error modeled lower case.
 1078         -
    /// Test ID: ServiceLevelErrorServer
 1079         -
    #[::tokio::test]
 1080         -
    async fn service_level_error_server_response() {
 1081         -
        let output = crate::error::ExtraError {};
 1082         -
        let output = crate::error::StringPayloadError::ExtraError(output);
 1083         -
        use ::aws_smithy_http_server::response::IntoResponse;
 1084         -
        let http_response = output.into_response();
 1085         -
        ::pretty_assertions::assert_eq!(
 1086         -
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
 1087         -
            http_response.status()
 1088         -
        );
 1089         -
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
 1090         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
 1091         -
            http_response.headers(),
 1092         -
            expected_headers,
 1093         -
        ));
 1094         -
        let body = ::hyper::body::to_bytes(http_response.into_body())
 1095         -
            .await
 1096         -
            .expect("unable to extract body to bytes");
 1097         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
 1098         -
            &body,
 1099         -
            "{}",
 1100         -
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
 1101         -
        ));
 1102         -
    }
 1103         -
}
 1104         -
 1105         -
static CONTENT_TYPE_HTTPSTRINGPAYLOAD2: ::once_cell::sync::Lazy<::mime::Mime> =
 1106         -
    ::once_cell::sync::Lazy::new(|| {
 1107         -
        "text/plain"
 1108         -
            .parse::<::mime::Mime>()
 1109         -
            .expect("BUG: MIME parsing failed, content_type is not valid")
 1110         -
    });
 1111         -
::pin_project_lite::pin_project! {
 1112         -
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
 1113         -
    /// [`HttpStringPayload2Input`](crate::input::HttpStringPayload2Input) using modelled bindings.
 1114         -
    pub struct HttpStringPayload2InputFuture {
 1115         -
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::HttpStringPayload2Input, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
 1116         -
    }
 1117         -
}
 1118         -
 1119         -
impl std::future::Future for HttpStringPayload2InputFuture {
 1120         -
    type Output = Result<
 1121         -
        crate::input::HttpStringPayload2Input,
 1122         -
        ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
 1123         -
    >;
 1124         -
 1125         -
    fn poll(
 1126         -
        self: std::pin::Pin<&mut Self>,
 1127         -
        cx: &mut std::task::Context<'_>,
 1128         -
    ) -> std::task::Poll<Self::Output> {
 1129         -
        let this = self.project();
 1130         -
        this.inner.as_mut().poll(cx)
 1131         -
    }
 1132         -
}
 1133         -
 1134         -
impl<B>
 1135         -
    ::aws_smithy_http_server::request::FromRequest<
 1136         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
 1137         -
        B,
 1138         -
    > for crate::input::HttpStringPayload2Input
 1139         -
where
 1140         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
 1141         -
    B: 'static,
 1142         -
 1143         -
    B::Data: Send,
 1144         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
 1145         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
 1146         -
{
 1147         -
    type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
 1148         -
    type Future = HttpStringPayload2InputFuture;
 1149         -
 1150         -
    fn from_request(request: ::http::Request<B>) -> Self::Future {
 1151         -
        let fut = async move {
 1152         -
            if !::aws_smithy_http_server::protocol::accept_header_classifier(
 1153         -
                request.headers(),
 1154         -
                &CONTENT_TYPE_HTTPSTRINGPAYLOAD2,
 1155         -
            ) {
 1156         -
                return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
 1157         -
            }
 1158         -
            crate::protocol_serde::shape_http_string_payload2::de_http_string_payload2_http_request(
 1159         -
                request,
 1160         -
            )
 1161         -
            .await
 1162         -
            .map_err(Into::into)
 1163         -
        };
 1164         -
        use ::futures_util::future::TryFutureExt;
 1165         -
        let fut = fut.map_err(
 1166         -
            |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
 1167         -
                ::tracing::debug!(error = %e, "failed to deserialize request");
 1168         -
                ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
 1169         -
                    e,
 1170         -
                )
 1171         -
            },
 1172         -
        );
 1173         -
        HttpStringPayload2InputFuture {
 1174         -
            inner: Box::pin(fut),
 1175         -
        }
         232  +
            let service = crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
         233  +
                            .http_string_payload2(move |input: crate::input::HttpStringPayload2Input| {
         234  +
                                let sender = sender.clone();
         235  +
                                async move {
         236  +
                                    let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::HttpStringPayload2Output, crate::error::HttpStringPayload2Error> };
         237  +
                                    sender.send(()).await.expect("receiver dropped early");
         238  +
                                    result
 1176    239   
                                }
 1177         -
}
 1178         -
impl
 1179         -
    ::aws_smithy_http_server::response::IntoResponse<
 1180         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
 1181         -
    > for crate::output::HttpStringPayload2Output
 1182         -
{
 1183         -
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
 1184         -
        match crate::protocol_serde::shape_http_string_payload2::ser_http_string_payload2_http_response(self) {
 1185         -
                        Ok(response) => response,
 1186         -
                        Err(e) => {
 1187         -
                            ::tracing::error!(error = %e, "failed to serialize response");
 1188         -
                            ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
         240  +
                            })
         241  +
                            .build_unchecked();
         242  +
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
         243  +
                .await
         244  +
                .expect("unable to make an HTTP request");
         245  +
            ::pretty_assertions::assert_eq!(
         246  +
                http::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
         247  +
                http_response.status()
         248  +
            );
         249  +
            let expected_headers = [("x-amzn-errortype", "UnsupportedMediaTypeException")];
         250  +
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
         251  +
                http_response.headers(),
         252  +
                expected_headers,
         253  +
            ));
 1189    254   
        }
 1190    255   
    }
         256  +
    /// Serializes a string in the HTTP payload without the expected content-type header
         257  +
    /// Test ID: RestJsonStringPayloadWrongContentType2
         258  +
    #[::tokio::test]
         259  +
    #[::tracing_test::traced_test]
         260  +
    async fn rest_json_string_payload_wrong_content_type2_malformed_request() {
         261  +
        {
         262  +
            #[allow(unused_mut)]
         263  +
            let mut http_request = http::Request::builder()
         264  +
                .uri("/StringPayload2")
         265  +
                .method("POST")
         266  +
                .header("Content-Type", "application/json")
         267  +
                .body(::aws_smithy_http_server::body::Body::from(
         268  +
                    ::bytes::Bytes::from_static("rawstring".as_bytes()),
         269  +
                ))
         270  +
                .unwrap();
         271  +
            #[allow(unused_mut)]
         272  +
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
         273  +
            let config = crate::service::RestJsonExtrasConfig::builder().build();
         274  +
            let service = crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
         275  +
                            .http_string_payload2(move |input: crate::input::HttpStringPayload2Input| {
         276  +
                                let sender = sender.clone();
         277  +
                                async move {
         278  +
                                    let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::HttpStringPayload2Output, crate::error::HttpStringPayload2Error> };
         279  +
                                    sender.send(()).await.expect("receiver dropped early");
         280  +
                                    result
 1191    281   
                                }
 1192         -
}
 1193         -
impl
 1194         -
    ::aws_smithy_http_server::response::IntoResponse<
 1195         -
        ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
 1196         -
    > for crate::error::HttpStringPayload2Error
 1197         -
{
 1198         -
    fn into_response(self) -> ::aws_smithy_http_server::response::Response {
 1199         -
        match crate::protocol_serde::shape_http_string_payload2::ser_http_string_payload2_http_error(
 1200         -
            &self,
 1201         -
        ) {
 1202         -
            Ok(mut response) => {
 1203         -
                response.extensions_mut().insert(
 1204         -
                    ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
         282  +
                            })
         283  +
                            .build_unchecked();
         284  +
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
         285  +
                .await
         286  +
                .expect("unable to make an HTTP request");
         287  +
            ::pretty_assertions::assert_eq!(
         288  +
                http::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
         289  +
                http_response.status()
 1205    290   
            );
 1206         -
                response
         291  +
            let expected_headers = [("x-amzn-errortype", "UnsupportedMediaTypeException")];
         292  +
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
         293  +
                http_response.headers(),
         294  +
                expected_headers,
         295  +
            ));
 1207    296   
        }
 1208         -
            Err(e) => {
 1209         -
                ::tracing::error!(error = %e, "failed to serialize response");
 1210         -
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
 1211    297   
    }
         298  +
    /// Serializes a string in the HTTP payload with an unstatisfiable accept header
         299  +
    /// Test ID: RestJsonStringPayloadUnsatisfiableAccept2
         300  +
    #[::tokio::test]
         301  +
    #[::tracing_test::traced_test]
         302  +
    async fn rest_json_string_payload_unsatisfiable_accept2_malformed_request() {
         303  +
        {
         304  +
            #[allow(unused_mut)]
         305  +
            let mut http_request = http::Request::builder()
         306  +
                .uri("/StringPayload2")
         307  +
                .method("POST")
         308  +
                .header("Accept", "application/json")
         309  +
                .header("Content-Type", "text/plain")
         310  +
                .body(::aws_smithy_http_server::body::Body::from(
         311  +
                    ::bytes::Bytes::from_static("rawstring".as_bytes()),
         312  +
                ))
         313  +
                .unwrap();
         314  +
            #[allow(unused_mut)]
         315  +
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
         316  +
            let config = crate::service::RestJsonExtrasConfig::builder().build();
         317  +
            let service = crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
         318  +
                            .http_string_payload2(move |input: crate::input::HttpStringPayload2Input| {
         319  +
                                let sender = sender.clone();
         320  +
                                async move {
         321  +
                                    let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::HttpStringPayload2Output, crate::error::HttpStringPayload2Error> };
         322  +
                                    sender.send(()).await.expect("receiver dropped early");
         323  +
                                    result
         324  +
                                }
         325  +
                            })
         326  +
                            .build_unchecked();
         327  +
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
         328  +
                .await
         329  +
                .expect("unable to make an HTTP request");
         330  +
            ::pretty_assertions::assert_eq!(
         331  +
                http::StatusCode::from_u16(406).expect("invalid expected HTTP status code"),
         332  +
                http_response.status()
         333  +
            );
         334  +
            let expected_headers = [("x-amzn-errortype", "NotAcceptableException")];
         335  +
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
         336  +
                http_response.headers(),
         337  +
                expected_headers,
         338  +
            ));
 1212    339   
        }
 1213    340   
    }
 1214    341   
}
 1215    342   
 1216    343   
static CONTENT_TYPE_HTTPENUMPAYLOAD2: ::once_cell::sync::Lazy<::mime::Mime> =
 1217    344   
    ::once_cell::sync::Lazy::new(|| {
 1218    345   
        "text/plain"
 1219    346   
            .parse::<::mime::Mime>()
 1220    347   
            .expect("BUG: MIME parsing failed, content_type is not valid")
 1221    348   
    });
@@ -1299,426 +1358,597 @@
 1319    446   
                response
 1320    447   
            }
 1321    448   
            Err(e) => {
 1322    449   
                ::tracing::error!(error = %e, "failed to serialize response");
 1323    450   
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
 1324    451   
            }
 1325    452   
        }
 1326    453   
    }
 1327    454   
}
 1328    455   
         456  +
#[allow(unreachable_code, unused_variables)]
         457  +
#[cfg(test)]
         458  +
mod http_enum_payload2_test {
         459  +
         460  +
    /// Test ID: RestJsonEnumPayloadRequest2
         461  +
    #[::tokio::test]
         462  +
    #[::tracing_test::traced_test]
         463  +
    async fn rest_json_enum_payload_request2_request() {
         464  +
        #[allow(unused_mut)]
         465  +
        let mut http_request = http::Request::builder()
         466  +
            .uri("/EnumPayload2")
         467  +
            .method("POST")
         468  +
            .header("Content-Type", "text/plain")
         469  +
            .body(::aws_smithy_http_server::body::Body::from(
         470  +
                ::bytes::Bytes::from_static("enumvalue".as_bytes()),
         471  +
            ))
         472  +
            .unwrap();
         473  +
        #[allow(unused_mut)]
         474  +
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
         475  +
        let config = crate::service::RestJsonExtrasConfig::builder().build();
         476  +
        let service =
         477  +
            crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
         478  +
                .http_enum_payload2(move |input: crate::input::HttpEnumPayload2Input| {
         479  +
                    let sender = sender.clone();
         480  +
                    async move {
         481  +
                        let result = {
         482  +
                            let expected = crate::input::HttpEnumPayload2Input {
         483  +
                                payload: ::std::option::Option::Some(
         484  +
                                    "enumvalue"
         485  +
                                        .parse::<crate::model::StringEnum>()
         486  +
                                        .expect("static value validated to member"),
         487  +
                                ),
         488  +
                            };
         489  +
                            ::pretty_assertions::assert_eq!(input, expected);
         490  +
                            let response = crate::output::HttpEnumPayload2Output {
         491  +
                                payload: ::std::option::Option::None,
         492  +
                            };
         493  +
                            Ok(response)
         494  +
                        };
         495  +
                        sender.send(()).await.expect("receiver dropped early");
         496  +
                        result
         497  +
                    }
         498  +
                })
         499  +
                .build_unchecked();
         500  +
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
         501  +
            .await
         502  +
            .expect("unable to make an HTTP request");
         503  +
        assert!(
         504  +
            receiver.recv().await.is_some(),
         505  +
            "we expected operation handler to be invoked but it was not entered"
         506  +
        );
         507  +
    }
         508  +
    /// Test ID: RestJsonEnumPayloadResponse2
         509  +
    #[::tokio::test]
         510  +
    #[::tracing_test::traced_test]
         511  +
    async fn rest_json_enum_payload_response2_response() {
         512  +
        let output = crate::output::HttpEnumPayload2Output {
         513  +
            payload: ::std::option::Option::Some(
         514  +
                "enumvalue"
         515  +
                    .parse::<crate::model::StringEnum>()
         516  +
                    .expect("static value validated to member"),
         517  +
            ),
         518  +
        };
         519  +
        use ::aws_smithy_http_server::response::IntoResponse;
         520  +
        let http_response = output.into_response();
         521  +
        ::pretty_assertions::assert_eq!(
         522  +
            http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
         523  +
            http_response.status()
         524  +
        );
         525  +
        let expected_headers = [("Content-Type", "text/plain")];
         526  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
         527  +
            http_response.headers(),
         528  +
            expected_headers,
         529  +
        ));
         530  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
         531  +
            .await
         532  +
            .expect("unable to extract body to bytes");
         533  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
         534  +
            &body,
         535  +
            "enumvalue",
         536  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
         537  +
        ));
         538  +
    }
         539  +
    /// Upper case error modeled lower case.
         540  +
    /// Test ID: ServiceLevelErrorServer
         541  +
    #[::tokio::test]
         542  +
    #[::tracing_test::traced_test]
         543  +
    async fn service_level_error_server_response() {
         544  +
        let output = crate::error::ExtraError {};
         545  +
        let output = crate::error::HttpEnumPayload2Error::ExtraError(output);
         546  +
        use ::aws_smithy_http_server::response::IntoResponse;
         547  +
        let http_response = output.into_response();
         548  +
        ::pretty_assertions::assert_eq!(
         549  +
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
         550  +
            http_response.status()
         551  +
        );
         552  +
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
         553  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
         554  +
            http_response.headers(),
         555  +
            expected_headers,
         556  +
        ));
         557  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
         558  +
            .await
         559  +
            .expect("unable to extract body to bytes");
         560  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
         561  +
            &body,
         562  +
            "{}",
         563  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
         564  +
        ));
         565  +
    }
         566  +
}
         567  +
 1329    568   
const CONTENT_TYPE_MALFORMEDCONTENTTYPEWITHBODY2: ::mime::Mime = ::mime::APPLICATION_JSON;
 1330    569   
::pin_project_lite::pin_project! {
 1331    570   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
 1332    571   
    /// [`MalformedContentTypeWithBody2Input`](crate::input::MalformedContentTypeWithBody2Input) using modelled bindings.
 1333    572   
    pub struct MalformedContentTypeWithBody2InputFuture {
 1334    573   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedContentTypeWithBody2Input, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
 1335    574   
    }
 1336    575   
}
 1337    576   
 1338    577   
impl std::future::Future for MalformedContentTypeWithBody2InputFuture {
@@ -1399,638 +1458,772 @@
 1419    658   
                response
 1420    659   
            },
 1421    660   
            Err(e) => {
 1422    661   
                ::tracing::error!(error = %e, "failed to serialize response");
 1423    662   
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
 1424    663   
            }
 1425    664   
        }
 1426    665   
    }
 1427    666   
}
 1428    667   
         668  +
#[allow(unreachable_code, unused_variables)]
         669  +
#[cfg(test)]
         670  +
mod malformed_content_type_with_body2_test {
         671  +
         672  +
    /// Upper case error modeled lower case.
         673  +
    /// Test ID: ServiceLevelErrorServer
         674  +
    #[::tokio::test]
         675  +
    #[::tracing_test::traced_test]
         676  +
    async fn service_level_error_server_response() {
         677  +
        let output = crate::error::ExtraError {};
         678  +
        let output = crate::error::MalformedContentTypeWithBody2Error::ExtraError(output);
         679  +
        use ::aws_smithy_http_server::response::IntoResponse;
         680  +
        let http_response = output.into_response();
         681  +
        ::pretty_assertions::assert_eq!(
         682  +
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
         683  +
            http_response.status()
         684  +
        );
         685  +
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
         686  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
         687  +
            http_response.headers(),
         688  +
            expected_headers,
         689  +
        ));
         690  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
         691  +
            .await
         692  +
            .expect("unable to extract body to bytes");
         693  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
         694  +
            &body,
         695  +
            "{}",
         696  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
         697  +
        ));
         698  +
    }
         699  +
    /// When there is modeled input, the content type must be application/json
         700  +
    /// Test ID: RestJsonWithBodyExpectsApplicationJsonContentTypeNoHeaders
         701  +
    #[::tokio::test]
         702  +
    #[::tracing_test::traced_test]
         703  +
    async fn rest_json_with_body_expects_application_json_content_type_no_headers_malformed_request(
         704  +
    ) {
         705  +
        {
         706  +
            #[allow(unused_mut)]
         707  +
            let mut http_request = http::Request::builder()
         708  +
                .uri("/MalformedContentTypeWithBody")
         709  +
                .method("POST")
         710  +
                .body(::aws_smithy_http_server::body::Body::from(
         711  +
                    ::bytes::Bytes::from_static("{}".as_bytes()),
         712  +
                ))
         713  +
                .unwrap();
         714  +
            #[allow(unused_mut)]
         715  +
            let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
         716  +
            let config = crate::service::RestJsonExtrasConfig::builder().build();
         717  +
            let service = crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
         718  +
                            .malformed_content_type_with_body2(move |input: crate::input::MalformedContentTypeWithBody2Input| {
         719  +
                                let sender = sender.clone();
         720  +
                                async move {
         721  +
                                    let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedContentTypeWithBody2Output, crate::error::MalformedContentTypeWithBody2Error> };
         722  +
                                    sender.send(()).await.expect("receiver dropped early");
         723  +
                                    result
         724  +
                                }
         725  +
                            })
         726  +
                            .build_unchecked();
         727  +
            let http_response = ::tower::ServiceExt::oneshot(service, http_request)
         728  +
                .await
         729  +
                .expect("unable to make an HTTP request");
         730  +
            ::pretty_assertions::assert_eq!(
         731  +
                http::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
         732  +
                http_response.status()
         733  +
            );
         734  +
            let expected_headers = [("x-amzn-errortype", "UnsupportedMediaTypeException")];
         735  +
            ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
         736  +
                http_response.headers(),
         737  +
                expected_headers,
         738  +
            ));
         739  +
        }
         740  +
    }
         741  +
}
         742  +
 1429    743   
::pin_project_lite::pin_project! {
 1430    744   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
 1431    745   
    /// [`HttpPayloadTraits2Input`](crate::input::HttpPayloadTraits2Input) using modelled bindings.
 1432    746   
    pub struct HttpPayloadTraits2InputFuture {
 1433    747   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::HttpPayloadTraits2Input, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
 1434    748   
    }
 1435    749   
}
 1436    750   
 1437    751   
impl std::future::Future for HttpPayloadTraits2InputFuture {
 1438    752   
    type Output = Result<
@@ -1498,812 +1557,954 @@
 1518    832   
                response
 1519    833   
            }
 1520    834   
            Err(e) => {
 1521    835   
                ::tracing::error!(error = %e, "failed to serialize response");
 1522    836   
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
 1523    837   
            }
 1524    838   
        }
 1525    839   
    }
 1526    840   
}
 1527    841   
         842  +
#[allow(unreachable_code, unused_variables)]
         843  +
#[cfg(test)]
         844  +
mod http_payload_traits2_test {
         845  +
         846  +
    /// Servers must accept no content type for blob inputs
         847  +
    /// without the media type trait.
         848  +
    /// Test ID: RestJsonHttpPayloadTraitsWithBlobAcceptsNoContentType
         849  +
    #[::tokio::test]
         850  +
    #[::tracing_test::traced_test]
         851  +
    async fn rest_json_http_payload_traits_with_blob_accepts_no_content_type_request() {
         852  +
        #[allow(unused_mut)]
         853  +
        let mut http_request = http::Request::builder()
         854  +
            .uri("/HttpPayloadTraits")
         855  +
            .method("POST")
         856  +
            .header("X-Foo", "Foo")
         857  +
            .body(::aws_smithy_http_server::body::Body::from(
         858  +
                ::bytes::Bytes::from_static("This is definitely a jpeg".as_bytes()),
         859  +
            ))
         860  +
            .unwrap();
         861  +
        #[allow(unused_mut)]
         862  +
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
         863  +
        let config = crate::service::RestJsonExtrasConfig::builder().build();
         864  +
        let service =
         865  +
            crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
         866  +
                .http_payload_traits2(move |input: crate::input::HttpPayloadTraits2Input| {
         867  +
                    let sender = sender.clone();
         868  +
                    async move {
         869  +
                        let result = {
         870  +
                            let expected = crate::input::HttpPayloadTraits2Input {
         871  +
                                foo: ::std::option::Option::Some("Foo".to_owned()),
         872  +
                                blob: ::std::option::Option::Some(::aws_smithy_types::Blob::new(
         873  +
                                    "This is definitely a jpeg",
         874  +
                                )),
         875  +
                            };
         876  +
                            ::pretty_assertions::assert_eq!(input, expected);
         877  +
                            let response = crate::output::HttpPayloadTraits2Output {
         878  +
                                foo: ::std::option::Option::None,
         879  +
                                blob: ::std::option::Option::None,
         880  +
                            };
         881  +
                            Ok(response)
         882  +
                        };
         883  +
                        sender.send(()).await.expect("receiver dropped early");
         884  +
                        result
         885  +
                    }
         886  +
                })
         887  +
                .build_unchecked();
         888  +
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
         889  +
            .await
         890  +
            .expect("unable to make an HTTP request");
         891  +
        assert!(
         892  +
            receiver.recv().await.is_some(),
         893  +
            "we expected operation handler to be invoked but it was not entered"
         894  +
        );
         895  +
    }
         896  +
    /// Upper case error modeled lower case.
         897  +
    /// Test ID: ServiceLevelErrorServer
         898  +
    #[::tokio::test]
         899  +
    #[::tracing_test::traced_test]
         900  +
    async fn service_level_error_server_response() {
         901  +
        let output = crate::error::ExtraError {};
         902  +
        let output = crate::error::HttpPayloadTraits2Error::ExtraError(output);
         903  +
        use ::aws_smithy_http_server::response::IntoResponse;
         904  +
        let http_response = output.into_response();
         905  +
        ::pretty_assertions::assert_eq!(
         906  +
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
         907  +
            http_response.status()
         908  +
        );
         909  +
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
         910  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
         911  +
            http_response.headers(),
         912  +
            expected_headers,
         913  +
        ));
         914  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
         915  +
            .await
         916  +
            .expect("unable to extract body to bytes");
         917  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
         918  +
            &body,
         919  +
            "{}",
         920  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
         921  +
        ));
         922  +
    }
         923  +
}
         924  +
 1528    925   
const CONTENT_TYPE_QUERYPRECEDENCE: ::mime::Mime = ::mime::APPLICATION_JSON;
 1529    926   
::pin_project_lite::pin_project! {
 1530    927   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
 1531    928   
    /// [`QueryPrecedenceInput`](crate::input::QueryPrecedenceInput) using modelled bindings.
 1532    929   
    pub struct QueryPrecedenceInputFuture {
 1533    930   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::QueryPrecedenceInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
 1534    931   
    }
 1535    932   
}
 1536    933   
 1537    934   
impl std::future::Future for QueryPrecedenceInputFuture {
@@ -1603,1000 +1662,1141 @@
 1623   1020   
                response
 1624   1021   
            }
 1625   1022   
            Err(e) => {
 1626   1023   
                ::tracing::error!(error = %e, "failed to serialize response");
 1627   1024   
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
 1628   1025   
            }
 1629   1026   
        }
 1630   1027   
    }
 1631   1028   
}
 1632   1029   
        1030  +
#[allow(unreachable_code, unused_variables)]
        1031  +
#[cfg(test)]
        1032  +
mod query_precedence_test {
        1033  +
        1034  +
    /// Servers put all query params in map
        1035  +
    /// Test ID: RestJsonServersPutAllQueryParamsInMap
        1036  +
    #[::tokio::test]
        1037  +
    #[::tracing_test::traced_test]
        1038  +
    async fn rest_json_servers_put_all_query_params_in_map_request() {
        1039  +
        #[allow(unused_mut)]
        1040  +
        let mut http_request = http::Request::builder()
        1041  +
            .uri("/Precedence")
        1042  +
            .method("POST")
        1043  +
            .body(::aws_smithy_http_server::body::Body::from(
        1044  +
                ::bytes::Bytes::from_static("".as_bytes()),
        1045  +
            ))
        1046  +
            .unwrap();
        1047  +
        *http_request.uri_mut() = "/Precedence?bar=named&qux=fromMap".parse().unwrap();
        1048  +
        #[allow(unused_mut)]
        1049  +
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
        1050  +
        let config = crate::service::RestJsonExtrasConfig::builder().build();
        1051  +
        let service =
        1052  +
            crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
        1053  +
                .query_precedence(move |input: crate::input::QueryPrecedenceInput| {
        1054  +
                    let sender = sender.clone();
        1055  +
                    async move {
        1056  +
                        let result = {
        1057  +
                            let expected = crate::input::QueryPrecedenceInput {
        1058  +
                                foo: ::std::option::Option::Some("named".to_owned()),
        1059  +
                                baz: ::std::option::Option::Some({
        1060  +
                                    let mut ret = ::std::collections::HashMap::new();
        1061  +
                                    ret.insert("bar".to_owned(), "named".to_owned());
        1062  +
                                    ret.insert("qux".to_owned(), "fromMap".to_owned());
        1063  +
                                    ret
        1064  +
                                }),
        1065  +
                            };
        1066  +
                            ::pretty_assertions::assert_eq!(input, expected);
        1067  +
                            let response = crate::output::QueryPrecedenceOutput {};
        1068  +
                            Ok(response)
        1069  +
                        };
        1070  +
                        sender.send(()).await.expect("receiver dropped early");
        1071  +
                        result
        1072  +
                    }
        1073  +
                })
        1074  +
                .build_unchecked();
        1075  +
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
        1076  +
            .await
        1077  +
            .expect("unable to make an HTTP request");
        1078  +
        assert!(
        1079  +
            receiver.recv().await.is_some(),
        1080  +
            "we expected operation handler to be invoked but it was not entered"
        1081  +
        );
        1082  +
    }
        1083  +
    /// Upper case error modeled lower case.
        1084  +
    /// Test ID: ServiceLevelErrorServer
        1085  +
    #[::tokio::test]
        1086  +
    #[::tracing_test::traced_test]
        1087  +
    async fn service_level_error_server_response() {
        1088  +
        let output = crate::error::ExtraError {};
        1089  +
        let output = crate::error::QueryPrecedenceError::ExtraError(output);
        1090  +
        use ::aws_smithy_http_server::response::IntoResponse;
        1091  +
        let http_response = output.into_response();
        1092  +
        ::pretty_assertions::assert_eq!(
        1093  +
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
        1094  +
            http_response.status()
        1095  +
        );
        1096  +
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
        1097  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
        1098  +
            http_response.headers(),
        1099  +
            expected_headers,
        1100  +
        ));
        1101  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
        1102  +
            .await
        1103  +
            .expect("unable to extract body to bytes");
        1104  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
        1105  +
            &body,
        1106  +
            "{}",
        1107  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
        1108  +
        ));
        1109  +
    }
        1110  +
}
        1111  +
 1633   1112   
const CONTENT_TYPE_EMPTYSTRUCTWITHCONTENTONWIREOP: ::mime::Mime = ::mime::APPLICATION_JSON;
 1634   1113   
::pin_project_lite::pin_project! {
 1635   1114   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
 1636   1115   
    /// [`EmptyStructWithContentOnWireOpInput`](crate::input::EmptyStructWithContentOnWireOpInput) using modelled bindings.
 1637   1116   
    pub struct EmptyStructWithContentOnWireOpInputFuture {
 1638   1117   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EmptyStructWithContentOnWireOpInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
 1639   1118   
    }
 1640   1119   
}
 1641   1120   
 1642   1121   
impl std::future::Future for EmptyStructWithContentOnWireOpInputFuture {
@@ -1703,1182 +1762,1274 @@
 1723   1202   
                response
 1724   1203   
            },
 1725   1204   
            Err(e) => {
 1726   1205   
                ::tracing::error!(error = %e, "failed to serialize response");
 1727   1206   
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
 1728   1207   
            }
 1729   1208   
        }
 1730   1209   
    }
 1731   1210   
}
 1732   1211   
        1212  +
#[allow(unreachable_code, unused_variables)]
        1213  +
#[cfg(test)]
        1214  +
mod empty_struct_with_content_on_wire_op_test {
        1215  +
        1216  +
    /// Upper case error modeled lower case.
        1217  +
    /// Test ID: ServiceLevelErrorServer
        1218  +
    #[::tokio::test]
        1219  +
    #[::tracing_test::traced_test]
        1220  +
    async fn service_level_error_server_response() {
        1221  +
        let output = crate::error::ExtraError {};
        1222  +
        let output = crate::error::EmptyStructWithContentOnWireOpError::ExtraError(output);
        1223  +
        use ::aws_smithy_http_server::response::IntoResponse;
        1224  +
        let http_response = output.into_response();
        1225  +
        ::pretty_assertions::assert_eq!(
        1226  +
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
        1227  +
            http_response.status()
        1228  +
        );
        1229  +
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
        1230  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
        1231  +
            http_response.headers(),
        1232  +
            expected_headers,
        1233  +
        ));
        1234  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
        1235  +
            .await
        1236  +
            .expect("unable to extract body to bytes");
        1237  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
        1238  +
            &body,
        1239  +
            "{}",
        1240  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
        1241  +
        ));
        1242  +
    }
        1243  +
}
        1244  +
 1733   1245   
const CONTENT_TYPE_CASEINSENSITIVEERROROPERATION: ::mime::Mime = ::mime::APPLICATION_JSON;
 1734   1246   
::pin_project_lite::pin_project! {
 1735   1247   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
 1736   1248   
    /// [`CaseInsensitiveErrorOperationInput`](crate::input::CaseInsensitiveErrorOperationInput) using modelled bindings.
 1737   1249   
    pub struct CaseInsensitiveErrorOperationInputFuture {
 1738   1250   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::CaseInsensitiveErrorOperationInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
 1739   1251   
    }
 1740   1252   
}
 1741   1253   
 1742   1254   
impl std::future::Future for CaseInsensitiveErrorOperationInputFuture {
@@ -1803,1315 +1862,1407 @@
 1823   1335   
                response
 1824   1336   
            },
 1825   1337   
            Err(e) => {
 1826   1338   
                ::tracing::error!(error = %e, "failed to serialize response");
 1827   1339   
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
 1828   1340   
            }
 1829   1341   
        }
 1830   1342   
    }
 1831   1343   
}
 1832   1344   
        1345  +
#[allow(unreachable_code, unused_variables)]
        1346  +
#[cfg(test)]
        1347  +
mod case_insensitive_error_operation_test {
        1348  +
        1349  +
    /// Upper case error modeled lower case.
        1350  +
    /// Test ID: ServiceLevelErrorServer
        1351  +
    #[::tokio::test]
        1352  +
    #[::tracing_test::traced_test]
        1353  +
    async fn service_level_error_server_response() {
        1354  +
        let output = crate::error::ExtraError {};
        1355  +
        let output = crate::error::CaseInsensitiveErrorOperationError::ExtraError(output);
        1356  +
        use ::aws_smithy_http_server::response::IntoResponse;
        1357  +
        let http_response = output.into_response();
        1358  +
        ::pretty_assertions::assert_eq!(
        1359  +
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
        1360  +
            http_response.status()
        1361  +
        );
        1362  +
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
        1363  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
        1364  +
            http_response.headers(),
        1365  +
            expected_headers,
        1366  +
        ));
        1367  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
        1368  +
            .await
        1369  +
            .expect("unable to extract body to bytes");
        1370  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
        1371  +
            &body,
        1372  +
            "{}",
        1373  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
        1374  +
        ));
        1375  +
    }
        1376  +
}
        1377  +
 1833   1378   
const CONTENT_TYPE_NULLINNONSPARSE: ::mime::Mime = ::mime::APPLICATION_JSON;
 1834   1379   
::pin_project_lite::pin_project! {
 1835   1380   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
 1836   1381   
    /// [`NullInNonSparseInput`](crate::input::NullInNonSparseInput) using modelled bindings.
 1837   1382   
    pub struct NullInNonSparseInputFuture {
 1838   1383   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::NullInNonSparseInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
 1839   1384   
    }
 1840   1385   
}
 1841   1386   
 1842   1387   
impl std::future::Future for NullInNonSparseInputFuture {
@@ -1911,1456 +1970,1548 @@
 1931   1476   
                response
 1932   1477   
            }
 1933   1478   
            Err(e) => {
 1934   1479   
                ::tracing::error!(error = %e, "failed to serialize response");
 1935   1480   
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
 1936   1481   
            }
 1937   1482   
        }
 1938   1483   
    }
 1939   1484   
}
 1940   1485   
        1486  +
#[allow(unreachable_code, unused_variables)]
        1487  +
#[cfg(test)]
        1488  +
mod null_in_non_sparse_test {
        1489  +
        1490  +
    /// Upper case error modeled lower case.
        1491  +
    /// Test ID: ServiceLevelErrorServer
        1492  +
    #[::tokio::test]
        1493  +
    #[::tracing_test::traced_test]
        1494  +
    async fn service_level_error_server_response() {
        1495  +
        let output = crate::error::ExtraError {};
        1496  +
        let output = crate::error::NullInNonSparseError::ExtraError(output);
        1497  +
        use ::aws_smithy_http_server::response::IntoResponse;
        1498  +
        let http_response = output.into_response();
        1499  +
        ::pretty_assertions::assert_eq!(
        1500  +
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
        1501  +
            http_response.status()
        1502  +
        );
        1503  +
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
        1504  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
        1505  +
            http_response.headers(),
        1506  +
            expected_headers,
        1507  +
        ));
        1508  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
        1509  +
            .await
        1510  +
            .expect("unable to extract body to bytes");
        1511  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
        1512  +
            &body,
        1513  +
            "{}",
        1514  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
        1515  +
        ));
        1516  +
    }
        1517  +
}
        1518  +
 1941   1519   
const CONTENT_TYPE_ESCAPEDSTRINGVALUES: ::mime::Mime = ::mime::APPLICATION_JSON;
 1942   1520   
::pin_project_lite::pin_project! {
 1943   1521   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
 1944   1522   
    /// [`EscapedStringValuesInput`](crate::input::EscapedStringValuesInput) using modelled bindings.
 1945   1523   
    pub struct EscapedStringValuesInputFuture {
 1946   1524   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EscapedStringValuesInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
 1947   1525   
    }
 1948   1526   
}
 1949   1527   
 1950   1528   
impl std::future::Future for EscapedStringValuesInputFuture {
@@ -2011,1589 +2070,1760 @@
 2031   1609   
                response
 2032   1610   
            },
 2033   1611   
            Err(e) => {
 2034   1612   
                ::tracing::error!(error = %e, "failed to serialize response");
 2035   1613   
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
 2036   1614   
            }
 2037   1615   
        }
 2038   1616   
    }
 2039   1617   
}
 2040   1618   
        1619  +
#[allow(unreachable_code, unused_variables)]
        1620  +
#[cfg(test)]
        1621  +
mod escaped_string_values_test {
        1622  +
        1623  +
    /// Test ID: EscapedStringValuesRequest
        1624  +
    #[::tokio::test]
        1625  +
    #[::tracing_test::traced_test]
        1626  +
    async fn escaped_string_values_request_request() {
        1627  +
        #[allow(unused_mut)]
        1628  +
        let mut http_request = http::Request::builder()
        1629  +
            .uri("/escaped-string-values")
        1630  +
            .method("POST")
        1631  +
            .header("Content-Type", "application/json")
        1632  +
            .body(::aws_smithy_http_server::body::Body::from(
        1633  +
                ::bytes::Bytes::from_static(
        1634  +
                    "{\"enum\":\"has\\\"quotes\",\"also\\\"has\\\"quotes\":\"test\"}".as_bytes(),
        1635  +
                ),
        1636  +
            ))
        1637  +
            .unwrap();
        1638  +
        #[allow(unused_mut)]
        1639  +
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
        1640  +
        let config = crate::service::RestJsonExtrasConfig::builder().build();
        1641  +
        let service =
        1642  +
            crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
        1643  +
                .escaped_string_values(move |input: crate::input::EscapedStringValuesInput| {
        1644  +
                    let sender = sender.clone();
        1645  +
                    async move {
        1646  +
                        let result = {
        1647  +
                            let expected = crate::input::EscapedStringValuesInput {
        1648  +
                                r#enum: ::std::option::Option::Some(
        1649  +
                                    "has\"quotes"
        1650  +
                                        .parse::<crate::model::EnumWithEscapedChars>()
        1651  +
                                        .expect("static value validated to member"),
        1652  +
                                ),
        1653  +
                                some_string: ::std::option::Option::Some("test".to_owned()),
        1654  +
                            };
        1655  +
                            ::pretty_assertions::assert_eq!(input, expected);
        1656  +
                            let response = crate::output::EscapedStringValuesOutput {
        1657  +
                                r#enum: ::std::option::Option::None,
        1658  +
                                some_string: ::std::option::Option::None,
        1659  +
                            };
        1660  +
                            Ok(response)
        1661  +
                        };
        1662  +
                        sender.send(()).await.expect("receiver dropped early");
        1663  +
                        result
        1664  +
                    }
        1665  +
                })
        1666  +
                .build_unchecked();
        1667  +
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
        1668  +
            .await
        1669  +
            .expect("unable to make an HTTP request");
        1670  +
        assert!(
        1671  +
            receiver.recv().await.is_some(),
        1672  +
            "we expected operation handler to be invoked but it was not entered"
        1673  +
        );
        1674  +
    }
        1675  +
    /// Test ID: EscapedStringValuesResponse
        1676  +
    #[::tokio::test]
        1677  +
    #[::tracing_test::traced_test]
        1678  +
    async fn escaped_string_values_response_response() {
        1679  +
        let output = crate::output::EscapedStringValuesOutput {
        1680  +
            r#enum: ::std::option::Option::Some(
        1681  +
                "has\"quotes"
        1682  +
                    .parse::<crate::model::EnumWithEscapedChars>()
        1683  +
                    .expect("static value validated to member"),
        1684  +
            ),
        1685  +
            some_string: ::std::option::Option::Some("test".to_owned()),
        1686  +
        };
        1687  +
        use ::aws_smithy_http_server::response::IntoResponse;
        1688  +
        let http_response = output.into_response();
        1689  +
        ::pretty_assertions::assert_eq!(
        1690  +
            http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
        1691  +
            http_response.status()
        1692  +
        );
        1693  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
        1694  +
            .await
        1695  +
            .expect("unable to extract body to bytes");
        1696  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
        1697  +
            &body,
        1698  +
            "{\"enum\":\"has\\\"quotes\",\"also\\\"has\\\"quotes\":\"test\"}",
        1699  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
        1700  +
        ));
        1701  +
    }
        1702  +
    /// Upper case error modeled lower case.
        1703  +
    /// Test ID: ServiceLevelErrorServer
        1704  +
    #[::tokio::test]
        1705  +
    #[::tracing_test::traced_test]
        1706  +
    async fn service_level_error_server_response() {
        1707  +
        let output = crate::error::ExtraError {};
        1708  +
        let output = crate::error::EscapedStringValuesError::ExtraError(output);
        1709  +
        use ::aws_smithy_http_server::response::IntoResponse;
        1710  +
        let http_response = output.into_response();
        1711  +
        ::pretty_assertions::assert_eq!(
        1712  +
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
        1713  +
            http_response.status()
        1714  +
        );
        1715  +
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
        1716  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
        1717  +
            http_response.headers(),
        1718  +
            expected_headers,
        1719  +
        ));
        1720  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
        1721  +
            .await
        1722  +
            .expect("unable to extract body to bytes");
        1723  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
        1724  +
            &body,
        1725  +
            "{}",
        1726  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
        1727  +
        ));
        1728  +
    }
        1729  +
}
        1730  +
 2041   1731   
const CONTENT_TYPE_PRIMITIVEINTOP: ::mime::Mime = ::mime::APPLICATION_JSON;
 2042   1732   
::pin_project_lite::pin_project! {
 2043   1733   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
 2044   1734   
    /// [`PrimitiveIntOpInput`](crate::input::PrimitiveIntOpInput) using modelled bindings.
 2045   1735   
    pub struct PrimitiveIntOpInputFuture {
 2046   1736   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PrimitiveIntOpInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
 2047   1737   
    }
 2048   1738   
}
 2049   1739   
 2050   1740   
impl std::future::Future for PrimitiveIntOpInputFuture {
@@ -2116,1806 +2175,1898 @@
 2136   1826   
                response
 2137   1827   
            }
 2138   1828   
            Err(e) => {
 2139   1829   
                ::tracing::error!(error = %e, "failed to serialize response");
 2140   1830   
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
 2141   1831   
            }
 2142   1832   
        }
 2143   1833   
    }
 2144   1834   
}
 2145   1835   
        1836  +
#[allow(unreachable_code, unused_variables)]
        1837  +
#[cfg(test)]
        1838  +
mod primitive_int_op_test {
        1839  +
        1840  +
    /// Upper case error modeled lower case.
        1841  +
    /// Test ID: ServiceLevelErrorServer
        1842  +
    #[::tokio::test]
        1843  +
    #[::tracing_test::traced_test]
        1844  +
    async fn service_level_error_server_response() {
        1845  +
        let output = crate::error::ExtraError {};
        1846  +
        let output = crate::error::PrimitiveIntOpError::ExtraError(output);
        1847  +
        use ::aws_smithy_http_server::response::IntoResponse;
        1848  +
        let http_response = output.into_response();
        1849  +
        ::pretty_assertions::assert_eq!(
        1850  +
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
        1851  +
            http_response.status()
        1852  +
        );
        1853  +
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
        1854  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
        1855  +
            http_response.headers(),
        1856  +
            expected_headers,
        1857  +
        ));
        1858  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
        1859  +
            .await
        1860  +
            .expect("unable to extract body to bytes");
        1861  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
        1862  +
            &body,
        1863  +
            "{}",
        1864  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
        1865  +
        ));
        1866  +
    }
        1867  +
}
        1868  +
 2146   1869   
const CONTENT_TYPE_MAPWITHENUMKEYOP: ::mime::Mime = ::mime::APPLICATION_JSON;
 2147   1870   
::pin_project_lite::pin_project! {
 2148   1871   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
 2149   1872   
    /// [`MapWithEnumKeyOpInput`](crate::input::MapWithEnumKeyOpInput) using modelled bindings.
 2150   1873   
    pub struct MapWithEnumKeyOpInputFuture {
 2151   1874   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MapWithEnumKeyOpInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
 2152   1875   
    }
 2153   1876   
}
 2154   1877   
 2155   1878   
impl std::future::Future for MapWithEnumKeyOpInputFuture {
@@ -2222,1945 +2281,2121 @@
 2242   1965   
                response
 2243   1966   
            }
 2244   1967   
            Err(e) => {
 2245   1968   
                ::tracing::error!(error = %e, "failed to serialize response");
 2246   1969   
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
 2247   1970   
            }
 2248   1971   
        }
 2249   1972   
    }
 2250   1973   
}
 2251   1974   
        1975  +
#[allow(unreachable_code, unused_variables)]
        1976  +
#[cfg(test)]
        1977  +
mod map_with_enum_key_op_test {
        1978  +
        1979  +
    /// Test ID: MapWithEnumKeyRequest
        1980  +
    #[::tokio::test]
        1981  +
    #[::tracing_test::traced_test]
        1982  +
    async fn map_with_enum_key_request_request() {
        1983  +
        #[allow(unused_mut)]
        1984  +
        let mut http_request = http::Request::builder()
        1985  +
            .uri("/map-with-enum-key")
        1986  +
            .method("POST")
        1987  +
            .header("Content-Type", "application/json")
        1988  +
            .body(::aws_smithy_http_server::body::Body::from(
        1989  +
                ::bytes::Bytes::from_static("{\"map\":{\"enumvalue\":\"something\"}}".as_bytes()),
        1990  +
            ))
        1991  +
            .unwrap();
        1992  +
        #[allow(unused_mut)]
        1993  +
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
        1994  +
        let config = crate::service::RestJsonExtrasConfig::builder().build();
        1995  +
        let service =
        1996  +
            crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
        1997  +
                .map_with_enum_key_op(move |input: crate::input::MapWithEnumKeyOpInput| {
        1998  +
                    let sender = sender.clone();
        1999  +
                    async move {
        2000  +
                        let result = {
        2001  +
                            let expected = crate::input::MapWithEnumKeyOpInput {
        2002  +
                                map: ::std::option::Option::Some({
        2003  +
                                    let mut ret = ::std::collections::HashMap::new();
        2004  +
                                    ret.insert(
        2005  +
                                        "enumvalue"
        2006  +
                                            .parse::<crate::model::StringEnum>()
        2007  +
                                            .expect("static value validated to member"),
        2008  +
                                        "something".to_owned(),
        2009  +
                                    );
        2010  +
                                    ret
        2011  +
                                }),
        2012  +
                            };
        2013  +
                            ::pretty_assertions::assert_eq!(input, expected);
        2014  +
                            let response = crate::output::MapWithEnumKeyOpOutput {
        2015  +
                                map: ::std::option::Option::None,
        2016  +
                            };
        2017  +
                            Ok(response)
        2018  +
                        };
        2019  +
                        sender.send(()).await.expect("receiver dropped early");
        2020  +
                        result
        2021  +
                    }
        2022  +
                })
        2023  +
                .build_unchecked();
        2024  +
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
        2025  +
            .await
        2026  +
            .expect("unable to make an HTTP request");
        2027  +
        assert!(
        2028  +
            receiver.recv().await.is_some(),
        2029  +
            "we expected operation handler to be invoked but it was not entered"
        2030  +
        );
        2031  +
    }
        2032  +
    /// Test ID: MapWithEnumKeyResponse
        2033  +
    #[::tokio::test]
        2034  +
    #[::tracing_test::traced_test]
        2035  +
    async fn map_with_enum_key_response_response() {
        2036  +
        let output = crate::output::MapWithEnumKeyOpOutput {
        2037  +
            map: ::std::option::Option::Some({
        2038  +
                let mut ret = ::std::collections::HashMap::new();
        2039  +
                ret.insert(
        2040  +
                    "enumvalue"
        2041  +
                        .parse::<crate::model::StringEnum>()
        2042  +
                        .expect("static value validated to member"),
        2043  +
                    "something".to_owned(),
        2044  +
                );
        2045  +
                ret
        2046  +
            }),
        2047  +
        };
        2048  +
        use ::aws_smithy_http_server::response::IntoResponse;
        2049  +
        let http_response = output.into_response();
        2050  +
        ::pretty_assertions::assert_eq!(
        2051  +
            http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
        2052  +
            http_response.status()
        2053  +
        );
        2054  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
        2055  +
            .await
        2056  +
            .expect("unable to extract body to bytes");
        2057  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
        2058  +
            &body,
        2059  +
            "{\"map\":{\"enumvalue\":\"something\"}}",
        2060  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
        2061  +
        ));
        2062  +
    }
        2063  +
    /// Upper case error modeled lower case.
        2064  +
    /// Test ID: ServiceLevelErrorServer
        2065  +
    #[::tokio::test]
        2066  +
    #[::tracing_test::traced_test]
        2067  +
    async fn service_level_error_server_response() {
        2068  +
        let output = crate::error::ExtraError {};
        2069  +
        let output = crate::error::MapWithEnumKeyOpError::ExtraError(output);
        2070  +
        use ::aws_smithy_http_server::response::IntoResponse;
        2071  +
        let http_response = output.into_response();
        2072  +
        ::pretty_assertions::assert_eq!(
        2073  +
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
        2074  +
            http_response.status()
        2075  +
        );
        2076  +
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
        2077  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
        2078  +
            http_response.headers(),
        2079  +
            expected_headers,
        2080  +
        ));
        2081  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
        2082  +
            .await
        2083  +
            .expect("unable to extract body to bytes");
        2084  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
        2085  +
            &body,
        2086  +
            "{}",
        2087  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
        2088  +
        ));
        2089  +
    }
        2090  +
}
        2091  +
 2252   2092   
const CONTENT_TYPE_STATUSRESPONSE: ::mime::Mime = ::mime::APPLICATION_JSON;
 2253   2093   
::pin_project_lite::pin_project! {
 2254   2094   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
 2255   2095   
    /// [`StatusResponseInput`](crate::input::StatusResponseInput) using modelled bindings.
 2256   2096   
    pub struct StatusResponseInputFuture {
 2257   2097   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::StatusResponseInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
 2258   2098   
    }
 2259   2099   
}
 2260   2100   
 2261   2101   
impl std::future::Future for StatusResponseInputFuture {
@@ -2325,2165 +2384,2257 @@
 2345   2185   
                response
 2346   2186   
            }
 2347   2187   
            Err(e) => {
 2348   2188   
                ::tracing::error!(error = %e, "failed to serialize response");
 2349   2189   
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
 2350   2190   
            }
 2351   2191   
        }
 2352   2192   
    }
 2353   2193   
}
 2354   2194   
        2195  +
#[allow(unreachable_code, unused_variables)]
        2196  +
#[cfg(test)]
        2197  +
mod status_response_test {
        2198  +
        2199  +
    /// Upper case error modeled lower case.
        2200  +
    /// Test ID: ServiceLevelErrorServer
        2201  +
    #[::tokio::test]
        2202  +
    #[::tracing_test::traced_test]
        2203  +
    async fn service_level_error_server_response() {
        2204  +
        let output = crate::error::ExtraError {};
        2205  +
        let output = crate::error::StatusResponseError::ExtraError(output);
        2206  +
        use ::aws_smithy_http_server::response::IntoResponse;
        2207  +
        let http_response = output.into_response();
        2208  +
        ::pretty_assertions::assert_eq!(
        2209  +
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
        2210  +
            http_response.status()
        2211  +
        );
        2212  +
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
        2213  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
        2214  +
            http_response.headers(),
        2215  +
            expected_headers,
        2216  +
        ));
        2217  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
        2218  +
            .await
        2219  +
            .expect("unable to extract body to bytes");
        2220  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
        2221  +
            &body,
        2222  +
            "{}",
        2223  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
        2224  +
        ));
        2225  +
    }
        2226  +
}
        2227  +
 2355   2228   
const CONTENT_TYPE_ENUMQUERY: ::mime::Mime = ::mime::APPLICATION_JSON;
 2356   2229   
::pin_project_lite::pin_project! {
 2357   2230   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
 2358   2231   
    /// [`EnumQueryInput`](crate::input::EnumQueryInput) using modelled bindings.
 2359   2232   
    pub struct EnumQueryInputFuture {
 2360   2233   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EnumQueryInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
 2361   2234   
    }
 2362   2235   
}
 2363   2236   
 2364   2237   
impl std::future::Future for EnumQueryInputFuture {
@@ -2427,2300 +2486,2433 @@
 2447   2320   
                response
 2448   2321   
            }
 2449   2322   
            Err(e) => {
 2450   2323   
                ::tracing::error!(error = %e, "failed to serialize response");
 2451   2324   
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
 2452   2325   
            }
 2453   2326   
        }
 2454   2327   
    }
 2455   2328   
}
 2456   2329   
        2330  +
#[allow(unreachable_code, unused_variables)]
        2331  +
#[cfg(test)]
        2332  +
mod enum_query_test {
        2333  +
        2334  +
    /// Test ID: EnumQueryRequest
        2335  +
    #[::tokio::test]
        2336  +
    #[::tracing_test::traced_test]
        2337  +
    async fn enum_query_request_request() {
        2338  +
        #[allow(unused_mut)]
        2339  +
        let mut http_request = http::Request::builder()
        2340  +
            .uri("/foo/enumvalue")
        2341  +
            .method("GET")
        2342  +
            .body(::aws_smithy_http_server::body::Body::empty())
        2343  +
            .unwrap();
        2344  +
        #[allow(unused_mut)]
        2345  +
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
        2346  +
        let config = crate::service::RestJsonExtrasConfig::builder().build();
        2347  +
        let service =
        2348  +
            crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
        2349  +
                .enum_query(move |input: crate::input::EnumQueryInput| {
        2350  +
                    let sender = sender.clone();
        2351  +
                    async move {
        2352  +
                        let result = {
        2353  +
                            let expected = crate::input::EnumQueryInput {
        2354  +
                                r#enum: "enumvalue"
        2355  +
                                    .parse::<crate::model::StringEnum>()
        2356  +
                                    .expect("static value validated to member"),
        2357  +
                            };
        2358  +
                            ::pretty_assertions::assert_eq!(input, expected);
        2359  +
                            let response = crate::output::EnumQueryOutput {};
        2360  +
                            Ok(response)
        2361  +
                        };
        2362  +
                        sender.send(()).await.expect("receiver dropped early");
        2363  +
                        result
        2364  +
                    }
        2365  +
                })
        2366  +
                .build_unchecked();
        2367  +
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
        2368  +
            .await
        2369  +
            .expect("unable to make an HTTP request");
        2370  +
        assert!(
        2371  +
            receiver.recv().await.is_some(),
        2372  +
            "we expected operation handler to be invoked but it was not entered"
        2373  +
        );
        2374  +
    }
        2375  +
    /// Upper case error modeled lower case.
        2376  +
    /// Test ID: ServiceLevelErrorServer
        2377  +
    #[::tokio::test]
        2378  +
    #[::tracing_test::traced_test]
        2379  +
    async fn service_level_error_server_response() {
        2380  +
        let output = crate::error::ExtraError {};
        2381  +
        let output = crate::error::EnumQueryError::ExtraError(output);
        2382  +
        use ::aws_smithy_http_server::response::IntoResponse;
        2383  +
        let http_response = output.into_response();
        2384  +
        ::pretty_assertions::assert_eq!(
        2385  +
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
        2386  +
            http_response.status()
        2387  +
        );
        2388  +
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
        2389  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
        2390  +
            http_response.headers(),
        2391  +
            expected_headers,
        2392  +
        ));
        2393  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
        2394  +
            .await
        2395  +
            .expect("unable to extract body to bytes");
        2396  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
        2397  +
            &body,
        2398  +
            "{}",
        2399  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
        2400  +
        ));
        2401  +
    }
        2402  +
}
        2403  +
 2457   2404   
const CONTENT_TYPE_PRIMITIVEINTHEADER: ::mime::Mime = ::mime::APPLICATION_JSON;
 2458   2405   
::pin_project_lite::pin_project! {
 2459   2406   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
 2460   2407   
    /// [`PrimitiveIntHeaderInput`](crate::input::PrimitiveIntHeaderInput) using modelled bindings.
 2461   2408   
    pub struct PrimitiveIntHeaderInputFuture {
 2462   2409   
        inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PrimitiveIntHeaderInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
 2463   2410   
    }
 2464   2411   
}
 2465   2412   
 2466   2413   
impl std::future::Future for PrimitiveIntHeaderInputFuture {
@@ -2533,2480 +2592,2601 @@
 2553   2500   
                response
 2554   2501   
            }
 2555   2502   
            Err(e) => {
 2556   2503   
                ::tracing::error!(error = %e, "failed to serialize response");
 2557   2504   
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
 2558   2505   
            }
 2559   2506   
        }
 2560   2507   
    }
 2561   2508   
}
 2562   2509   
        2510  +
#[allow(unreachable_code, unused_variables)]
        2511  +
#[cfg(test)]
        2512  +
mod primitive_int_header_test {
        2513  +
        2514  +
    /// Test ID: DeserPrimitiveHeader
        2515  +
    #[::tokio::test]
        2516  +
    #[::tracing_test::traced_test]
        2517  +
    async fn deser_primitive_header_response() {
        2518  +
        let output = crate::output::PrimitiveIntHeaderOutput { field: 123 };
        2519  +
        use ::aws_smithy_http_server::response::IntoResponse;
        2520  +
        let http_response = output.into_response();
        2521  +
        ::pretty_assertions::assert_eq!(
        2522  +
            http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
        2523  +
            http_response.status()
        2524  +
        );
        2525  +
        let expected_headers = [("x-field", "123")];
        2526  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
        2527  +
            http_response.headers(),
        2528  +
            expected_headers,
        2529  +
        ));
        2530  +
    }
        2531  +
    /// Test ID: DeserPrimitiveHeaderMissing
        2532  +
    #[::tokio::test]
        2533  +
    #[::tracing_test::traced_test]
        2534  +
    async fn deser_primitive_header_missing_response() {
        2535  +
        let output = crate::output::PrimitiveIntHeaderOutput { field: 0 };
        2536  +
        use ::aws_smithy_http_server::response::IntoResponse;
        2537  +
        let http_response = output.into_response();
        2538  +
        ::pretty_assertions::assert_eq!(
        2539  +
            http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
        2540  +
            http_response.status()
        2541  +
        );
        2542  +
    }
        2543  +
    /// Upper case error modeled lower case.
        2544  +
    /// Test ID: ServiceLevelErrorServer
        2545  +
    #[::tokio::test]
        2546  +
    #[::tracing_test::traced_test]
        2547  +
    async fn service_level_error_server_response() {
        2548  +
        let output = crate::error::ExtraError {};
        2549  +
        let output = crate::error::PrimitiveIntHeaderError::ExtraError(output);
        2550  +
        use ::aws_smithy_http_server::response::IntoResponse;
        2551  +
        let http_response = output.into_response();
        2552  +
        ::pretty_assertions::assert_eq!(
        2553  +
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
        2554  +
            http_response.status()
        2555  +
        );
        2556  +
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
        2557  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
        2558  +
            http_response.headers(),
        2559  +
            expected_headers,
        2560  +
        ));
        2561  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
        2562  +
            .await
        2563  +
            .expect("unable to extract body to bytes");
        2564  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
        2565  +
            &body,
        2566  +
            "{}",
        2567  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
        2568  +
        ));
        2569  +
    }
        2570  +
}
        2571  +
 2563   2572   
static CONTENT_TYPE_STRINGPAYLOAD: ::once_cell::sync::Lazy<::mime::Mime> =
 2564   2573   
    ::once_cell::sync::Lazy::new(|| {
 2565   2574   
        "text/plain"
 2566   2575   
            .parse::<::mime::Mime>()
 2567   2576   
            .expect("BUG: MIME parsing failed, content_type is not valid")
 2568   2577   
    });
 2569   2578   
::pin_project_lite::pin_project! {
 2570   2579   
    /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
 2571   2580   
    /// [`StringPayloadInput`](crate::input::StringPayloadInput) using modelled bindings.
 2572   2581   
    pub struct StringPayloadInputFuture {
@@ -2639,2648 +0,2754 @@
 2659   2668   
                );
 2660   2669   
                response
 2661   2670   
            }
 2662   2671   
            Err(e) => {
 2663   2672   
                ::tracing::error!(error = %e, "failed to serialize response");
 2664   2673   
                ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
 2665   2674   
            }
 2666   2675   
        }
 2667   2676   
    }
 2668   2677   
}
        2678  +
        2679  +
#[allow(unreachable_code, unused_variables)]
        2680  +
#[cfg(test)]
        2681  +
mod string_payload_test {
        2682  +
        2683  +
    /// Test ID: StringPayload
        2684  +
    #[::tokio::test]
        2685  +
    #[::tracing_test::traced_test]
        2686  +
    async fn string_payload_request() {
        2687  +
        #[allow(unused_mut)]
        2688  +
        let mut http_request = http::Request::builder()
        2689  +
            .uri("/StringPayload")
        2690  +
            .method("POST")
        2691  +
            .header("Content-Type", "text/plain")
        2692  +
            .body(::aws_smithy_http_server::body::Body::from(
        2693  +
                ::bytes::Bytes::from_static("rawstring".as_bytes()),
        2694  +
            ))
        2695  +
            .unwrap();
        2696  +
        #[allow(unused_mut)]
        2697  +
        let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
        2698  +
        let config = crate::service::RestJsonExtrasConfig::builder().build();
        2699  +
        let service =
        2700  +
            crate::service::RestJsonExtras::builder::<::hyper::body::Body, _, _, _>(config)
        2701  +
                .string_payload(move |input: crate::input::StringPayloadInput| {
        2702  +
                    let sender = sender.clone();
        2703  +
                    async move {
        2704  +
                        let result = {
        2705  +
                            let expected = crate::input::StringPayloadInput {
        2706  +
                                payload: ::std::option::Option::Some("rawstring".to_owned()),
        2707  +
                            };
        2708  +
                            ::pretty_assertions::assert_eq!(input, expected);
        2709  +
                            let response = crate::output::StringPayloadOutput {
        2710  +
                                payload: ::std::option::Option::None,
        2711  +
                            };
        2712  +
                            Ok(response)
        2713  +
                        };
        2714  +
                        sender.send(()).await.expect("receiver dropped early");
        2715  +
                        result
        2716  +
                    }
        2717  +
                })
        2718  +
                .build_unchecked();
        2719  +
        let http_response = ::tower::ServiceExt::oneshot(service, http_request)
        2720  +
            .await
        2721  +
            .expect("unable to make an HTTP request");
        2722  +
        assert!(
        2723  +
            receiver.recv().await.is_some(),
        2724  +
            "we expected operation handler to be invoked but it was not entered"
        2725  +
        );
        2726  +
    }
        2727  +
    /// Upper case error modeled lower case.
        2728  +
    /// Test ID: ServiceLevelErrorServer
        2729  +
    #[::tokio::test]
        2730  +
    #[::tracing_test::traced_test]
        2731  +
    async fn service_level_error_server_response() {
        2732  +
        let output = crate::error::ExtraError {};
        2733  +
        let output = crate::error::StringPayloadError::ExtraError(output);
        2734  +
        use ::aws_smithy_http_server::response::IntoResponse;
        2735  +
        let http_response = output.into_response();
        2736  +
        ::pretty_assertions::assert_eq!(
        2737  +
            http::StatusCode::from_u16(500).expect("invalid expected HTTP status code"),
        2738  +
            http_response.status()
        2739  +
        );
        2740  +
        let expected_headers = [("X-Amzn-Errortype", "ExtraError")];
        2741  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
        2742  +
            http_response.headers(),
        2743  +
            expected_headers,
        2744  +
        ));
        2745  +
        let body = ::hyper::body::to_bytes(http_response.into_body())
        2746  +
            .await
        2747  +
            .expect("unable to extract body to bytes");
        2748  +
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
        2749  +
            &body,
        2750  +
            "{}",
        2751  +
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
        2752  +
        ));
        2753  +
    }
        2754  +
}