Server Test Python

Server Test Python

rev. 3c756f73b1f83a0eed4275d9d1e22df0b10b66fb

Files changed:

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

@@ -1,1 +15,15 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub fn de_timestamp(
    3      3   
    value: &str,
    4      4   
) -> std::result::Result<
    5      5   
    ::aws_smithy_http_server_python::types::DateTime,
    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   
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
    9      9   
    let value = ::aws_smithy_types::DateTime::from_str(
   10     10   
        value.as_ref(),
   11     11   
        ::aws_smithy_types::date_time::Format::EpochSeconds,
   12     12   
    )?
   13     13   
    .into();
   14     14   
    Ok(value)
   15     15   
}

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

@@ -1,1 +138,138 @@
    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_malformed_timestamp_path_http_date_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::MalformedTimestampPathHttpDateInput,
    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::malformed_timestamp_path_http_date_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)) =
   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   
                        "MalformedTimestampPathHttpDate",
   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   
            ))(input_string)?;
   40     40   
        debug_assert_eq!("", input_string);
   41     41   
        input = input.set_timestamp(
   42     42   
            crate::protocol_serde::shape_malformed_timestamp_path_http_date_input::de_timestamp(
   43     43   
                m1,
   44     44   
            )?,
   45     45   
        );
   46     46   
        input.build()?
   47     47   
    })
   48     48   
}
   49     49   
   50     50   
#[allow(clippy::unnecessary_wraps)]
   51     51   
pub fn ser_malformed_timestamp_path_http_date_http_response(
   52     52   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampPathHttpDateOutput,
   53     53   
) -> std::result::Result<
   54         -
    ::aws_smithy_http_server::response::Response,
   55         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          54  +
    ::aws_smithy_legacy_http_server::response::Response,
          55  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   56     56   
> {
   57     57   
    Ok({
   58     58   
        #[allow(unused_mut)]
   59     59   
        let mut builder = ::http::Response::builder();
   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_TYPE,
   63     63   
            "application/json",
   64     64   
        );
   65     65   
        let http_status: u16 = 200;
   66     66   
        builder = builder.status(http_status);
   67     67   
        let payload = "";
   68     68   
        let content_length = payload.len();
   69         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          69  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   70     70   
            builder,
   71     71   
            ::http::header::CONTENT_LENGTH,
   72     72   
            content_length,
   73     73   
        );
   74         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          74  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   75     75   
        builder.body(body)?
   76     76   
    })
   77     77   
}
   78     78   
   79     79   
#[allow(clippy::unnecessary_wraps)]
   80     80   
pub fn ser_malformed_timestamp_path_http_date_http_error(
   81     81   
    error: &crate::error::MalformedTimestampPathHttpDateError,
   82     82   
) -> std::result::Result<
   83         -
    ::aws_smithy_http_server::response::Response,
   84         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          83  +
    ::aws_smithy_legacy_http_server::response::Response,
          84  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   85     85   
> {
   86     86   
    Ok({
   87     87   
        match error {
   88     88   
            crate::error::MalformedTimestampPathHttpDateError::ValidationException(output) => {
   89     89   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
   90     90   
                #[allow(unused_mut)]
   91     91   
                let mut builder = ::http::Response::builder();
   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_TYPE,
   95     95   
                    "application/json",
   96     96   
                );
   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::HeaderName::from_static("x-amzn-errortype"),
  100    100   
                    "ValidationException",
  101    101   
                );
  102    102   
                let content_length = payload.len();
  103         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         103  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  104    104   
                    builder,
  105    105   
                    ::http::header::CONTENT_LENGTH,
  106    106   
                    content_length,
  107    107   
                );
  108    108   
                builder
  109    109   
                    .status(400)
  110         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         110  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
  111    111   
            }
  112    112   
            crate::error::MalformedTimestampPathHttpDateError::InternalServerError(output) => {
  113    113   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
  114    114   
                #[allow(unused_mut)]
  115    115   
                let mut builder = ::http::Response::builder();
  116         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         116  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  117    117   
                    builder,
  118    118   
                    ::http::header::CONTENT_TYPE,
  119    119   
                    "application/json",
  120    120   
                );
  121         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         121  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  122    122   
                    builder,
  123    123   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  124    124   
                    "InternalServerError",
  125    125   
                );
  126    126   
                let content_length = payload.len();
  127         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         127  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  128    128   
                    builder,
  129    129   
                    ::http::header::CONTENT_LENGTH,
  130    130   
                    content_length,
  131    131   
                );
  132    132   
                builder
  133    133   
                    .status(500)
  134         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         134  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
  135    135   
            }
  136    136   
        }
  137    137   
    })
  138    138   
}

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

@@ -1,1 +15,15 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub fn de_timestamp(
    3      3   
    value: &str,
    4      4   
) -> std::result::Result<
    5      5   
    ::aws_smithy_http_server_python::types::DateTime,
    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   
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
    9      9   
    let value = ::aws_smithy_types::DateTime::from_str(
   10     10   
        value.as_ref(),
   11     11   
        ::aws_smithy_types::date_time::Format::HttpDate,
   12     12   
    )?
   13     13   
    .into();
   14     14   
    Ok(value)
   15     15   
}

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

@@ -1,1 +126,126 @@
    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_malformed_timestamp_query_default_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::MalformedTimestampQueryDefaultInput,
    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::malformed_timestamp_query_default_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 query_string = uri.query().unwrap_or("");
   24     24   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
   25     25   
        let mut timestamp_seen = false;
   26     26   
        for (k, v) in pairs {
   27     27   
            if !timestamp_seen && k == "timestamp" {
   28     28   
                input = input.set_timestamp(
   29     29   
                    crate::protocol_serde::shape_malformed_timestamp_query_default_input::de_timestamp(&v)?
   30     30   
                );
   31     31   
                timestamp_seen = true;
   32     32   
            }
   33     33   
        }
   34     34   
        input.build()?
   35     35   
    })
   36     36   
}
   37     37   
   38     38   
#[allow(clippy::unnecessary_wraps)]
   39     39   
pub fn ser_malformed_timestamp_query_default_http_response(
   40     40   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampQueryDefaultOutput,
   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   
        let content_length = payload.len();
   57         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          57  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   58     58   
            builder,
   59     59   
            ::http::header::CONTENT_LENGTH,
   60     60   
            content_length,
   61     61   
        );
   62         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          62  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   63     63   
        builder.body(body)?
   64     64   
    })
   65     65   
}
   66     66   
   67     67   
#[allow(clippy::unnecessary_wraps)]
   68     68   
pub fn ser_malformed_timestamp_query_default_http_error(
   69     69   
    error: &crate::error::MalformedTimestampQueryDefaultError,
   70     70   
) -> std::result::Result<
   71         -
    ::aws_smithy_http_server::response::Response,
   72         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          71  +
    ::aws_smithy_legacy_http_server::response::Response,
          72  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   73     73   
> {
   74     74   
    Ok({
   75     75   
        match error {
   76     76   
            crate::error::MalformedTimestampQueryDefaultError::ValidationException(output) => {
   77     77   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
   78     78   
                #[allow(unused_mut)]
   79     79   
                let mut builder = ::http::Response::builder();
   80         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          80  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   81     81   
                    builder,
   82     82   
                    ::http::header::CONTENT_TYPE,
   83     83   
                    "application/json",
   84     84   
                );
   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::HeaderName::from_static("x-amzn-errortype"),
   88     88   
                    "ValidationException",
   89     89   
                );
   90     90   
                let content_length = payload.len();
   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::CONTENT_LENGTH,
   94     94   
                    content_length,
   95     95   
                );
   96     96   
                builder
   97     97   
                    .status(400)
   98         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
          98  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
   99     99   
            }
  100    100   
            crate::error::MalformedTimestampQueryDefaultError::InternalServerError(output) => {
  101    101   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
  102    102   
                #[allow(unused_mut)]
  103    103   
                let mut builder = ::http::Response::builder();
  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_TYPE,
  107    107   
                    "application/json",
  108    108   
                );
  109         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         109  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  110    110   
                    builder,
  111    111   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  112    112   
                    "InternalServerError",
  113    113   
                );
  114    114   
                let content_length = payload.len();
  115         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         115  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  116    116   
                    builder,
  117    117   
                    ::http::header::CONTENT_LENGTH,
  118    118   
                    content_length,
  119    119   
                );
  120    120   
                builder
  121    121   
                    .status(500)
  122         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         122  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
  123    123   
            }
  124    124   
        }
  125    125   
    })
  126    126   
}

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

@@ -1,1 +14,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub fn de_timestamp(
    3      3   
    value: &str,
    4      4   
) -> std::result::Result<
    5      5   
    ::aws_smithy_http_server_python::types::DateTime,
    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   
    let value = ::aws_smithy_types::DateTime::from_str(
    9      9   
        value,
   10     10   
        ::aws_smithy_types::date_time::Format::DateTime,
   11     11   
    )?
   12     12   
    .into();
   13     13   
    Ok(value)
   14     14   
}

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

@@ -1,1 +126,126 @@
    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_malformed_timestamp_query_epoch_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::MalformedTimestampQueryEpochInput,
    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::malformed_timestamp_query_epoch_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 query_string = uri.query().unwrap_or("");
   24     24   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
   25     25   
        let mut timestamp_seen = false;
   26     26   
        for (k, v) in pairs {
   27     27   
            if !timestamp_seen && k == "timestamp" {
   28     28   
                input = input.set_timestamp(
   29     29   
                    crate::protocol_serde::shape_malformed_timestamp_query_epoch_input::de_timestamp(&v)?
   30     30   
                );
   31     31   
                timestamp_seen = true;
   32     32   
            }
   33     33   
        }
   34     34   
        input.build()?
   35     35   
    })
   36     36   
}
   37     37   
   38     38   
#[allow(clippy::unnecessary_wraps)]
   39     39   
pub fn ser_malformed_timestamp_query_epoch_http_response(
   40     40   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampQueryEpochOutput,
   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   
        let content_length = payload.len();
   57         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          57  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   58     58   
            builder,
   59     59   
            ::http::header::CONTENT_LENGTH,
   60     60   
            content_length,
   61     61   
        );
   62         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          62  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   63     63   
        builder.body(body)?
   64     64   
    })
   65     65   
}
   66     66   
   67     67   
#[allow(clippy::unnecessary_wraps)]
   68     68   
pub fn ser_malformed_timestamp_query_epoch_http_error(
   69     69   
    error: &crate::error::MalformedTimestampQueryEpochError,
   70     70   
) -> std::result::Result<
   71         -
    ::aws_smithy_http_server::response::Response,
   72         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          71  +
    ::aws_smithy_legacy_http_server::response::Response,
          72  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   73     73   
> {
   74     74   
    Ok({
   75     75   
        match error {
   76     76   
            crate::error::MalformedTimestampQueryEpochError::ValidationException(output) => {
   77     77   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
   78     78   
                #[allow(unused_mut)]
   79     79   
                let mut builder = ::http::Response::builder();
   80         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          80  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   81     81   
                    builder,
   82     82   
                    ::http::header::CONTENT_TYPE,
   83     83   
                    "application/json",
   84     84   
                );
   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::HeaderName::from_static("x-amzn-errortype"),
   88     88   
                    "ValidationException",
   89     89   
                );
   90     90   
                let content_length = payload.len();
   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::CONTENT_LENGTH,
   94     94   
                    content_length,
   95     95   
                );
   96     96   
                builder
   97     97   
                    .status(400)
   98         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
          98  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
   99     99   
            }
  100    100   
            crate::error::MalformedTimestampQueryEpochError::InternalServerError(output) => {
  101    101   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
  102    102   
                #[allow(unused_mut)]
  103    103   
                let mut builder = ::http::Response::builder();
  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_TYPE,
  107    107   
                    "application/json",
  108    108   
                );
  109         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         109  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  110    110   
                    builder,
  111    111   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  112    112   
                    "InternalServerError",
  113    113   
                );
  114    114   
                let content_length = payload.len();
  115         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         115  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  116    116   
                    builder,
  117    117   
                    ::http::header::CONTENT_LENGTH,
  118    118   
                    content_length,
  119    119   
                );
  120    120   
                builder
  121    121   
                    .status(500)
  122         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         122  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
  123    123   
            }
  124    124   
        }
  125    125   
    })
  126    126   
}

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

@@ -1,1 +14,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub fn de_timestamp(
    3      3   
    value: &str,
    4      4   
) -> std::result::Result<
    5      5   
    ::aws_smithy_http_server_python::types::DateTime,
    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   
    let value = ::aws_smithy_types::DateTime::from_str(
    9      9   
        value,
   10     10   
        ::aws_smithy_types::date_time::Format::EpochSeconds,
   11     11   
    )?
   12     12   
    .into();
   13     13   
    Ok(value)
   14     14   
}

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

@@ -1,1 +126,126 @@
    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_malformed_timestamp_query_http_date_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::MalformedTimestampQueryHttpDateInput,
    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::malformed_timestamp_query_http_date_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 query_string = uri.query().unwrap_or("");
   24     24   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
   25     25   
        let mut timestamp_seen = false;
   26     26   
        for (k, v) in pairs {
   27     27   
            if !timestamp_seen && k == "timestamp" {
   28     28   
                input = input.set_timestamp(
   29     29   
                    crate::protocol_serde::shape_malformed_timestamp_query_http_date_input::de_timestamp(&v)?
   30     30   
                );
   31     31   
                timestamp_seen = true;
   32     32   
            }
   33     33   
        }
   34     34   
        input.build()?
   35     35   
    })
   36     36   
}
   37     37   
   38     38   
#[allow(clippy::unnecessary_wraps)]
   39     39   
pub fn ser_malformed_timestamp_query_http_date_http_response(
   40     40   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampQueryHttpDateOutput,
   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   
        let content_length = payload.len();
   57         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          57  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   58     58   
            builder,
   59     59   
            ::http::header::CONTENT_LENGTH,
   60     60   
            content_length,
   61     61   
        );
   62         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          62  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   63     63   
        builder.body(body)?
   64     64   
    })
   65     65   
}
   66     66   
   67     67   
#[allow(clippy::unnecessary_wraps)]
   68     68   
pub fn ser_malformed_timestamp_query_http_date_http_error(
   69     69   
    error: &crate::error::MalformedTimestampQueryHttpDateError,
   70     70   
) -> std::result::Result<
   71         -
    ::aws_smithy_http_server::response::Response,
   72         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          71  +
    ::aws_smithy_legacy_http_server::response::Response,
          72  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   73     73   
> {
   74     74   
    Ok({
   75     75   
        match error {
   76     76   
            crate::error::MalformedTimestampQueryHttpDateError::ValidationException(output) => {
   77     77   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
   78     78   
                #[allow(unused_mut)]
   79     79   
                let mut builder = ::http::Response::builder();
   80         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          80  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   81     81   
                    builder,
   82     82   
                    ::http::header::CONTENT_TYPE,
   83     83   
                    "application/json",
   84     84   
                );
   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::HeaderName::from_static("x-amzn-errortype"),
   88     88   
                    "ValidationException",
   89     89   
                );
   90     90   
                let content_length = payload.len();
   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::CONTENT_LENGTH,
   94     94   
                    content_length,
   95     95   
                );
   96     96   
                builder
   97     97   
                    .status(400)
   98         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
          98  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
   99     99   
            }
  100    100   
            crate::error::MalformedTimestampQueryHttpDateError::InternalServerError(output) => {
  101    101   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
  102    102   
                #[allow(unused_mut)]
  103    103   
                let mut builder = ::http::Response::builder();
  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_TYPE,
  107    107   
                    "application/json",
  108    108   
                );
  109         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         109  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  110    110   
                    builder,
  111    111   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
  112    112   
                    "InternalServerError",
  113    113   
                );
  114    114   
                let content_length = payload.len();
  115         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
         115  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
  116    116   
                    builder,
  117    117   
                    ::http::header::CONTENT_LENGTH,
  118    118   
                    content_length,
  119    119   
                );
  120    120   
                builder
  121    121   
                    .status(500)
  122         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         122  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
  123    123   
            }
  124    124   
        }
  125    125   
    })
  126    126   
}

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

@@ -1,1 +14,14 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub fn de_timestamp(
    3      3   
    value: &str,
    4      4   
) -> std::result::Result<
    5      5   
    ::aws_smithy_http_server_python::types::DateTime,
    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   
    let value = ::aws_smithy_types::DateTime::from_str(
    9      9   
        value,
   10     10   
        ::aws_smithy_types::date_time::Format::HttpDate,
   11     11   
    )?
   12     12   
    .into();
   13     13   
    Ok(value)
   14     14   
}

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

@@ -1,1 +127,127 @@
    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_malformed_union_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::MalformedUnionInput,
    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::malformed_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   
        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_malformed_union::de_malformed_union(
   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_malformed_union_http_response(
   39     39   
    #[allow(unused_variables)] output: crate::output::MalformedUnionOutput,
   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   
        let content_length = payload.len();
   56         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          56  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   57     57   
            builder,
   58     58   
            ::http::header::CONTENT_LENGTH,
   59     59   
            content_length,
   60     60   
        );
   61         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          61  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   62     62   
        builder.body(body)?
   63     63   
    })
   64     64   
}
   65     65   
   66     66   
#[allow(clippy::unnecessary_wraps)]
   67     67   
pub fn ser_malformed_union_http_error(
   68     68   
    error: &crate::error::MalformedUnionError,
   69     69   
) -> std::result::Result<
   70         -
    ::aws_smithy_http_server::response::Response,
   71         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          70  +
    ::aws_smithy_legacy_http_server::response::Response,
          71  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72     72   
> {
   73     73   
    Ok({
   74     74   
        match error {
   75     75   
            crate::error::MalformedUnionError::InternalServerError(output) => {
   76     76   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
   77     77   
                #[allow(unused_mut)]
   78     78   
                let mut builder = ::http::Response::builder();
   79         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          79  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   80     80   
                    builder,
   81     81   
                    ::http::header::CONTENT_TYPE,
   82     82   
                    "application/json",
   83     83   
                );
   84         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          84  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   85     85   
                    builder,
   86     86   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   87     87   
                    "InternalServerError",
   88     88   
                );
   89     89   
                let content_length = payload.len();
   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::CONTENT_LENGTH,
   93     93   
                    content_length,
   94     94   
                );
   95     95   
                builder
   96     96   
                    .status(500)
   97         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
          97  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
   98     98   
            }
   99     99   
        }
  100    100   
    })
  101    101   
}
  102    102   
  103    103   
pub(crate) fn de_malformed_union(
  104    104   
    value: &[u8],
  105    105   
    mut builder: crate::input::malformed_union_input_internal::Builder,
  106    106   
) -> ::std::result::Result<
  107    107   
    crate::input::malformed_union_input_internal::Builder,

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_media_type_header.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_media_type_header_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::MediaTypeHeaderInput,
    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::media_type_header_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_media_type_header_input::de_json_header(&headers)?
   24     24   
        {
   25     25   
            input = input.set_json(Some(value))
   26     26   
        }
   27     27   
        input.build()
   28     28   
    })
   29     29   
}
   30     30   
   31     31   
#[allow(clippy::unnecessary_wraps)]
   32     32   
pub fn ser_media_type_header_http_response(
   33     33   
    #[allow(unused_variables)] output: crate::output::MediaTypeHeaderOutput,
   34     34   
) -> std::result::Result<
   35         -
    ::aws_smithy_http_server::response::Response,
   36         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          35  +
    ::aws_smithy_legacy_http_server::response::Response,
          36  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   37     37   
> {
   38     38   
    Ok({
   39     39   
        #[allow(unused_mut)]
   40     40   
        let mut builder = ::http::Response::builder();
   41     41   
        builder = crate::protocol_serde::shape_media_type_header::ser_media_type_header_headers(
   42     42   
            &output, builder,
   43     43   
        )?;
   44         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          44  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   45     45   
            builder,
   46     46   
            ::http::header::CONTENT_TYPE,
   47     47   
            "application/json",
   48     48   
        );
   49     49   
        let http_status: u16 = 200;
   50     50   
        builder = builder.status(http_status);
   51     51   
        let payload =
   52     52   
            crate::protocol_serde::shape_media_type_header_output::ser_media_type_header_output_output_output(&output)?
   53     53   
        ;
   54     54   
        let content_length = payload.len();
   55         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          55  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   56     56   
            builder,
   57     57   
            ::http::header::CONTENT_LENGTH,
   58     58   
            content_length,
   59     59   
        );
   60         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          60  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   61     61   
        builder.body(body)?
   62     62   
    })
   63     63   
}
   64     64   
   65     65   
#[allow(clippy::unnecessary_wraps)]
   66     66   
pub fn ser_media_type_header_http_error(
   67     67   
    error: &crate::error::MediaTypeHeaderError,
   68     68   
) -> std::result::Result<
   69         -
    ::aws_smithy_http_server::response::Response,
   70         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          69  +
    ::aws_smithy_legacy_http_server::response::Response,
          70  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   71     71   
> {
   72     72   
    Ok({
   73     73   
        match error {
   74     74   
            crate::error::MediaTypeHeaderError::InternalServerError(output) => {
   75     75   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
   76     76   
                #[allow(unused_mut)]
   77     77   
                let mut builder = ::http::Response::builder();
   78         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          78  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   79     79   
                    builder,
   80     80   
                    ::http::header::CONTENT_TYPE,
   81     81   
                    "application/json",
   82     82   
                );
   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::HeaderName::from_static("x-amzn-errortype"),
   86     86   
                    "InternalServerError",
   87     87   
                );
   88     88   
                let content_length = payload.len();
   89         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          89  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   90     90   
                    builder,
   91     91   
                    ::http::header::CONTENT_LENGTH,
   92     92   
                    content_length,
   93     93   
                );
   94     94   
                builder
   95     95   
                    .status(500)
   96         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
          96  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
   97     97   
            }
   98     98   
        }
   99     99   
    })
  100    100   
}
  101    101   
  102    102   
pub fn ser_media_type_header_headers(
  103    103   
    input: &crate::output::MediaTypeHeaderOutput,
  104    104   
    mut builder: ::http::response::Builder,
  105    105   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  106    106   
{

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

@@ -1,1 +34,37 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub(crate) fn de_json_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-Json");
    9         -
    let var_1: Vec<::std::string::String> = ::aws_smithy_http::header::read_many_from_str(headers)?;
           9  +
    let var_1: Vec<::std::string::String> =
          10  +
        ::aws_smithy_legacy_http::header::read_many_from_str(headers)?;
   10     11   
    let var_1: std::result::Result<Vec<_>, _> = var_1
   11     12   
        .iter()
   12     13   
        .map(|s| {
   13     14   
            ::aws_smithy_types::base64::decode(s)
   14         -
                .map_err(|_| ::aws_smithy_http::header::ParseError::new("failed to decode base64"))
          15  +
                .map_err(|_| {
          16  +
                    ::aws_smithy_legacy_http::header::ParseError::new("failed to decode base64")
          17  +
                })
   15     18   
                .and_then(|bytes| {
   16     19   
                    String::from_utf8(bytes).map_err(|_| {
   17         -
                        ::aws_smithy_http::header::ParseError::new(
          20  +
                        ::aws_smithy_legacy_http::header::ParseError::new(
   18     21   
                            "base64 encoded data was not valid utf-8",
   19     22   
                        )
   20     23   
                    })
   21     24   
                })
   22     25   
        })
   23     26   
        .collect();
   24     27   
    let var_1 = var_1?;
   25     28   
    if var_1.len() > 1 {
   26         -
        Err(::aws_smithy_http::header::ParseError::new(format!(
          29  +
        Err(::aws_smithy_legacy_http::header::ParseError::new(format!(
   27     30   
            "expected one item but found {}",
   28     31   
            var_1.len()
   29     32   
        )))
   30     33   
    } else {
   31     34   
        let mut var_1 = var_1;
   32     35   
        Ok(var_1.pop())
   33     36   
    }
   34     37   
}

tmp-codegen-diff/codegen-server-test-python/rest_json/rust-server-codegen-python/src/protocol_serde/shape_no_input_and_no_output.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_no_input_and_no_output_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::NoInputAndNoOutputInput,
    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::no_input_and_no_output_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_no_input_and_no_output_http_response(
   29     31   
    #[allow(unused_variables)] output: crate::output::NoInputAndNoOutputOutput,
   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_no_input_and_no_output_http_error(
   58     60   
    error: &crate::error::NoInputAndNoOutputError,
   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::NoInputAndNoOutputError::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_no_input_and_output.rs

@@ -1,1 +93,95 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
#[allow(clippy::unnecessary_wraps)]
    3      3   
pub async fn de_no_input_and_output_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::NoInputAndOutputInput,
    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::no_input_and_output_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_no_input_and_output_http_response(
   29     31   
    #[allow(unused_variables)] output: crate::output::NoInputAndOutputOutput,
   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   
            crate::protocol_serde::shape_no_input_and_output_output::ser_no_input_and_output_output_output_output(&output)?
   46     48   
        ;
   47     49   
        let content_length = payload.len();
   48         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          50  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   49     51   
            builder,
   50     52   
            ::http::header::CONTENT_LENGTH,
   51     53   
            content_length,
   52     54   
        );
   53         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          55  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   54     56   
        builder.body(body)?
   55     57   
    })
   56     58   
}
   57     59   
   58     60   
#[allow(clippy::unnecessary_wraps)]
   59     61   
pub fn ser_no_input_and_output_http_error(
   60     62   
    error: &crate::error::NoInputAndOutputError,
   61     63   
) -> std::result::Result<
   62         -
    ::aws_smithy_http_server::response::Response,
   63         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          64  +
    ::aws_smithy_legacy_http_server::response::Response,
          65  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   64     66   
> {
   65     67   
    Ok({
   66     68   
        match error {
   67     69   
            crate::error::NoInputAndOutputError::InternalServerError(output) => {
   68     70   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
   69     71   
                #[allow(unused_mut)]
   70     72   
                let mut builder = ::http::Response::builder();
   71         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          73  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   72     74   
                    builder,
   73     75   
                    ::http::header::CONTENT_TYPE,
   74     76   
                    "application/json",
   75     77   
                );
   76         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          78  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   77     79   
                    builder,
   78     80   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   79     81   
                    "InternalServerError",
   80     82   
                );
   81     83   
                let content_length = payload.len();
   82         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          84  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   83     85   
                    builder,
   84     86   
                    ::http::header::CONTENT_LENGTH,
   85     87   
                    content_length,
   86     88   
                );
   87     89   
                builder
   88     90   
                    .status(500)
   89         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
          91  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
   90     92   
            }
   91     93   
        }
   92     94   
    })
   93     95   
}

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

@@ -1,1 +167,168 @@
    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_null_and_empty_headers_client_http_request<B>(
    4      4   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      5   
) -> std::result::Result<
    6      6   
    crate::input::NullAndEmptyHeadersClientInput,
    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::null_and_empty_headers_client_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   
            crate::protocol_serde::shape_null_and_empty_headers_client_input::de_a_header(&headers)?
   25     25   
        {
   26     26   
            input = input.set_a(Some(value))
   27     27   
        }
   28     28   
        if let Some(value) =
   29     29   
            crate::protocol_serde::shape_null_and_empty_headers_client_input::de_b_header(&headers)?
   30     30   
        {
   31     31   
            input = input.set_b(Some(value))
   32     32   
        }
   33     33   
        if let Some(value) =
   34     34   
            crate::protocol_serde::shape_null_and_empty_headers_client_input::de_c_header(&headers)?
   35     35   
        {
   36     36   
            input = input.set_c(Some(value))
   37     37   
        }
   38     38   
        input.build()
   39     39   
    })
   40     40   
}
   41     41   
   42     42   
#[allow(clippy::unnecessary_wraps)]
   43     43   
pub fn ser_null_and_empty_headers_client_http_response(
   44     44   
    #[allow(unused_variables)] output: crate::output::NullAndEmptyHeadersClientOutput,
   45     45   
) -> std::result::Result<
   46         -
    ::aws_smithy_http_server::response::Response,
   47         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          46  +
    ::aws_smithy_legacy_http_server::response::Response,
          47  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   48     48   
> {
   49     49   
    Ok({
   50     50   
        #[allow(unused_mut)]
   51     51   
        let mut builder = ::http::Response::builder();
   52     52   
        builder = crate::protocol_serde::shape_null_and_empty_headers_client::ser_null_and_empty_headers_client_headers(&output, builder)?;
   53         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          53  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   54     54   
            builder,
   55     55   
            ::http::header::CONTENT_TYPE,
   56     56   
            "application/json",
   57     57   
        );
   58     58   
        let http_status: u16 = 200;
   59     59   
        builder = builder.status(http_status);
   60     60   
        let payload =
   61     61   
            crate::protocol_serde::shape_null_and_empty_headers_client_output::ser_null_and_empty_headers_client_output_output_output(&output)?
   62     62   
        ;
   63     63   
        let content_length = payload.len();
   64         -
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
          64  +
        builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   65     65   
            builder,
   66     66   
            ::http::header::CONTENT_LENGTH,
   67     67   
            content_length,
   68     68   
        );
   69         -
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          69  +
        let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
   70     70   
        builder.body(body)?
   71     71   
    })
   72     72   
}
   73     73   
   74     74   
#[allow(clippy::unnecessary_wraps)]
   75     75   
pub fn ser_null_and_empty_headers_client_http_error(
   76     76   
    error: &crate::error::NullAndEmptyHeadersClientError,
   77     77   
) -> std::result::Result<
   78         -
    ::aws_smithy_http_server::response::Response,
   79         -
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
          78  +
    ::aws_smithy_legacy_http_server::response::Response,
          79  +
    ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   80     80   
> {
   81     81   
    Ok({
   82     82   
        match error {
   83     83   
            crate::error::NullAndEmptyHeadersClientError::InternalServerError(output) => {
   84     84   
                let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
   85     85   
                #[allow(unused_mut)]
   86     86   
                let mut builder = ::http::Response::builder();
   87         -
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
          87  +
                builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
   88     88   
                    builder,
   89     89   
                    ::http::header::CONTENT_TYPE,
   90     90   
                    "application/json",
   91     91   
                );
   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::HeaderName::from_static("x-amzn-errortype"),
   95     95   
                    "InternalServerError",
   96     96   
                );
   97     97   
                let content_length = payload.len();
   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::CONTENT_LENGTH,
  101    101   
                    content_length,
  102    102   
                );
  103    103   
                builder
  104    104   
                    .status(500)
  105         -
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         105  +
                    .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
  106    106   
            }
  107    107   
        }
  108    108   
    })
  109    109   
}
  110    110   
  111    111   
pub fn ser_null_and_empty_headers_client_headers(
  112    112   
    input: &crate::output::NullAndEmptyHeadersClientOutput,
  113    113   
    mut builder: ::http::response::Builder,
  114    114   
) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
  115    115   
{
  116    116   
    if let ::std::option::Option::Some(inner_1) = &input.a {
  117    117   
        let formatted_2 = inner_1.as_str();
  118    118   
        if !formatted_2.is_empty() {
  119    119   
            let header_value = formatted_2;
  120    120   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  121    121   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  122    122   
                    "a",
  123    123   
                    format!(
  124    124   
                        "`{}` cannot be used as a header value: {}",
  125    125   
                        &header_value, err
  126    126   
                    ),
  127    127   
                )
  128    128   
            })?;
  129    129   
            builder = builder.header("X-A", header_value);
  130    130   
        }
  131    131   
    }
  132    132   
    if let ::std::option::Option::Some(inner_3) = &input.b {
  133    133   
        let formatted_4 = inner_3.as_str();
  134    134   
        if !formatted_4.is_empty() {
  135    135   
            let header_value = formatted_4;
  136    136   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  137    137   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  138    138   
                    "b",
  139    139   
                    format!(
  140    140   
                        "`{}` cannot be used as a header value: {}",
  141    141   
                        &header_value, err
  142    142   
                    ),
  143    143   
                )
  144    144   
            })?;
  145    145   
            builder = builder.header("X-B", header_value);
  146    146   
        }
  147    147   
    }
  148    148   
    if let ::std::option::Option::Some(inner_5) = &input.c {
  149    149   
        for inner_6 in inner_5 {
  150         -
            let formatted_7 = ::aws_smithy_http::header::quote_header_value(inner_6.as_str());
         150  +
            let formatted_7 =
         151  +
                ::aws_smithy_legacy_http::header::quote_header_value(inner_6.as_str());
  151    152   
            if !formatted_7.is_empty() {
  152    153   
                let header_value = formatted_7;
  153    154   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  154    155   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  155    156   
                        "c",
  156    157   
                        format!(
  157    158   
                            "`{}` cannot be used as a header value: {}",
  158    159   
                            &header_value, err
  159    160   
                        ),
  160    161   
                    )

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

@@ -1,1 +31,32 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2      2   
pub(crate) fn de_a_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-A");
    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_b_header(
   13     13   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   14     14   
) -> ::std::result::Result<
   15     15   
    ::std::option::Option<::std::string::String>,
   16         -
    ::aws_smithy_http::header::ParseError,
          16  +
    ::aws_smithy_legacy_http::header::ParseError,
   17     17   
> {
   18     18   
    let headers = header_map.get_all("X-B");
   19         -
    ::aws_smithy_http::header::one_or_none(headers)
          19  +
    ::aws_smithy_legacy_http::header::one_or_none(headers)
   20     20   
}
   21     21   
   22     22   
pub(crate) fn de_c_header(
   23     23   
    header_map: &::aws_smithy_runtime_api::http::Headers,
   24     24   
) -> ::std::result::Result<
   25     25   
    ::std::option::Option<::std::vec::Vec<::std::string::String>>,
   26         -
    ::aws_smithy_http::header::ParseError,
          26  +
    ::aws_smithy_legacy_http::header::ParseError,
   27     27   
> {
   28     28   
    let headers = header_map.get_all("X-C");
   29         -
    let var_1: Vec<::std::string::String> = ::aws_smithy_http::header::read_many_from_str(headers)?;
          29  +
    let var_1: Vec<::std::string::String> =
          30  +
        ::aws_smithy_legacy_http::header::read_many_from_str(headers)?;
   30     31   
    Ok(if !var_1.is_empty() { Some(var_1) } else { None })
   31     32   
}