Server Test

Server Test

rev. d06a46cae0f385cdae37a9f8264db3469a090ab5 (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_checksum_required.rs

@@ -1,1 +114,166 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_http_checksum_required_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpChecksumRequiredInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::http_checksum_required_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        let bytes = ::hyper::body::to_bytes(body).await?;
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:789 */
          30  +
        let bytes = {
          31  +
            use ::http_body_util::BodyExt;
          32  +
            body.collect().await?.to_bytes()
          33  +
        };
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:825 */
   23     35   
        if !bytes.is_empty() {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:826 */
   24     37   
            ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   25     38   
                &headers,
   26     39   
                Some("application/json"),
   27     40   
            )?;
   28     41   
            input = crate::protocol_serde::shape_http_checksum_required::de_http_checksum_required(
   29     42   
                bytes.as_ref(),
   30     43   
                input,
   31     44   
            )?;
          45  +
            /* ServerHttpBoundProtocolGenerator.kt:825 */
   32     46   
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   33     48   
        input.build()
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   34     50   
    })
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   35     52   
}
   36     53   
          54  +
/* RustType.kt:534 */
   37     55   
#[allow(clippy::unnecessary_wraps)]
          56  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   38     57   
pub fn ser_http_checksum_required_http_response(
   39     58   
    #[allow(unused_variables)] output: crate::output::HttpChecksumRequiredOutput,
   40     59   
) -> std::result::Result<
   41     60   
    ::aws_smithy_http_server::response::Response,
   42     61   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     62   
> {
          63  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   44     64   
    Ok({
          65  +
        /* RustType.kt:534 */
   45     66   
        #[allow(unused_mut)]
   46         -
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          68  +
        let mut builder = ::http_1x::Response::builder();
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   47     70   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     71   
            builder,
   49         -
            ::http::header::CONTENT_TYPE,
          72  +
            ::http_1x::header::CONTENT_TYPE,
   50     73   
            "application/json",
   51     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   52     76   
        let http_status: u16 = 200;
   53     77   
        builder = builder.status(http_status);
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   54     79   
        let payload =
   55         -
            crate::protocol_serde::shape_http_checksum_required_output::ser_http_checksum_required_output_output_output(&output)?
   56         -
        ;
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_http_checksum_required_output::ser_http_checksum_required_output_output_output(&output)?
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   57     83   
        let content_length = payload.len();
   58     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     85   
            builder,
   60         -
            ::http::header::CONTENT_LENGTH,
          86  +
            ::http_1x::header::CONTENT_LENGTH,
   61     87   
            content_length,
   62     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   63     90   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   64     92   
        builder.body(body)?
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   65     94   
    })
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   66     96   
}
   67     97   
          98  +
/* JsonParserGenerator.kt:148 */
   68     99   
pub(crate) fn de_http_checksum_required(
   69    100   
    value: &[u8],
   70    101   
    mut builder: crate::input::http_checksum_required_input::Builder,
   71    102   
) -> ::std::result::Result<
   72    103   
    crate::input::http_checksum_required_input::Builder,
   73    104   
    ::aws_smithy_json::deserialize::error::DeserializeError,
   74    105   
> {
         106  +
    /* JsonParserGenerator.kt:153 */
   75    107   
    let mut tokens_owned =
   76    108   
        ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value))
   77    109   
            .peekable();
   78    110   
    let tokens = &mut tokens_owned;
   79    111   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;
         112  +
    /* JsonParserGenerator.kt:684 */
   80    113   
    loop {
         114  +
        /* JsonParserGenerator.kt:685 */
   81    115   
        match tokens.next().transpose()? {
         116  +
            /* JsonParserGenerator.kt:686 */
   82    117   
            Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break,
   83    118   
            Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => {
         119  +
                /* JsonParserGenerator.kt:260 */
   84    120   
                match key.to_unescaped()?.as_ref() {
         121  +
                    /* JsonParserGenerator.kt:262 */
   85    122   
                    "foo" => {
         123  +
                        /* JsonParserGenerator.kt:272 */
   86    124   
                        builder = builder.set_foo(
         125  +
                            /* JsonParserGenerator.kt:354 */
   87    126   
                            ::aws_smithy_json::deserialize::token::expect_string_or_null(
   88    127   
                                tokens.next(),
   89    128   
                            )?
   90         -
                            .map(|s| s.to_unescaped().map(|u| u.into_owned()))
   91         -
                            .transpose()?,
         129  +
                            .map(|s|
         130  +
                                /* JsonParserGenerator.kt:339 */s.to_unescaped().map(|u|
         131  +
                                    /* JsonParserGenerator.kt:348 */u.into_owned()
         132  +
                                /* JsonParserGenerator.kt:339 */) /* JsonParserGenerator.kt:354 */)
         133  +
                            .transpose()?, /* JsonParserGenerator.kt:272 */
   92    134   
                        );
         135  +
                        /* JsonParserGenerator.kt:262 */
   93    136   
                    }
   94         -
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?,
         137  +
                    /* JsonParserGenerator.kt:290 */
         138  +
                    _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)?, /* JsonParserGenerator.kt:260 */
   95    139   
                }
         140  +
                /* JsonParserGenerator.kt:686 */
   96    141   
            }
         142  +
            /* JsonParserGenerator.kt:695 */
   97    143   
            other => {
   98    144   
                return Err(
   99    145   
                    ::aws_smithy_json::deserialize::error::DeserializeError::custom(format!(
  100    146   
                        "expected object key or end object, found: {other:?}"
  101    147   
                    )),
  102    148   
                )
         149  +
            } /* JsonParserGenerator.kt:685 */
  103    150   
        }
         151  +
        /* JsonParserGenerator.kt:684 */
  104    152   
    }
  105         -
    }
         153  +
    /* JsonParserGenerator.kt:250 */
  106    154   
    if tokens.next().is_some() {
         155  +
        /* JsonParserGenerator.kt:251 */
  107    156   
        return Err(
  108    157   
            ::aws_smithy_json::deserialize::error::DeserializeError::custom(
  109    158   
                "found more JSON tokens after completing parsing",
  110    159   
            ),
  111    160   
        );
         161  +
        /* JsonParserGenerator.kt:250 */
  112    162   
    }
         163  +
    /* JsonParserGenerator.kt:163 */
  113    164   
    Ok(builder)
         165  +
    /* JsonParserGenerator.kt:148 */
  114    166   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_checksum_required_output.rs

@@ -1,1 +20,31 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_http_checksum_required_output_output_output(
    3      4   
    value: &crate::output::HttpChecksumRequiredOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_http_checksum_required_output::ser_http_checksum_required_output_output(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_http_checksum_required_output_output(
   13     19   
    object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    input: &crate::output::HttpChecksumRequiredOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:382 */
   16     23   
    if let Some(var_1) = &input.foo {
          24  +
        /* JsonSerializerGenerator.kt:423 */
   17     25   
        object.key("foo").string(var_1.as_str());
          26  +
        /* JsonSerializerGenerator.kt:382 */
   18     27   
    }
          28  +
    /* JsonSerializerGenerator.kt:372 */
   19     29   
    Ok(())
          30  +
    /* JsonSerializerGenerator.kt:358 */
   20     31   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_empty_prefix_headers.rs

@@ -1,1 +112,154 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_http_empty_prefix_headers_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpEmptyPrefixHeadersInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::http_empty_prefix_headers_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   22     30   
        if let Some(value) = crate::protocol_serde::shape_http_empty_prefix_headers_input::de_prefix_headers_prefix_header(&headers)? {
   23     31   
                                input = input.set_prefix_headers(Some(value))
   24     32   
                            }
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   25     34   
        if let Some(value) =
   26     35   
            crate::protocol_serde::shape_http_empty_prefix_headers_input::de_specific_header_header(
   27     36   
                &headers,
   28     37   
            )?
   29     38   
        {
   30     39   
            input = input.set_specific_header(Some(value))
   31     40   
        }
          41  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   32     42   
        input.build()
          43  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   33     44   
    })
          45  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   34     46   
}
   35     47   
          48  +
/* RustType.kt:534 */
   36     49   
#[allow(clippy::unnecessary_wraps)]
          50  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   37     51   
pub fn ser_http_empty_prefix_headers_http_response(
   38     52   
    #[allow(unused_variables)] output: crate::output::HttpEmptyPrefixHeadersOutput,
   39     53   
) -> std::result::Result<
   40     54   
    ::aws_smithy_http_server::response::Response,
   41     55   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   42     56   
> {
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   43     58   
    Ok({
          59  +
        /* RustType.kt:534 */
   44     60   
        #[allow(unused_mut)]
   45         -
        let mut builder = ::http::Response::builder();
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          62  +
        let mut builder = ::http_1x::Response::builder();
          63  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
   46     64   
        builder = crate::protocol_serde::shape_http_empty_prefix_headers::ser_http_empty_prefix_headers_headers(&output, builder)?;
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   47     66   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     67   
            builder,
   49         -
            ::http::header::CONTENT_TYPE,
          68  +
            ::http_1x::header::CONTENT_TYPE,
   50     69   
            "application/json",
   51     70   
        );
          71  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   52     72   
        let http_status: u16 = 200;
   53     73   
        builder = builder.status(http_status);
          74  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   54     75   
        let payload =
   55         -
            crate::protocol_serde::shape_http_empty_prefix_headers_output::ser_http_empty_prefix_headers_output_output_output(&output)?
   56         -
        ;
          76  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_http_empty_prefix_headers_output::ser_http_empty_prefix_headers_output_output_output(&output)?
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   57     79   
        let content_length = payload.len();
   58     80   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     81   
            builder,
   60         -
            ::http::header::CONTENT_LENGTH,
          82  +
            ::http_1x::header::CONTENT_LENGTH,
   61     83   
            content_length,
   62     84   
        );
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   63     86   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   64     88   
        builder.body(body)?
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   65     90   
    })
          91  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   66     92   
}
   67     93   
          94  +
/* HttpBindingGenerator.kt:565 */
   68     95   
pub fn ser_http_empty_prefix_headers_headers(
   69     96   
    input: &crate::output::HttpEmptyPrefixHeadersOutput,
   70         -
    mut builder: ::http::response::Builder,
   71         -
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   72         -
{
          97  +
    mut builder: ::http_1x::response::Builder,
          98  +
) -> std::result::Result<
          99  +
    ::http_1x::response::Builder,
         100  +
    ::aws_smithy_types::error::operation::BuildError,
         101  +
> {
         102  +
    /* HttpBindingGenerator.kt:615 */
   73    103   
    if let ::std::option::Option::Some(inner_1) = &input.specific_header {
         104  +
        /* HttpBindingGenerator.kt:727 */
   74    105   
        let formatted_2 = inner_1.as_str();
         106  +
        /* HttpBindingGenerator.kt:728 */
   75    107   
        if !formatted_2.is_empty() {
         108  +
            /* HttpBindingGenerator.kt:729 */
   76    109   
            let header_value = formatted_2;
   77         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         110  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   78    111   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   79    112   
                    "specific_header",
   80    113   
                    format!(
   81    114   
                        "`{}` cannot be used as a header value: {}",
   82    115   
                        &header_value, err
   83    116   
                    ),
   84    117   
                )
   85    118   
            })?;
   86    119   
            builder = builder.header("hello", header_value);
         120  +
            /* HttpBindingGenerator.kt:728 */
   87    121   
        }
         122  +
        /* HttpBindingGenerator.kt:615 */
   88    123   
    }
         124  +
    /* HttpBindingGenerator.kt:764 */
   89    125   
    if let ::std::option::Option::Some(inner_3) = &input.prefix_headers {
         126  +
        /* HttpBindingGenerator.kt:764 */
   90    127   
        {
         128  +
            /* HttpBindingGenerator.kt:770 */
   91    129   
            for (k, v) in inner_3 {
   92    130   
                use std::str::FromStr;
   93         -
                let header_name = http::header::HeaderName::from_str(&format!("{}{}", "", &k))
         131  +
                let header_name = ::http_1x::HeaderName::from_str(&format!("{}{}", "", &k))
   94    132   
                    .map_err(|err| {
   95    133   
                        ::aws_smithy_types::error::operation::BuildError::invalid_field(
   96    134   
                            "prefix_headers",
   97    135   
                            format!("`{k}` cannot be used as a header name: {err}"),
   98    136   
                        )
   99    137   
                    })?;
  100    138   
                let header_value = v.as_str();
  101         -
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         139  +
                let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
  102    140   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  103    141   
                        "prefix_headers",
  104    142   
                        format!("`{v}` cannot be used as a header value: {err}"),
  105    143   
                    )
  106    144   
                })?;
  107    145   
                builder = builder.header(header_name, header_value);
  108    146   
            }
         147  +
            /* HttpBindingGenerator.kt:764 */
  109    148   
        }
         149  +
        /* HttpBindingGenerator.kt:764 */
  110    150   
    }
         151  +
    /* HttpBindingGenerator.kt:578 */
  111    152   
    Ok(builder)
         153  +
    /* HttpBindingGenerator.kt:565 */
  112    154   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_empty_prefix_headers_input.rs

@@ -1,1 +35,46 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:190 */
    2      3   
pub(crate) fn de_prefix_headers_prefix_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<
    6      7   
        ::std::collections::HashMap<::std::string::String, ::std::string::String>,
    7      8   
    >,
    8      9   
    ::aws_smithy_http::header::ParseError,
    9     10   
> {
          11  +
    /* HttpBindingGenerator.kt:196 */
   10     12   
    let headers =
   11     13   
        ::aws_smithy_http::header::headers_for_prefix(header_map.iter().map(|(k, _)| k), "");
   12     14   
    let out: std::result::Result<_, _> = headers.map(|(key, header_name)| {
   13     15   
                            let values = header_map.get_all(header_name);
   14     16   
                            crate::protocol_serde::shape_http_empty_prefix_headers_input::de_prefix_headers_inner(values).map(|v| (key.to_string(), v.expect(
   15     17   
                                "we have checked there is at least one value for this header name; please file a bug report under https://github.com/smithy-lang/smithy-rs/issues"
   16     18   
                            )))
   17     19   
                        }).collect();
          20  +
    /* HttpBindingGenerator.kt:217 */
   18     21   
    out.map(Some)
          22  +
    /* HttpBindingGenerator.kt:190 */
   19     23   
}
   20     24   
          25  +
/* HttpBindingGenerator.kt:159 */
   21     26   
pub(crate) fn de_specific_header_header(
   22     27   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   23     28   
) -> ::std::result::Result<
   24     29   
    ::std::option::Option<::std::string::String>,
   25     30   
    ::aws_smithy_http::header::ParseError,
   26     31   
> {
          32  +
    /* HttpBindingGenerator.kt:166 */
   27     33   
    let headers = header_map.get_all("hello");
          34  +
    /* HttpBindingGenerator.kt:398 */
   28     35   
    ::aws_smithy_http::header::one_or_none(headers)
          36  +
    /* HttpBindingGenerator.kt:159 */
   29     37   
}
   30     38   
          39  +
/* HttpBindingGenerator.kt:179 */
   31     40   
pub fn de_prefix_headers_inner<'a>(
   32     41   
    headers: impl ::std::iter::Iterator<Item = &'a str>,
   33     42   
) -> std::result::Result<Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
          43  +
    /* HttpBindingGenerator.kt:398 */
   34     44   
    ::aws_smithy_http::header::one_or_none(headers)
          45  +
    /* HttpBindingGenerator.kt:179 */
   35     46   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_empty_prefix_headers_output.rs

@@ -1,1 +17,25 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* JsonSerializerGenerator.kt:213 */
    2      3   
pub fn ser_http_empty_prefix_headers_output_output_output(
    3      4   
    value: &crate::output::HttpEmptyPrefixHeadersOutput,
    4      5   
) -> ::std::result::Result<String, ::aws_smithy_types::error::operation::SerializationError> {
           6  +
    /* JsonSerializerGenerator.kt:218 */
    5      7   
    let mut out = ::std::string::String::new();
    6      8   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
           9  +
    /* JsonSerializerGenerator.kt:375 */
    7     10   
    crate::protocol_serde::shape_http_empty_prefix_headers_output::ser_http_empty_prefix_headers_output_output(&mut object, value)?;
          11  +
    /* JsonSerializerGenerator.kt:227 */
    8     12   
    object.finish();
    9     13   
    Ok(out)
          14  +
    /* JsonSerializerGenerator.kt:213 */
   10     15   
}
   11     16   
          17  +
/* JsonSerializerGenerator.kt:358 */
   12     18   
pub fn ser_http_empty_prefix_headers_output_output(
   13     19   
    #[allow(unused_variables)] object: &mut ::aws_smithy_json::serialize::JsonObjectWriter,
   14     20   
    #[allow(unused_variables)] input: &crate::output::HttpEmptyPrefixHeadersOutput,
   15     21   
) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> {
          22  +
    /* JsonSerializerGenerator.kt:372 */
   16     23   
    Ok(())
          24  +
    /* JsonSerializerGenerator.kt:358 */
   17     25   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_enum_payload.rs

@@ -1,1 +105,146 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_http_enum_payload_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpEnumPayloadInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::http_enum_payload_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   22     30   
        if let Some(value) = {
   23         -
            let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
            let bytes = {
          32  +
                use ::http_body_util::BodyExt;
          33  +
                body.collect().await?.to_bytes()
          34  +
            };
   24     35   
            if !bytes.is_empty() {
   25     36   
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   26     37   
                    &headers,
   27     38   
                    Some("text/plain"),
   28     39   
                )?;
   29     40   
            }
   30     41   
            crate::protocol_serde::shape_http_enum_payload_input::de_payload_payload(&bytes)?
   31     42   
        } {
   32     43   
            input = input.set_payload(Some(value))
   33     44   
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   34     46   
        input.build()?
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   35     48   
    })
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   36     50   
}
   37     51   
          52  +
/* RustType.kt:534 */
   38     53   
#[allow(clippy::unnecessary_wraps)]
          54  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   39     55   
pub fn ser_http_enum_payload_http_response(
   40     56   
    #[allow(unused_variables)] output: crate::output::HttpEnumPayloadOutput,
   41     57   
) -> std::result::Result<
   42     58   
    ::aws_smithy_http_server::response::Response,
   43     59   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     60   
> {
          61  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   45     62   
    Ok({
          63  +
        /* RustType.kt:534 */
   46     64   
        #[allow(unused_mut)]
   47         -
        let mut builder = ::http::Response::builder();
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          66  +
        let mut builder = ::http_1x::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   48     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     69   
            builder,
   50         -
            ::http::header::CONTENT_TYPE,
          70  +
            ::http_1x::header::CONTENT_TYPE,
   51     71   
            "text/plain",
   52     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   53     74   
        let http_status: u16 = 200;
   54     75   
        builder = builder.status(http_status);
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   55     77   
        let payload =
   56         -
            crate::protocol_serde::shape_http_enum_payload_output::ser_payload_http_payload(
   57         -
                output.payload,
   58         -
            )?;
          78  +
            /* HttpBoundProtocolPayloadGenerator.kt:348 */crate::protocol_serde::shape_http_enum_payload_output::ser_payload_http_payload( output.payload)?
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   59     81   
        let content_length = payload.len();
   60     82   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   61     83   
            builder,
   62         -
            ::http::header::CONTENT_LENGTH,
          84  +
            ::http_1x::header::CONTENT_LENGTH,
   63     85   
            content_length,
   64     86   
        );
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   65     88   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   66     90   
        builder.body(body)?
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   67     92   
    })
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   68     94   
}
   69     95   
          96  +
/* RustType.kt:534 */
   70     97   
#[allow(clippy::unnecessary_wraps)]
          98  +
/* ServerHttpBoundProtocolGenerator.kt:471 */
   71     99   
pub fn ser_http_enum_payload_http_error(
   72    100   
    error: &crate::error::HttpEnumPayloadError,
   73    101   
) -> std::result::Result<
   74    102   
    ::aws_smithy_http_server::response::Response,
   75    103   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   76    104   
> {
         105  +
    /* ServerHttpBoundProtocolGenerator.kt:476 */
   77    106   
    Ok({
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:492 */
   78    108   
        match error {
         109  +
            /* ServerHttpBoundProtocolGenerator.kt:500 */
   79    110   
            crate::error::HttpEnumPayloadError::ValidationException(output) => {
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:501 */
   80    112   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         113  +
                /* RustType.kt:534 */
   81    114   
                #[allow(unused_mut)]
   82         -
                let mut builder = ::http::Response::builder();
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:511 */
         116  +
                let mut builder = ::http_1x::Response::builder();
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   83    118   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    119   
                    builder,
   85         -
                    ::http::header::CONTENT_TYPE,
         120  +
                    ::http_1x::header::CONTENT_TYPE,
   86    121   
                    "text/plain",
   87    122   
                );
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:633 */
   88    124   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   89    125   
                    builder,
   90         -
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
         126  +
                    ::http_1x::header::HeaderName::from_static("x-amzn-errortype"),
   91    127   
                    "ValidationException",
   92    128   
                );
         129  +
                /* ServerHttpBoundProtocolGenerator.kt:699 */
   93    130   
                let content_length = payload.len();
   94    131   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   95    132   
                    builder,
   96         -
                    ::http::header::CONTENT_LENGTH,
         133  +
                    ::http_1x::header::CONTENT_LENGTH,
   97    134   
                    content_length,
   98    135   
                );
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:528 */
   99    137   
                builder
  100    138   
                    .status(400)
  101    139   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:500 */
         141  +
            } /* ServerHttpBoundProtocolGenerator.kt:492 */
  102    142   
        }
  103         -
        }
         143  +
        /* ServerHttpBoundProtocolGenerator.kt:476 */
  104    144   
    })
         145  +
    /* ServerHttpBoundProtocolGenerator.kt:471 */
  105    146   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_enum_payload_input.rs

@@ -1,1 +14,20 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:254 */
    2      3   
pub(crate) fn de_payload_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<::std::string::String>,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:342 */
    8     10   
    (!body.is_empty())
    9     11   
        .then(|| {
          12  +
            /* HttpBindingGenerator.kt:355 */
   10     13   
            let body_str = std::str::from_utf8(body)?;
          14  +
            /* HttpBindingGenerator.kt:362 */
   11     15   
            Ok(::std::string::String::from(body_str))
          16  +
            /* HttpBindingGenerator.kt:342 */
   12     17   
        })
   13     18   
        .transpose()
          19  +
    /* HttpBindingGenerator.kt:254 */
   14     20   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_enum_payload_output.rs

@@ -1,1 +10,22 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:309 */
    2      3   
pub fn ser_payload_http_payload(
    3      4   
    payload: ::std::option::Option<crate::model::StringEnum>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:318 */
    5      7   
    let payload = match payload {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(Vec::new()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:330 */
          12  +
                Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:318 */
          13  +
            )
          14  +
        }
    8     15   
    };
    9         -
    Ok(payload.as_str().as_bytes().to_vec())
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:343 */
          17  +
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:361 */
          19  +
        payload.as_str().as_bytes().to_vec(), /* HttpBoundProtocolPayloadGenerator.kt:343 */
          20  +
    )
          21  +
    /* HttpBoundProtocolPayloadGenerator.kt:309 */
   10     22   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_payload_traits.rs

@@ -1,1 +91,129 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_http_payload_traits_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpPayloadTraitsInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::http_payload_traits_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   22     30   
        if let Some(value) = {
   23         -
            let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
            let bytes = {
          32  +
                use ::http_body_util::BodyExt;
          33  +
                body.collect().await?.to_bytes()
          34  +
            };
   24     35   
   25     36   
            crate::protocol_serde::shape_http_payload_traits_input::de_blob_payload(&bytes)?
   26     37   
        } {
   27     38   
            input = input.set_blob(Some(value))
   28     39   
        }
          40  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   29     41   
        if let Some(value) =
   30     42   
            crate::protocol_serde::shape_http_payload_traits_input::de_foo_header(&headers)?
   31     43   
        {
   32     44   
            input = input.set_foo(Some(value))
   33     45   
        }
          46  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   34     47   
        input.build()
          48  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   35     49   
    })
          50  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   36     51   
}
   37     52   
          53  +
/* RustType.kt:534 */
   38     54   
#[allow(clippy::unnecessary_wraps)]
          55  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   39     56   
pub fn ser_http_payload_traits_http_response(
   40     57   
    #[allow(unused_variables)] output: crate::output::HttpPayloadTraitsOutput,
   41     58   
) -> std::result::Result<
   42     59   
    ::aws_smithy_http_server::response::Response,
   43     60   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     61   
> {
          62  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   45     63   
    Ok({
          64  +
        /* RustType.kt:534 */
   46     65   
        #[allow(unused_mut)]
   47         -
        let mut builder = ::http::Response::builder();
          66  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          67  +
        let mut builder = ::http_1x::Response::builder();
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
   48     69   
        builder =
   49     70   
            crate::protocol_serde::shape_http_payload_traits::ser_http_payload_traits_headers(
   50     71   
                &output, builder,
   51     72   
            )?;
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   52     74   
        let http_status: u16 = 200;
   53     75   
        builder = builder.status(http_status);
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   54     77   
        let payload =
   55         -
            crate::protocol_serde::shape_http_payload_traits_output::ser_blob_http_payload(
   56         -
                output.blob,
   57         -
            )?;
          78  +
            /* HttpBoundProtocolPayloadGenerator.kt:348 */crate::protocol_serde::shape_http_payload_traits_output::ser_blob_http_payload( output.blob)?
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   58     81   
        let content_length = payload.len();
   59     82   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   60     83   
            builder,
   61         -
            ::http::header::CONTENT_LENGTH,
          84  +
            ::http_1x::header::CONTENT_LENGTH,
   62     85   
            content_length,
   63     86   
        );
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   64     88   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   65     90   
        builder.body(body)?
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   66     92   
    })
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   67     94   
}
   68     95   
          96  +
/* HttpBindingGenerator.kt:565 */
   69     97   
pub fn ser_http_payload_traits_headers(
   70     98   
    input: &crate::output::HttpPayloadTraitsOutput,
   71         -
    mut builder: ::http::response::Builder,
   72         -
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   73         -
{
          99  +
    mut builder: ::http_1x::response::Builder,
         100  +
) -> std::result::Result<
         101  +
    ::http_1x::response::Builder,
         102  +
    ::aws_smithy_types::error::operation::BuildError,
         103  +
> {
         104  +
    /* HttpBindingGenerator.kt:615 */
   74    105   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
         106  +
        /* HttpBindingGenerator.kt:727 */
   75    107   
        let formatted_2 = inner_1.as_str();
         108  +
        /* HttpBindingGenerator.kt:728 */
   76    109   
        if !formatted_2.is_empty() {
         110  +
            /* HttpBindingGenerator.kt:729 */
   77    111   
            let header_value = formatted_2;
   78         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         112  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   79    113   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   80    114   
                    "foo",
   81    115   
                    format!(
   82    116   
                        "`{}` cannot be used as a header value: {}",
   83    117   
                        &header_value, err
   84    118   
                    ),
   85    119   
                )
   86    120   
            })?;
   87    121   
            builder = builder.header("X-Foo", header_value);
         122  +
            /* HttpBindingGenerator.kt:728 */
   88    123   
        }
         124  +
        /* HttpBindingGenerator.kt:615 */
   89    125   
    }
         126  +
    /* HttpBindingGenerator.kt:578 */
   90    127   
    Ok(builder)
         128  +
    /* HttpBindingGenerator.kt:565 */
   91    129   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_payload_traits_input.rs

@@ -1,1 +21,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:254 */
    2      3   
pub(crate) fn de_blob_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<::aws_smithy_types::Blob>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:342 */
    8     10   
    (!body.is_empty())
    9         -
        .then(|| Ok(::aws_smithy_types::Blob::new(body)))
          11  +
        .then(|| {
          12  +
            /* HttpBindingGenerator.kt:372 */
          13  +
            Ok(::aws_smithy_types::Blob::new(body))
          14  +
            /* HttpBindingGenerator.kt:342 */
          15  +
        })
   10     16   
        .transpose()
          17  +
    /* HttpBindingGenerator.kt:254 */
   11     18   
}
   12     19   
          20  +
/* HttpBindingGenerator.kt:159 */
   13     21   
pub(crate) fn de_foo_header(
   14     22   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   15     23   
) -> ::std::result::Result<
   16     24   
    ::std::option::Option<::std::string::String>,
   17     25   
    ::aws_smithy_http::header::ParseError,
   18     26   
> {
          27  +
    /* HttpBindingGenerator.kt:166 */
   19     28   
    let headers = header_map.get_all("X-Foo");
          29  +
    /* HttpBindingGenerator.kt:398 */
   20     30   
    ::aws_smithy_http::header::one_or_none(headers)
          31  +
    /* HttpBindingGenerator.kt:159 */
   21     32   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_payload_traits_output.rs

@@ -1,1 +10,22 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:309 */
    2      3   
pub fn ser_blob_http_payload(
    3      4   
    payload: ::std::option::Option<::aws_smithy_types::Blob>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:318 */
    5      7   
    let payload = match payload {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(Vec::new()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:330 */
          12  +
                Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:318 */
          13  +
            )
          14  +
        }
    8     15   
    };
    9         -
    Ok(payload.into_inner())
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:343 */
          17  +
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:375 */
          19  +
        payload.into_inner(), /* HttpBoundProtocolPayloadGenerator.kt:343 */
          20  +
    )
          21  +
    /* HttpBoundProtocolPayloadGenerator.kt:309 */
   10     22   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_payload_traits_with_media_type.rs

@@ -1,1 +101,141 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_http_payload_traits_with_media_type_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpPayloadTraitsWithMediaTypeInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::http_payload_traits_with_media_type_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   22     30   
        if let Some(value) = {
   23         -
            let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
            let bytes = {
          32  +
                use ::http_body_util::BodyExt;
          33  +
                body.collect().await?.to_bytes()
          34  +
            };
   24     35   
            if !bytes.is_empty() {
   25     36   
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   26     37   
                    &headers,
   27     38   
                    Some("text/plain"),
   28     39   
                )?;
   29     40   
            }
   30     41   
            crate::protocol_serde::shape_http_payload_traits_with_media_type_input::de_blob_payload(
   31     42   
                &bytes,
   32     43   
            )?
   33     44   
        } {
   34     45   
            input = input.set_blob(Some(value))
   35     46   
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   36     48   
        if let Some(value) =
   37     49   
            crate::protocol_serde::shape_http_payload_traits_with_media_type_input::de_foo_header(
   38     50   
                &headers,
   39     51   
            )?
   40     52   
        {
   41     53   
            input = input.set_foo(Some(value))
   42     54   
        }
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   43     56   
        input.build()
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   44     58   
    })
          59  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   45     60   
}
   46     61   
          62  +
/* RustType.kt:534 */
   47     63   
#[allow(clippy::unnecessary_wraps)]
          64  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   48     65   
pub fn ser_http_payload_traits_with_media_type_http_response(
   49     66   
    #[allow(unused_variables)] output: crate::output::HttpPayloadTraitsWithMediaTypeOutput,
   50     67   
) -> std::result::Result<
   51     68   
    ::aws_smithy_http_server::response::Response,
   52     69   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   53     70   
> {
          71  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   54     72   
    Ok({
          73  +
        /* RustType.kt:534 */
   55     74   
        #[allow(unused_mut)]
   56         -
        let mut builder = ::http::Response::builder();
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          76  +
        let mut builder = ::http_1x::Response::builder();
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:665 */
   57     78   
        builder = crate::protocol_serde::shape_http_payload_traits_with_media_type::ser_http_payload_traits_with_media_type_headers(&output, builder)?;
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   58     80   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   59     81   
            builder,
   60         -
            ::http::header::CONTENT_TYPE,
          82  +
            ::http_1x::header::CONTENT_TYPE,
   61     83   
            "text/plain",
   62     84   
        );
          85  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   63     86   
        let http_status: u16 = 200;
   64     87   
        builder = builder.status(http_status);
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   65     89   
        let payload =
   66         -
            crate::protocol_serde::shape_http_payload_traits_with_media_type_output::ser_blob_http_payload( output.blob)?
   67         -
        ;
          90  +
            /* HttpBoundProtocolPayloadGenerator.kt:348 */crate::protocol_serde::shape_http_payload_traits_with_media_type_output::ser_blob_http_payload( output.blob)?
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          92  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   68     93   
        let content_length = payload.len();
   69     94   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   70     95   
            builder,
   71         -
            ::http::header::CONTENT_LENGTH,
          96  +
            ::http_1x::header::CONTENT_LENGTH,
   72     97   
            content_length,
   73     98   
        );
          99  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   74    100   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
         101  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   75    102   
        builder.body(body)?
         103  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   76    104   
    })
         105  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   77    106   
}
   78    107   
         108  +
/* HttpBindingGenerator.kt:565 */
   79    109   
pub fn ser_http_payload_traits_with_media_type_headers(
   80    110   
    input: &crate::output::HttpPayloadTraitsWithMediaTypeOutput,
   81         -
    mut builder: ::http::response::Builder,
   82         -
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
   83         -
{
         111  +
    mut builder: ::http_1x::response::Builder,
         112  +
) -> std::result::Result<
         113  +
    ::http_1x::response::Builder,
         114  +
    ::aws_smithy_types::error::operation::BuildError,
         115  +
> {
         116  +
    /* HttpBindingGenerator.kt:615 */
   84    117   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
         118  +
        /* HttpBindingGenerator.kt:727 */
   85    119   
        let formatted_2 = inner_1.as_str();
         120  +
        /* HttpBindingGenerator.kt:728 */
   86    121   
        if !formatted_2.is_empty() {
         122  +
            /* HttpBindingGenerator.kt:729 */
   87    123   
            let header_value = formatted_2;
   88         -
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
         124  +
            let header_value: ::http_1x::HeaderValue = header_value.parse().map_err(|err| {
   89    125   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   90    126   
                    "foo",
   91    127   
                    format!(
   92    128   
                        "`{}` cannot be used as a header value: {}",
   93    129   
                        &header_value, err
   94    130   
                    ),
   95    131   
                )
   96    132   
            })?;
   97    133   
            builder = builder.header("X-Foo", header_value);
         134  +
            /* HttpBindingGenerator.kt:728 */
   98    135   
        }
         136  +
        /* HttpBindingGenerator.kt:615 */
   99    137   
    }
         138  +
    /* HttpBindingGenerator.kt:578 */
  100    139   
    Ok(builder)
         140  +
    /* HttpBindingGenerator.kt:565 */
  101    141   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_payload_traits_with_media_type_input.rs

@@ -1,1 +21,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:254 */
    2      3   
pub(crate) fn de_blob_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<::aws_smithy_types::Blob>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:342 */
    8     10   
    (!body.is_empty())
    9         -
        .then(|| Ok(::aws_smithy_types::Blob::new(body)))
          11  +
        .then(|| {
          12  +
            /* HttpBindingGenerator.kt:372 */
          13  +
            Ok(::aws_smithy_types::Blob::new(body))
          14  +
            /* HttpBindingGenerator.kt:342 */
          15  +
        })
   10     16   
        .transpose()
          17  +
    /* HttpBindingGenerator.kt:254 */
   11     18   
}
   12     19   
          20  +
/* HttpBindingGenerator.kt:159 */
   13     21   
pub(crate) fn de_foo_header(
   14     22   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   15     23   
) -> ::std::result::Result<
   16     24   
    ::std::option::Option<::std::string::String>,
   17     25   
    ::aws_smithy_http::header::ParseError,
   18     26   
> {
          27  +
    /* HttpBindingGenerator.kt:166 */
   19     28   
    let headers = header_map.get_all("X-Foo");
          29  +
    /* HttpBindingGenerator.kt:398 */
   20     30   
    ::aws_smithy_http::header::one_or_none(headers)
          31  +
    /* HttpBindingGenerator.kt:159 */
   21     32   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_payload_traits_with_media_type_output.rs

@@ -1,1 +10,22 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBoundProtocolPayloadGenerator.kt:309 */
    2      3   
pub fn ser_blob_http_payload(
    3      4   
    payload: ::std::option::Option<::aws_smithy_types::Blob>,
    4      5   
) -> ::std::result::Result<::std::vec::Vec<u8>, ::aws_smithy_types::error::operation::BuildError> {
           6  +
    /* HttpBoundProtocolPayloadGenerator.kt:318 */
    5      7   
    let payload = match payload {
    6      8   
        Some(t) => t,
    7         -
        None => return Ok(Vec::new()),
           9  +
        None => {
          10  +
            return Ok(
          11  +
                /* HttpBoundProtocolPayloadGenerator.kt:330 */
          12  +
                Vec::new(), /* HttpBoundProtocolPayloadGenerator.kt:318 */
          13  +
            )
          14  +
        }
    8     15   
    };
    9         -
    Ok(payload.into_inner())
          16  +
    /* HttpBoundProtocolPayloadGenerator.kt:343 */
          17  +
    Ok(
          18  +
        /* HttpBoundProtocolPayloadGenerator.kt:375 */
          19  +
        payload.into_inner(), /* HttpBoundProtocolPayloadGenerator.kt:343 */
          20  +
    )
          21  +
    /* HttpBoundProtocolPayloadGenerator.kt:309 */
   10     22   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_payload_with_structure.rs

@@ -1,1 +69,96 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:534 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:408 */
    3      5   
pub async fn de_http_payload_with_structure_http_request<B>(
    4         -
    #[allow(unused_variables)] request: ::http::Request<B>,
           6  +
    #[allow(unused_variables)] request: ::http_1x::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::HttpPayloadWithStructureInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:424 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:534 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:759 */
   17     22   
        let mut input = crate::input::http_payload_with_structure_input::Builder::default();
          23  +
        /* RustType.kt:534 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:764 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:856 */
   22     30   
        if let Some(value) = {
   23         -
            let bytes = ::hyper::body::to_bytes(body).await?;
          31  +
            let bytes = {
          32  +
                use ::http_body_util::BodyExt;
          33  +
                body.collect().await?.to_bytes()
          34  +
            };
   24     35   
            if !bytes.is_empty() {
   25     36   
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
   26     37   
                    &headers,
   27     38   
                    Some("application/json"),
   28     39   
                )?;
   29     40   
            }
   30     41   
            crate::protocol_serde::shape_http_payload_with_structure_input::de_nested_payload(
   31     42   
                &bytes,
   32     43   
            )?
   33     44   
        } {
   34     45   
            input = input.set_nested(Some(value))
   35     46   
        }
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:896 */
   36     48   
        input.build()
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:424 */
   37     50   
    })
          51  +
    /* ServerHttpBoundProtocolGenerator.kt:408 */
   38     52   
}
   39     53   
          54  +
/* RustType.kt:534 */
   40     55   
#[allow(clippy::unnecessary_wraps)]
          56  +
/* ServerHttpBoundProtocolGenerator.kt:445 */
   41     57   
pub fn ser_http_payload_with_structure_http_response(
   42     58   
    #[allow(unused_variables)] output: crate::output::HttpPayloadWithStructureOutput,
   43     59   
) -> std::result::Result<
   44     60   
    ::aws_smithy_http_server::response::Response,
   45     61   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   46     62   
> {
          63  +
    /* ServerHttpBoundProtocolGenerator.kt:457 */
   47     64   
    Ok({
          65  +
        /* RustType.kt:534 */
   48     66   
        #[allow(unused_mut)]
   49         -
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:547 */
          68  +
        let mut builder = ::http_1x::Response::builder();
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:633 */
   50     70   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   51     71   
            builder,
   52         -
            ::http::header::CONTENT_TYPE,
          72  +
            ::http_1x::header::CONTENT_TYPE,
   53     73   
            "application/json",
   54     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:718 */
   55     76   
        let http_status: u16 = 200;
   56     77   
        builder = builder.status(http_status);
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   57     79   
        let payload =
   58         -
            crate::protocol_serde::shape_http_payload_with_structure_output::ser_nested_http_payload(& output.nested)?
   59         -
        ;
          80  +
            /* HttpBoundProtocolPayloadGenerator.kt:348 */crate::protocol_serde::shape_http_payload_with_structure_output::ser_nested_http_payload(& output.nested)?
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */;
          82  +
        /* ServerHttpBoundProtocolGenerator.kt:699 */
   60     83   
        let content_length = payload.len();
   61     84   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   62     85   
            builder,
   63         -
            ::http::header::CONTENT_LENGTH,
          86  +
            ::http_1x::header::CONTENT_LENGTH,
   64     87   
            content_length,
   65     88   
        );
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:603 */
   66     90   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:611 */
   67     92   
        builder.body(body)?
          93  +
        /* ServerHttpBoundProtocolGenerator.kt:457 */
   68     94   
    })
          95  +
    /* ServerHttpBoundProtocolGenerator.kt:445 */
   69     96   
}

tmp-codegen-diff/codegen-server-test/rest_json/rust-server-codegen/src/protocol_serde/shape_http_payload_with_structure_input.rs

@@ -1,1 +11,18 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:254 */
    2      3   
pub(crate) fn de_nested_payload(
    3      4   
    body: &[u8],
    4      5   
) -> std::result::Result<
    5      6   
    ::std::option::Option<crate::model::NestedPayload>,
    6      7   
    ::aws_smithy_json::deserialize::error::DeserializeError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:342 */
    8     10   
    (!body.is_empty())
    9         -
        .then(|| crate::protocol_serde::shape_nested_payload::de_nested_payload_payload(body))
          11  +
        .then(|| {
          12  +
            /* ServerHttpBoundProtocolGenerator.kt:914 */
          13  +
            crate::protocol_serde::shape_nested_payload::de_nested_payload_payload(body)
          14  +
            /* HttpBindingGenerator.kt:342 */
          15  +
        })
   10     16   
        .transpose()
          17  +
    /* HttpBindingGenerator.kt:254 */
   11     18   
}