Server Test Python

Server Test Python

rev. 03e6e47f15dfd569240d570d98975ebba692c405 (ignoring whitespace)

Files changed:

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

@@ -1,1 +91,93 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_host_with_path_operation_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::HostWithPathOperationInput,
    7         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input = crate::input::host_with_path_operation_input_internal::Builder::default();
   18     18   
        #[allow(unused_variables)]
   19     19   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     20   
            uri, headers, body, ..
   21     21   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22         -
        ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(&headers, None)?;
          22  +
        ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
          23  +
            &headers, None,
          24  +
        )?;
   23     25   
        input.build()
   24     26   
    })
   25     27   
}
   26     28   
   27     29   
#[allow(clippy::unnecessary_wraps)]
   28     30   
pub fn ser_host_with_path_operation_http_response(
   29     31   
    #[allow(unused_variables)] output: crate::output::HostWithPathOperationOutput,
   30     32   
) -> std::result::Result<
   31         -
    ::aws_smithy_http_server::response::Response,
   32         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          33  +
    ::aws_smithy_legacy_http_server::response::Response,
          34  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   33     35   
> {
   34     36   
    Ok({
   35     37   
        #[allow(unused_mut)]
   36     38   
        let mut builder = ::http::Response::builder();
   37         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          39  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   38     40   
            builder,
   39     41   
            ::http::header::CONTENT_TYPE,
   40     42   
            "application/json",
   41     43   
        );
   42     44   
        let http_status: u16 = 200;
   43     45   
        builder = builder.status(http_status);
   44     46   
        let payload = "";
   45     47   
        let content_length = payload.len();
   46         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          48  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   47     49   
            builder,
   48     50   
            ::http::header::CONTENT_LENGTH,
   49     51   
            content_length,
   50     52   
        );
   51         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          53  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   52     54   
        builder.body(body)?
   53     55   
    })
   54     56   
}
   55     57   
   56     58   
#[allow(clippy::unnecessary_wraps)]
   57     59   
pub fn ser_host_with_path_operation_http_error(
   58     60   
    error: &crate::error::HostWithPathOperationError,
   59     61   
) -> std::result::Result<
   60         -
    ::aws_smithy_http_server::response::Response,
   61         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          62  +
    ::aws_smithy_legacy_http_server::response::Response,
          63  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   62     64   
> {
   63     65   
    Ok({
   64     66   
        match error {
   65     67   
            crate::error::HostWithPathOperationError::InternalServerError(output) => {
   66     68   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
   67     69   
                #[allow(unused_mut)]
   68     70   
                let mut builder = ::http::Response::builder();
   69         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          71  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   70     72   
                    builder,
   71     73   
                    ::http::header::CONTENT_TYPE,
   72     74   
                    "application/json",
   73     75   
                );
   74         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          76  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   75     77   
                    builder,
   76     78   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   77     79   
                    "InternalServerError",
   78     80   
                );
   79     81   
                let content_length = payload.len();
   80         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          82  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   81     83   
                    builder,
   82     84   
                    ::http::header::CONTENT_LENGTH,
   83     85   
                    content_length,
   84     86   
                );
   85     87   
                builder
   86     88   
                    .status(500)
   87         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
          89  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
   88     90   
            }
   89     91   
        }
   90     92   
    })
   91     93   
}

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

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

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

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

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

@@ -1,1 +35,36 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub(crate) fn de_prefix_headers_prefix_header(
    3      3   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      4   
) -> std::result::Result<
    5      5   
    ::std::option::Option<
    6      6   
        ::std::collections::HashMap<::std::string::String, ::std::string::String>,
    7      7   
    >,
    8         -
    ::aws_smithy_http::header::ParseError,
           8  +
    ::aws_smithy_legacy_http::header::ParseError,
    9      9   
> {
   10     10   
    let headers =
   11         -
        ::aws_smithy_http::header::headers_for_prefix(header_map.iter().map(|(k, _)| k), "");
          11  +
        ::aws_smithy_legacy_http::header::headers_for_prefix(header_map.iter().map(|(k, _)| k), "");
   12     12   
    let out: std::result::Result<_, _> = headers.map(|(key, header_name)| {
   13     13   
                            let values = header_map.get_all(header_name);
   14     14   
                            crate::protocol_serde::shape_http_empty_prefix_headers_input::de_prefix_headers_inner(values).map(|v| (key.to_string(), v.expect(
   15     15   
                                "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     16   
                            )))
   17     17   
                        }).collect();
   18     18   
    out.map(Some)
   19     19   
}
   20     20   
   21     21   
pub(crate) fn de_specific_header_header(
   22     22   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   23     23   
) -> ::std::result::Result<
   24     24   
    ::std::option::Option<::std::string::String>,
   25         -
    ::aws_smithy_http::header::ParseError,
          25  +
    ::aws_smithy_legacy_http::header::ParseError,
   26     26   
> {
   27     27   
    let headers = header_map.get_all("hello");
   28         -
    ::aws_smithy_http::header::one_or_none(headers)
          28  +
    ::aws_smithy_legacy_http::header::one_or_none(headers)
   29     29   
}
   30     30   
   31     31   
pub fn de_prefix_headers_inner<'a>(
   32     32   
    headers: impl ::std::iter::Iterator<Item = &'a str>,
   33         -
) -> std::result::Result<Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
   34         -
    ::aws_smithy_http::header::one_or_none(headers)
          33  +
) -> std::result::Result<Option<::std::string::String>, ::aws_smithy_legacy_http::header::ParseError>
          34  +
{
          35  +
    ::aws_smithy_legacy_http::header::one_or_none(headers)
   35     36   
}

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

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

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

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

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

@@ -1,1 +123,123 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_http_payload_traits_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::HttpPayloadTraitsInput,
    7         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input = crate::input::http_payload_traits_input_internal::Builder::default();
   18     18   
        #[allow(unused_variables)]
   19     19   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     20   
            uri, headers, body, ..
   21     21   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22     22   
        if let Some(value) = {
   23     23   
            let bytes = ::hyper::body::to_bytes(body).await?;
   24     24   
   25     25   
            crate::protocol_serde::shape_http_payload_traits_input::de_blob_payload(&bytes)?
   26     26   
        } {
   27     27   
            input = input.set_blob(Some(value))
   28     28   
        }
   29     29   
        if let Some(value) =
   30     30   
            crate::protocol_serde::shape_http_payload_traits_input::de_foo_header(&headers)?
   31     31   
        {
   32     32   
            input = input.set_foo(Some(value))
   33     33   
        }
   34     34   
        input.build()
   35     35   
    })
   36     36   
}
   37     37   
   38     38   
#[allow(clippy::unnecessary_wraps)]
   39     39   
pub fn ser_http_payload_traits_http_response(
   40     40   
    #[allow(unused_variables)] output: crate::output::HttpPayloadTraitsOutput,
   41     41   
) -> std::result::Result<
   42         -
    ::aws_smithy_http_server::response::Response,
   43         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          42  +
    ::aws_smithy_legacy_http_server::response::Response,
          43  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     44   
> {
   45     45   
    Ok({
   46     46   
        #[allow(unused_mut)]
   47     47   
        let mut builder = ::http::Response::builder();
   48     48   
        builder =
   49     49   
            crate::protocol_serde::shape_http_payload_traits::ser_http_payload_traits_headers(
   50     50   
                &output, builder,
   51     51   
            )?;
   52     52   
        let http_status: u16 = 200;
   53     53   
        builder = builder.status(http_status);
   54     54   
        let payload =
   55     55   
            crate::protocol_serde::shape_http_payload_traits_output::ser_blob_http_payload(
   56     56   
                output.blob,
   57     57   
            )?;
   58     58   
        let content_length = payload.len();
   59         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          59  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   60     60   
            builder,
   61     61   
            ::http::header::CONTENT_LENGTH,
   62     62   
            content_length,
   63     63   
        );
   64         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          64  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   65     65   
        builder.body(body)?
   66     66   
    })
   67     67   
}
   68     68   
   69     69   
#[allow(clippy::unnecessary_wraps)]
   70     70   
pub fn ser_http_payload_traits_http_error(
   71     71   
    error: &crate::error::HttpPayloadTraitsError,
   72     72   
) -> std::result::Result<
   73         -
    ::aws_smithy_http_server::response::Response,
   74         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          73  +
    ::aws_smithy_legacy_http_server::response::Response,
          74  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   75     75   
> {
   76     76   
    Ok({
   77     77   
        match error {
   78     78   
            crate::error::HttpPayloadTraitsError::InternalServerError(output) => {
   79     79   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
   80     80   
                #[allow(unused_mut)]
   81     81   
                let mut builder = ::http::Response::builder();
   82         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          82  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   83     83   
                    builder,
   84     84   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   85     85   
                    "InternalServerError",
   86     86   
                );
   87     87   
                let content_length = payload.len();
   88         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          88  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   89     89   
                    builder,
   90     90   
                    ::http::header::CONTENT_LENGTH,
   91     91   
                    content_length,
   92     92   
                );
   93     93   
                builder
   94     94   
                    .status(500)
   95         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
          95  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
   96     96   
            }
   97     97   
        }
   98     98   
    })
   99     99   
}
  100    100   
  101    101   
pub fn ser_http_payload_traits_headers(
  102    102   
    input: &crate::output::HttpPayloadTraitsOutput,
  103    103   
    mut builder: ::http::response::Builder,
  104    104   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  105    105   
{

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

@@ -1,1 +21,21 @@
    7      7   
> {
    8      8   
    (!body.is_empty())
    9      9   
        .then(|| Ok(::aws_smithy_http_server_python::types::Blob::new(body)))
   10     10   
        .transpose()
   11     11   
}
   12     12   
   13     13   
pub(crate) fn de_foo_header(
   14     14   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   15     15   
) -> ::std::result::Result<
   16     16   
    ::std::option::Option<::std::string::String>,
   17         -
    ::aws_smithy_http::header::ParseError,
          17  +
    ::aws_smithy_legacy_http::header::ParseError,
   18     18   
> {
   19     19   
    let headers = header_map.get_all("X-Foo");
   20         -
    ::aws_smithy_http::header::one_or_none(headers)
          20  +
    ::aws_smithy_legacy_http::header::one_or_none(headers)
   21     21   
}

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

@@ -1,1 +139,139 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_http_payload_traits_with_media_type_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::HttpPayloadTraitsWithMediaTypeInput,
    7         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input =
   18     18   
            crate::input::http_payload_traits_with_media_type_input_internal::Builder::default();
   19     19   
        #[allow(unused_variables)]
   20     20   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     21   
            uri, headers, body, ..
   22     22   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   23     23   
        if let Some(value) = {
   24     24   
            let bytes = ::hyper::body::to_bytes(body).await?;
   25     25   
            if !bytes.is_empty() {
   26         -
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
          26  +
                ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
   27     27   
                    &headers,
   28     28   
                    Some("text/plain"),
   29     29   
                )?;
   30     30   
            }
   31     31   
            crate::protocol_serde::shape_http_payload_traits_with_media_type_input::de_blob_payload(
   32     32   
                &bytes,
   33     33   
            )?
   34     34   
        } {
   35     35   
            input = input.set_blob(Some(value))
   36     36   
        }
   37     37   
        if let Some(value) =
   38     38   
            crate::protocol_serde::shape_http_payload_traits_with_media_type_input::de_foo_header(
   39     39   
                &headers,
   40     40   
            )?
   41     41   
        {
   42     42   
            input = input.set_foo(Some(value))
   43     43   
        }
   44     44   
        input.build()
   45     45   
    })
   46     46   
}
   47     47   
   48     48   
#[allow(clippy::unnecessary_wraps)]
   49     49   
pub fn ser_http_payload_traits_with_media_type_http_response(
   50     50   
    #[allow(unused_variables)] output: crate::output::HttpPayloadTraitsWithMediaTypeOutput,
   51     51   
) -> std::result::Result<
   52         -
    ::aws_smithy_http_server::response::Response,
   53         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          52  +
    ::aws_smithy_legacy_http_server::response::Response,
          53  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   54     54   
> {
   55     55   
    Ok({
   56     56   
        #[allow(unused_mut)]
   57     57   
        let mut builder = ::http::Response::builder();
   58     58   
        builder = crate::protocol_serde::shape_http_payload_traits_with_media_type::ser_http_payload_traits_with_media_type_headers(&output, builder)?;
   59         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          59  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   60     60   
            builder,
   61     61   
            ::http::header::CONTENT_TYPE,
   62     62   
            "text/plain",
   63     63   
        );
   64     64   
        let http_status: u16 = 200;
   65     65   
        builder = builder.status(http_status);
   66     66   
        let payload =
   67     67   
            crate::protocol_serde::shape_http_payload_traits_with_media_type_output::ser_blob_http_payload( output.blob)?
   68     68   
        ;
   69     69   
        let content_length = payload.len();
   70         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          70  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   71     71   
            builder,
   72     72   
            ::http::header::CONTENT_LENGTH,
   73     73   
            content_length,
   74     74   
        );
   75         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          75  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   76     76   
        builder.body(body)?
   77     77   
    })
   78     78   
}
   79     79   
   80     80   
#[allow(clippy::unnecessary_wraps)]
   81     81   
pub fn ser_http_payload_traits_with_media_type_http_error(
   82     82   
    error: &crate::error::HttpPayloadTraitsWithMediaTypeError,
   83     83   
) -> std::result::Result<
   84         -
    ::aws_smithy_http_server::response::Response,
   85         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          84  +
    ::aws_smithy_legacy_http_server::response::Response,
          85  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   86     86   
> {
   87     87   
    Ok({
   88     88   
        match error {
   89     89   
            crate::error::HttpPayloadTraitsWithMediaTypeError::InternalServerError(output) => {
   90     90   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
   91     91   
                #[allow(unused_mut)]
   92     92   
                let mut builder = ::http::Response::builder();
   93         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          93  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   94     94   
                    builder,
   95     95   
                    ::http::header::CONTENT_TYPE,
   96     96   
                    "text/plain",
   97     97   
                );
   98         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          98  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   99     99   
                    builder,
  100    100   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  101    101   
                    "InternalServerError",
  102    102   
                );
  103    103   
                let content_length = payload.len();
  104         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         104  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  105    105   
                    builder,
  106    106   
                    ::http::header::CONTENT_LENGTH,
  107    107   
                    content_length,
  108    108   
                );
  109    109   
                builder
  110    110   
                    .status(500)
  111         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         111  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
  112    112   
            }
  113    113   
        }
  114    114   
    })
  115    115   
}
  116    116   
  117    117   
pub fn ser_http_payload_traits_with_media_type_headers(
  118    118   
    input: &crate::output::HttpPayloadTraitsWithMediaTypeOutput,
  119    119   
    mut builder: ::http::response::Builder,
  120    120   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  121    121   
{

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

@@ -1,1 +21,21 @@
    7      7   
> {
    8      8   
    (!body.is_empty())
    9      9   
        .then(|| Ok(::aws_smithy_http_server_python::types::Blob::new(body)))
   10     10   
        .transpose()
   11     11   
}
   12     12   
   13     13   
pub(crate) fn de_foo_header(
   14     14   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   15     15   
) -> ::std::result::Result<
   16     16   
    ::std::option::Option<::std::string::String>,
   17         -
    ::aws_smithy_http::header::ParseError,
          17  +
    ::aws_smithy_legacy_http::header::ParseError,
   18     18   
> {
   19     19   
    let headers = header_map.get_all("X-Foo");
   20         -
    ::aws_smithy_http::header::one_or_none(headers)
          20  +
    ::aws_smithy_legacy_http::header::one_or_none(headers)
   21     21   
}

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

@@ -1,1 +107,107 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_http_payload_with_structure_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::HttpPayloadWithStructureInput,
    7         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input =
   18     18   
            crate::input::http_payload_with_structure_input_internal::Builder::default();
   19     19   
        #[allow(unused_variables)]
   20     20   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     21   
            uri, headers, body, ..
   22     22   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   23     23   
        if let Some(value) = {
   24     24   
            let bytes = ::hyper::body::to_bytes(body).await?;
   25     25   
            if !bytes.is_empty() {
   26         -
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
          26  +
                ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
   27     27   
                    &headers,
   28     28   
                    Some("application/json"),
   29     29   
                )?;
   30     30   
            }
   31     31   
            crate::protocol_serde::shape_http_payload_with_structure_input::de_nested_payload(
   32     32   
                &bytes,
   33     33   
            )?
   34     34   
        } {
   35     35   
            input = input.set_nested(Some(value))
   36     36   
        }
   37     37   
        input.build()
   38     38   
    })
   39     39   
}
   40     40   
   41     41   
#[allow(clippy::unnecessary_wraps)]
   42     42   
pub fn ser_http_payload_with_structure_http_response(
   43     43   
    #[allow(unused_variables)] output: crate::output::HttpPayloadWithStructureOutput,
   44     44   
) -> std::result::Result<
   45         -
    ::aws_smithy_http_server::response::Response,
   46         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          45  +
    ::aws_smithy_legacy_http_server::response::Response,
          46  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   47     47   
> {
   48     48   
    Ok({
   49     49   
        #[allow(unused_mut)]
   50     50   
        let mut builder = ::http::Response::builder();
   51         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          51  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   52     52   
            builder,
   53     53   
            ::http::header::CONTENT_TYPE,
   54     54   
            "application/json",
   55     55   
        );
   56     56   
        let http_status: u16 = 200;
   57     57   
        builder = builder.status(http_status);
   58     58   
        let payload =
   59     59   
            crate::protocol_serde::shape_http_payload_with_structure_output::ser_nested_http_payload(& output.nested)?
   60     60   
        ;
   61     61   
        let content_length = payload.len();
   62         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          62  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   63     63   
            builder,
   64     64   
            ::http::header::CONTENT_LENGTH,
   65     65   
            content_length,
   66     66   
        );
   67         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          67  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   68     68   
        builder.body(body)?
   69     69   
    })
   70     70   
}
   71     71   
   72     72   
#[allow(clippy::unnecessary_wraps)]
   73     73   
pub fn ser_http_payload_with_structure_http_error(
   74     74   
    error: &crate::error::HttpPayloadWithStructureError,
   75     75   
) -> std::result::Result<
   76         -
    ::aws_smithy_http_server::response::Response,
   77         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          76  +
    ::aws_smithy_legacy_http_server::response::Response,
          77  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   78     78   
> {
   79     79   
    Ok({
   80     80   
        match error {
   81     81   
            crate::error::HttpPayloadWithStructureError::InternalServerError(output) => {
   82     82   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
   83     83   
                #[allow(unused_mut)]
   84     84   
                let mut builder = ::http::Response::builder();
   85         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          85  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   86     86   
                    builder,
   87     87   
                    ::http::header::CONTENT_TYPE,
   88     88   
                    "application/json",
   89     89   
                );
   90         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          90  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   91     91   
                    builder,
   92     92   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   93     93   
                    "InternalServerError",
   94     94   
                );
   95     95   
                let content_length = payload.len();
   96         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          96  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   97     97   
                    builder,
   98     98   
                    ::http::header::CONTENT_LENGTH,
   99     99   
                    content_length,
  100    100   
                );
  101    101   
                builder
  102    102   
                    .status(500)
  103         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         103  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
  104    104   
            }
  105    105   
        }
  106    106   
    })
  107    107   
}

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

@@ -1,1 +105,105 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_http_payload_with_union_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::HttpPayloadWithUnionInput,
    7         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input = crate::input::http_payload_with_union_input_internal::Builder::default();
   18     18   
        #[allow(unused_variables)]
   19     19   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     20   
            uri, headers, body, ..
   21     21   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22     22   
        if let Some(value) = {
   23     23   
            let bytes = ::hyper::body::to_bytes(body).await?;
   24     24   
            if !bytes.is_empty() {
   25         -
                ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
          25  +
                ::aws_smithy_legacy_http_server::protocol::content_type_header_classifier_smithy(
   26     26   
                    &headers,
   27     27   
                    Some("application/json"),
   28     28   
                )?;
   29     29   
            }
   30     30   
            crate::protocol_serde::shape_http_payload_with_union_input::de_nested_payload(&bytes)?
   31     31   
        } {
   32     32   
            input = input.set_nested(Some(value))
   33     33   
        }
   34     34   
        input.build()
   35     35   
    })
   36     36   
}
   37     37   
   38     38   
#[allow(clippy::unnecessary_wraps)]
   39     39   
pub fn ser_http_payload_with_union_http_response(
   40     40   
    #[allow(unused_variables)] output: crate::output::HttpPayloadWithUnionOutput,
   41     41   
) -> std::result::Result<
   42         -
    ::aws_smithy_http_server::response::Response,
   43         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          42  +
    ::aws_smithy_legacy_http_server::response::Response,
          43  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     44   
> {
   45     45   
    Ok({
   46     46   
        #[allow(unused_mut)]
   47     47   
        let mut builder = ::http::Response::builder();
   48         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          48  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   49     49   
            builder,
   50     50   
            ::http::header::CONTENT_TYPE,
   51     51   
            "application/json",
   52     52   
        );
   53     53   
        let http_status: u16 = 200;
   54     54   
        builder = builder.status(http_status);
   55     55   
        let payload =
   56     56   
            crate::protocol_serde::shape_http_payload_with_union_output::ser_nested_http_payload(
   57     57   
                &output.nested,
   58     58   
            )?;
   59     59   
        let content_length = payload.len();
   60         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          60  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   61     61   
            builder,
   62     62   
            ::http::header::CONTENT_LENGTH,
   63     63   
            content_length,
   64     64   
        );
   65         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          65  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   66     66   
        builder.body(body)?
   67     67   
    })
   68     68   
}
   69     69   
   70     70   
#[allow(clippy::unnecessary_wraps)]
   71     71   
pub fn ser_http_payload_with_union_http_error(
   72     72   
    error: &crate::error::HttpPayloadWithUnionError,
   73     73   
) -> std::result::Result<
   74         -
    ::aws_smithy_http_server::response::Response,
   75         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          74  +
    ::aws_smithy_legacy_http_server::response::Response,
          75  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   76     76   
> {
   77     77   
    Ok({
   78     78   
        match error {
   79     79   
            crate::error::HttpPayloadWithUnionError::InternalServerError(output) => {
   80     80   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
   81     81   
                #[allow(unused_mut)]
   82     82   
                let mut builder = ::http::Response::builder();
   83         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          83  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   84     84   
                    builder,
   85     85   
                    ::http::header::CONTENT_TYPE,
   86     86   
                    "application/json",
   87     87   
                );
   88         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          88  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   89     89   
                    builder,
   90     90   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   91     91   
                    "InternalServerError",
   92     92   
                );
   93     93   
                let content_length = payload.len();
   94         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          94  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   95     95   
                    builder,
   96     96   
                    ::http::header::CONTENT_LENGTH,
   97     97   
                    content_length,
   98     98   
                );
   99     99   
                builder
  100    100   
                    .status(500)
  101         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         101  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
  102    102   
            }
  103    103   
        }
  104    104   
    })
  105    105   
}

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

@@ -1,1 +156,154 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_http_prefix_headers_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::HttpPrefixHeadersInput,
    7         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input = crate::input::http_prefix_headers_input_internal::Builder::default();
   18     18   
        #[allow(unused_variables)]
   19     19   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     20   
            uri, headers, body, ..
   21     21   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   22     22   
        if let Some(value) =
   23     23   
            crate::protocol_serde::shape_http_prefix_headers_input::de_foo_header(&headers)?
   24     24   
        {
   25     25   
            input = input.set_foo(Some(value))
   26     26   
        }
   27     27   
        if let Some(value) =
   28     28   
            crate::protocol_serde::shape_http_prefix_headers_input::de_foo_map_prefix_header(
   29     29   
                &headers,
   30     30   
            )?
   31     31   
        {
   32     32   
            input = input.set_foo_map(Some(value))
   33     33   
        }
   34     34   
        input.build()
   35     35   
    })
   36     36   
}
   37     37   
   38     38   
#[allow(clippy::unnecessary_wraps)]
   39     39   
pub fn ser_http_prefix_headers_http_response(
   40     40   
    #[allow(unused_variables)] output: crate::output::HttpPrefixHeadersOutput,
   41     41   
) -> std::result::Result<
   42         -
    ::aws_smithy_http_server::response::Response,
   43         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          42  +
    ::aws_smithy_legacy_http_server::response::Response,
          43  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   44     44   
> {
   45     45   
    Ok({
   46     46   
        #[allow(unused_mut)]
   47     47   
        let mut builder = ::http::Response::builder();
   48     48   
        builder =
   49     49   
            crate::protocol_serde::shape_http_prefix_headers::ser_http_prefix_headers_headers(
   50     50   
                &output, builder,
   51     51   
            )?;
   52         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          52  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   53     53   
            builder,
   54     54   
            ::http::header::CONTENT_TYPE,
   55     55   
            "application/json",
   56     56   
        );
   57     57   
        let http_status: u16 = 200;
   58     58   
        builder = builder.status(http_status);
   59     59   
        let payload =
   60     60   
            crate::protocol_serde::shape_http_prefix_headers_output::ser_http_prefix_headers_output_output_output(&output)?
   61     61   
        ;
   62     62   
        let content_length = payload.len();
   63         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          63  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   64     64   
            builder,
   65     65   
            ::http::header::CONTENT_LENGTH,
   66     66   
            content_length,
   67     67   
        );
   68         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          68  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   69     69   
        builder.body(body)?
   70     70   
    })
   71     71   
}
   72     72   
   73     73   
#[allow(clippy::unnecessary_wraps)]
   74     74   
pub fn ser_http_prefix_headers_http_error(
   75     75   
    error: &crate::error::HttpPrefixHeadersError,
   76     76   
) -> std::result::Result<
   77         -
    ::aws_smithy_http_server::response::Response,
   78         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          77  +
    ::aws_smithy_legacy_http_server::response::Response,
          78  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   79     79   
> {
   80     80   
    Ok({
   81     81   
        match error {
   82     82   
            crate::error::HttpPrefixHeadersError::InternalServerError(output) => {
   83     83   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
   84     84   
                #[allow(unused_mut)]
   85     85   
                let mut builder = ::http::Response::builder();
   86         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          86  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   87     87   
                    builder,
   88     88   
                    ::http::header::CONTENT_TYPE,
   89     89   
                    "application/json",
   90     90   
                );
   91         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          91  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   92     92   
                    builder,
   93     93   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   94     94   
                    "InternalServerError",
   95     95   
                );
   96     96   
                let content_length = payload.len();
   97         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          97  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   98     98   
                    builder,
   99     99   
                    ::http::header::CONTENT_LENGTH,
  100    100   
                    content_length,
  101    101   
                );
  102    102   
                builder
  103    103   
                    .status(500)
  104         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         104  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
  105    105   
            }
  106    106   
        }
  107    107   
    })
  108    108   
}
  109    109   
  110    110   
pub fn ser_http_prefix_headers_headers(
  111    111   
    input: &crate::output::HttpPrefixHeadersOutput,
  112    112   
    mut builder: ::http::response::Builder,
  113    113   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  114    114   
{
  115    115   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
  116    116   
        let formatted_2 = inner_1.as_str();
  117    117   
        if !formatted_2.is_empty() {
  118    118   
            let header_value = formatted_2;
  119    119   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  120    120   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  121    121   
                    "foo",
  122    122   
                    format!(
  123    123   
                        "`{}` cannot be used as a header value: {}",
  124    124   
                        &header_value, err
  125    125   
                    ),
  126    126   
                )
  127    127   
            })?;
  128    128   
            builder = builder.header("x-foo", header_value);
  129    129   
        }
  130    130   
    }
  131    131   
    if let ::std::option::Option::Some(inner_3) = &input.foo_map {
  132    132   
        {
  133    133   
            for (k, v) in inner_3 {
  134    134   
                use std::str::FromStr;
  135         -
                let header_name =
  136         -
                    http::header::HeaderName::from_str(&format!("{}{}", "x-foo-", &k)).map_err(
  137         -
                        |err| {
         135  +
                let header_name = ::http::HeaderName::from_str(&format!("{}{}", "x-foo-", &k))
         136  +
                    .map_err(|err| {
  138    137   
                        ::aws_smithy_types::error::operation::BuildError::invalid_field(
  139    138   
                            "foo_map",
  140    139   
                            format!("`{k}` cannot be used as a header name: {err}"),
  141    140   
                        )
  142         -
                        },
  143         -
                    )?;
         141  +
                    })?;
  144    142   
                let header_value = v.as_str();
  145    143   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  146    144   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  147    145   
                        "foo_map",
  148    146   
                        format!("`{v}` cannot be used as a header value: {err}"),
  149    147   
                    )
  150    148   
                })?;
  151    149   
                builder = builder.header(header_name, header_value);
  152    150   
            }
  153    151   
        }

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

@@ -1,1 +124,124 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_http_prefix_headers_in_response_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::HttpPrefixHeadersInResponseInput,
    7         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input =
   18     18   
            crate::input::http_prefix_headers_in_response_input_internal::Builder::default();
   19     19   
        #[allow(unused_variables)]
   20     20   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     21   
            uri, headers, body, ..
   22     22   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   23     23   
        input.build()
   24     24   
    })
   25     25   
}
   26     26   
   27     27   
#[allow(clippy::unnecessary_wraps)]
   28     28   
pub fn ser_http_prefix_headers_in_response_http_response(
   29     29   
    #[allow(unused_variables)] output: crate::output::HttpPrefixHeadersInResponseOutput,
   30     30   
) -> std::result::Result<
   31         -
    ::aws_smithy_http_server::response::Response,
   32         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          31  +
    ::aws_smithy_legacy_http_server::response::Response,
          32  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   33     33   
> {
   34     34   
    Ok({
   35     35   
        #[allow(unused_mut)]
   36     36   
        let mut builder = ::http::Response::builder();
   37     37   
        builder = crate::protocol_serde::shape_http_prefix_headers_in_response::ser_http_prefix_headers_in_response_headers(&output, builder)?;
   38         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          38  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   39     39   
            builder,
   40     40   
            ::http::header::CONTENT_TYPE,
   41     41   
            "application/json",
   42     42   
        );
   43     43   
        let http_status: u16 = 200;
   44     44   
        builder = builder.status(http_status);
   45     45   
        let payload =
   46     46   
            crate::protocol_serde::shape_http_prefix_headers_in_response_output::ser_http_prefix_headers_in_response_output_output_output(&output)?
   47     47   
        ;
   48     48   
        let content_length = payload.len();
   49         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          49  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   50     50   
            builder,
   51     51   
            ::http::header::CONTENT_LENGTH,
   52     52   
            content_length,
   53     53   
        );
   54         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          54  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   55     55   
        builder.body(body)?
   56     56   
    })
   57     57   
}
   58     58   
   59     59   
#[allow(clippy::unnecessary_wraps)]
   60     60   
pub fn ser_http_prefix_headers_in_response_http_error(
   61     61   
    error: &crate::error::HttpPrefixHeadersInResponseError,
   62     62   
) -> std::result::Result<
   63         -
    ::aws_smithy_http_server::response::Response,
   64         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          63  +
    ::aws_smithy_legacy_http_server::response::Response,
          64  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   65     65   
> {
   66     66   
    Ok({
   67     67   
        match error {
   68     68   
            crate::error::HttpPrefixHeadersInResponseError::InternalServerError(output) => {
   69     69   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
   70     70   
                #[allow(unused_mut)]
   71     71   
                let mut builder = ::http::Response::builder();
   72         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          72  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   73     73   
                    builder,
   74     74   
                    ::http::header::CONTENT_TYPE,
   75     75   
                    "application/json",
   76     76   
                );
   77         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          77  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   78     78   
                    builder,
   79     79   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   80     80   
                    "InternalServerError",
   81     81   
                );
   82     82   
                let content_length = payload.len();
   83         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          83  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   84     84   
                    builder,
   85     85   
                    ::http::header::CONTENT_LENGTH,
   86     86   
                    content_length,
   87     87   
                );
   88     88   
                builder
   89     89   
                    .status(500)
   90         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
          90  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
   91     91   
            }
   92     92   
        }
   93     93   
    })
   94     94   
}
   95     95   
   96     96   
pub fn ser_http_prefix_headers_in_response_headers(
   97     97   
    input: &crate::output::HttpPrefixHeadersInResponseOutput,
   98     98   
    mut builder: ::http::response::Builder,
   99     99   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  100    100   
{
  101    101   
    if let ::std::option::Option::Some(inner_1) = &input.prefix_headers {
  102    102   
        {
  103    103   
            for (k, v) in inner_1 {
  104    104   
                use std::str::FromStr;
  105         -
                let header_name = http::header::HeaderName::from_str(&format!("{}{}", "", &k))
  106         -
                    .map_err(|err| {
         105  +
                let header_name =
         106  +
                    ::http::HeaderName::from_str(&format!("{}{}", "", &k)).map_err(|err| {
  107    107   
                        ::aws_smithy_types::error::operation::BuildError::invalid_field(
  108    108   
                            "prefix_headers",
  109    109   
                            format!("`{k}` cannot be used as a header name: {err}"),
  110    110   
                        )
  111    111   
                    })?;
  112    112   
                let header_value = v.as_str();
  113    113   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  114    114   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  115    115   
                        "prefix_headers",
  116    116   
                        format!("`{v}` cannot be used as a header value: {err}"),

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

@@ -1,1 +35,38 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub(crate) fn de_foo_header(
    3      3   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      4   
) -> ::std::result::Result<
    5      5   
    ::std::option::Option<::std::string::String>,
    6         -
    ::aws_smithy_http::header::ParseError,
           6  +
    ::aws_smithy_legacy_http::header::ParseError,
    7      7   
> {
    8      8   
    let headers = header_map.get_all("x-foo");
    9         -
    ::aws_smithy_http::header::one_or_none(headers)
           9  +
    ::aws_smithy_legacy_http::header::one_or_none(headers)
   10     10   
}
   11     11   
   12     12   
pub(crate) fn de_foo_map_prefix_header(
   13     13   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   14     14   
) -> std::result::Result<
   15     15   
    ::std::option::Option<
   16     16   
        ::std::collections::HashMap<::std::string::String, ::std::string::String>,
   17     17   
    >,
   18         -
    ::aws_smithy_http::header::ParseError,
          18  +
    ::aws_smithy_legacy_http::header::ParseError,
   19     19   
> {
   20         -
    let headers =
   21         -
        ::aws_smithy_http::header::headers_for_prefix(header_map.iter().map(|(k, _)| k), "x-foo-");
          20  +
    let headers = ::aws_smithy_legacy_http::header::headers_for_prefix(
          21  +
        header_map.iter().map(|(k, _)| k),
          22  +
        "x-foo-",
          23  +
    );
   22     24   
    let out: std::result::Result<_, _> = headers.map(|(key, header_name)| {
   23     25   
                            let values = header_map.get_all(header_name);
   24     26   
                            crate::protocol_serde::shape_http_prefix_headers_input::de_foo_map_inner(values).map(|v| (key.to_string(), v.expect(
   25     27   
                                "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"
   26     28   
                            )))
   27     29   
                        }).collect();
   28     30   
    out.map(Some)
   29     31   
}
   30     32   
   31     33   
pub fn de_foo_map_inner<'a>(
   32     34   
    headers: impl ::std::iter::Iterator<Item = &'a str>,
   33         -
) -> std::result::Result<Option<::std::string::String>, ::aws_smithy_http::header::ParseError> {
   34         -
    ::aws_smithy_http::header::one_or_none(headers)
          35  +
) -> std::result::Result<Option<::std::string::String>, ::aws_smithy_legacy_http::header::ParseError>
          36  +
{
          37  +
    ::aws_smithy_legacy_http::header::one_or_none(headers)
   35     38   
}

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

@@ -1,1 +146,146 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_http_request_with_float_labels_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::HttpRequestWithFloatLabelsInput,
    7         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
           7  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8      8   
>
    9      9   
where
   10         -
    B: ::aws_smithy_http_server::body::HttpBody + Send,
          10  +
    B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
   11     11   
    B::Data: Send,
   12         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13         -
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
          12  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
          13  +
        From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
   14     14   
{
   15     15   
    Ok({
   16     16   
        #[allow(unused_mut)]
   17     17   
        let mut input =
   18     18   
            crate::input::http_request_with_float_labels_input_internal::Builder::default();
   19     19   
        #[allow(unused_variables)]
   20     20   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     21   
            uri, headers, body, ..
   22     22   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
   23     23   
        let input_string = uri.path();
   24     24   
        let (input_string, (_, m1, m2)) =
   25     25   
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
   26     26   
                ::nom::sequence::preceded(
   27     27   
                    ::nom::bytes::complete::tag("/"),
   28     28   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
   29     29   
                        "FloatHttpLabels",
   30     30   
                    ),
   31     31   
                ),
   32     32   
                ::nom::sequence::preceded(
   33     33   
                    ::nom::bytes::complete::tag("/"),
   34     34   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   35     35   
                        ::nom::bytes::complete::take_until("/"),
   36     36   
                        ::nom::combinator::rest,
   37     37   
                    )),
   38     38   
                ),
   39     39   
                ::nom::sequence::preceded(
   40     40   
                    ::nom::bytes::complete::tag("/"),
   41     41   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   42     42   
                        ::nom::bytes::complete::take_until("/"),
   43     43   
                        ::nom::combinator::rest,
   44     44   
                    )),
   45     45   
                ),
   46     46   
            ))(input_string)?;
   47     47   
        debug_assert_eq!("", input_string);
   48     48   
        input = input.set_float(
   49     49   
            crate::protocol_serde::shape_http_request_with_float_labels_input::de_float(m1)?,
   50     50   
        );
   51     51   
        input = input.set_double(
   52     52   
            crate::protocol_serde::shape_http_request_with_float_labels_input::de_double(m2)?,
   53     53   
        );
   54     54   
        input.build()?
   55     55   
    })
   56     56   
}
   57     57   
   58     58   
#[allow(clippy::unnecessary_wraps)]
   59     59   
pub fn ser_http_request_with_float_labels_http_response(
   60     60   
    #[allow(unused_variables)] output: crate::output::HttpRequestWithFloatLabelsOutput,
   61     61   
) -> std::result::Result<
   62         -
    ::aws_smithy_http_server::response::Response,
   63         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          62  +
    ::aws_smithy_legacy_http_server::response::Response,
          63  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   64     64   
> {
   65     65   
    Ok({
   66     66   
        #[allow(unused_mut)]
   67     67   
        let mut builder = ::http::Response::builder();
   68         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          68  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   69     69   
            builder,
   70     70   
            ::http::header::CONTENT_TYPE,
   71     71   
            "application/json",
   72     72   
        );
   73     73   
        let http_status: u16 = 200;
   74     74   
        builder = builder.status(http_status);
   75     75   
        let payload = "";
   76     76   
        let content_length = payload.len();
   77         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          77  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   78     78   
            builder,
   79     79   
            ::http::header::CONTENT_LENGTH,
   80     80   
            content_length,
   81     81   
        );
   82         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          82  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   83     83   
        builder.body(body)?
   84     84   
    })
   85     85   
}
   86     86   
   87     87   
#[allow(clippy::unnecessary_wraps)]
   88     88   
pub fn ser_http_request_with_float_labels_http_error(
   89     89   
    error: &crate::error::HttpRequestWithFloatLabelsError,
   90     90   
) -> std::result::Result<
   91         -
    ::aws_smithy_http_server::response::Response,
   92         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          91  +
    ::aws_smithy_legacy_http_server::response::Response,
          92  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   93     93   
> {
   94     94   
    Ok({
   95     95   
        match error {
   96     96   
            crate::error::HttpRequestWithFloatLabelsError::ValidationException(output) => {
   97     97   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
   98     98   
                #[allow(unused_mut)]
   99     99   
                let mut builder = ::http::Response::builder();
  100         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         100  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  101    101   
                    builder,
  102    102   
                    ::http::header::CONTENT_TYPE,
  103    103   
                    "application/json",
  104    104   
                );
  105         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         105  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  106    106   
                    builder,
  107    107   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  108    108   
                    "ValidationException",
  109    109   
                );
  110    110   
                let content_length = payload.len();
  111         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         111  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  112    112   
                    builder,
  113    113   
                    ::http::header::CONTENT_LENGTH,
  114    114   
                    content_length,
  115    115   
                );
  116    116   
                builder
  117    117   
                    .status(400)
  118         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         118  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
  119    119   
            }
  120    120   
            crate::error::HttpRequestWithFloatLabelsError::InternalServerError(output) => {
  121    121   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
  122    122   
                #[allow(unused_mut)]
  123    123   
                let mut builder = ::http::Response::builder();
  124         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         124  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  125    125   
                    builder,
  126    126   
                    ::http::header::CONTENT_TYPE,
  127    127   
                    "application/json",
  128    128   
                );
  129         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         129  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  130    130   
                    builder,
  131    131   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  132    132   
                    "InternalServerError",
  133    133   
                );
  134    134   
                let content_length = payload.len();
  135         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         135  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  136    136   
                    builder,
  137    137   
                    ::http::header::CONTENT_LENGTH,
  138    138   
                    content_length,
  139    139   
                );
  140    140   
                builder
  141    141   
                    .status(500)
  142         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         142  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
  143    143   
            }
  144    144   
        }
  145    145   
    })
  146    146   
}