Server Test

Server Test

rev. dfb5149b65b7bcc09edd15b8e071ad43b5ac5943 (ignoring whitespace)

Files changed:

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

@@ -1,1 +94,135 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_timestamp_header_date_time_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedTimestampHeaderDateTimeInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input =
   18     23   
            crate::input::malformed_timestamp_header_date_time_input::Builder::default();
          24  +
        /* RustType.kt:516 */
   19     25   
        #[allow(unused_variables)]
          26  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   20     27   
        let ::aws_smithy_runtime_api::http::RequestParts {
   21     28   
            uri, headers, body, ..
   22     29   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          30  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   23     31   
        if let Some(value) = crate::protocol_serde::shape_malformed_timestamp_header_date_time_input::de_timestamp_header(&headers)? {
   24     32   
                                input = input.set_timestamp(value)
   25     33   
                            }
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   26     35   
        input.build()?
          36  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   27     37   
    })
          38  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   28     39   
}
   29     40   
          41  +
/* RustType.kt:516 */
   30     42   
#[allow(clippy::unnecessary_wraps)]
          43  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   31     44   
pub fn ser_malformed_timestamp_header_date_time_http_response(
   32     45   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampHeaderDateTimeOutput,
   33     46   
) -> std::result::Result<
   34     47   
    ::aws_smithy_http_server::response::Response,
   35     48   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   36     49   
> {
          50  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   37     51   
    Ok({
          52  +
        /* RustType.kt:516 */
   38     53   
        #[allow(unused_mut)]
          54  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   39     55   
        let mut builder = ::http::Response::builder();
          56  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   40     57   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   41     58   
            builder,
   42     59   
            ::http::header::CONTENT_TYPE,
   43     60   
            "application/json",
   44     61   
        );
          62  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   45     63   
        let http_status: u16 = 200;
   46     64   
        builder = builder.status(http_status);
   47         -
        let payload = "";
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          66  +
        let payload =
          67  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          69  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   48     70   
        let content_length = payload.len();
   49     71   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   50     72   
            builder,
   51     73   
            ::http::header::CONTENT_LENGTH,
   52     74   
            content_length,
   53     75   
        );
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   54     77   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          78  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   55     79   
        builder.body(body)?
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   56     81   
    })
          82  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   57     83   
}
   58     84   
          85  +
/* RustType.kt:516 */
   59     86   
#[allow(clippy::unnecessary_wraps)]
          87  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   60     88   
pub fn ser_malformed_timestamp_header_date_time_http_error(
   61     89   
    error: &crate::error::MalformedTimestampHeaderDateTimeError,
   62     90   
) -> std::result::Result<
   63     91   
    ::aws_smithy_http_server::response::Response,
   64     92   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   65     93   
> {
          94  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   66     95   
    Ok({
          96  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   67     97   
        match error {
          98  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   68     99   
            crate::error::MalformedTimestampHeaderDateTimeError::ValidationException(output) => {
         100  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   69    101   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         102  +
                /* RustType.kt:516 */
   70    103   
                #[allow(unused_mut)]
         104  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   71    105   
                let mut builder = ::http::Response::builder();
         106  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   72    107   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   73    108   
                    builder,
   74    109   
                    ::http::header::CONTENT_TYPE,
   75    110   
                    "application/json",
   76    111   
                );
         112  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   77    113   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   78    114   
                    builder,
   79    115   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   80    116   
                    "ValidationException",
   81    117   
                );
         118  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   82    119   
                let content_length = payload.len();
   83    120   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   84    121   
                    builder,
   85    122   
                    ::http::header::CONTENT_LENGTH,
   86    123   
                    content_length,
   87    124   
                );
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   88    126   
                builder
   89    127   
                    .status(400)
   90    128   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         129  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         130  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   91    131   
        }
   92         -
        }
         132  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   93    133   
    })
         134  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   94    135   
}

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

@@ -1,1 +22,25 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:153 */
    2      3   
pub(crate) fn de_timestamp_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::aws_smithy_types::DateTime>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("timestamp");
    9         -
    let var_1: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(
   10         -
        headers,
   11         -
        ::aws_smithy_types::date_time::Format::DateTime,
   12         -
    )?;
          11  +
    /* HttpBindingGenerator.kt:394 */
          12  +
    let var_1: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::DateTime)?
          13  +
    /* HttpBindingGenerator.kt:402 */;
          14  +
    /* HttpBindingGenerator.kt:468 */
   13     15   
    if var_1.len() > 1 {
   14     16   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   15     17   
            "expected one item but found {}",
   16     18   
            var_1.len()
   17     19   
        )))
   18     20   
    } else {
   19     21   
        let mut var_1 = var_1;
   20     22   
        Ok(var_1.pop())
   21     23   
    }
          24  +
    /* HttpBindingGenerator.kt:153 */
   22     25   
}

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

@@ -1,1 +93,134 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_timestamp_header_default_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedTimestampHeaderDefaultInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_timestamp_header_default_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   22     30   
        if let Some(value) = crate::protocol_serde::shape_malformed_timestamp_header_default_input::de_timestamp_header(&headers)? {
   23     31   
                                input = input.set_timestamp(value)
   24     32   
                            }
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   25     34   
        input.build()?
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   26     36   
    })
          37  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   27     38   
}
   28     39   
          40  +
/* RustType.kt:516 */
   29     41   
#[allow(clippy::unnecessary_wraps)]
          42  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   30     43   
pub fn ser_malformed_timestamp_header_default_http_response(
   31     44   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampHeaderDefaultOutput,
   32     45   
) -> std::result::Result<
   33     46   
    ::aws_smithy_http_server::response::Response,
   34     47   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   35     48   
> {
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   36     50   
    Ok({
          51  +
        /* RustType.kt:516 */
   37     52   
        #[allow(unused_mut)]
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   38     54   
        let mut builder = ::http::Response::builder();
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   39     56   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   40     57   
            builder,
   41     58   
            ::http::header::CONTENT_TYPE,
   42     59   
            "application/json",
   43     60   
        );
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   44     62   
        let http_status: u16 = 200;
   45     63   
        builder = builder.status(http_status);
   46         -
        let payload = "";
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          65  +
        let payload =
          66  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   47     69   
        let content_length = payload.len();
   48     70   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     71   
            builder,
   50     72   
            ::http::header::CONTENT_LENGTH,
   51     73   
            content_length,
   52     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   53     76   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   54     78   
        builder.body(body)?
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   55     80   
    })
          81  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   56     82   
}
   57     83   
          84  +
/* RustType.kt:516 */
   58     85   
#[allow(clippy::unnecessary_wraps)]
          86  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   59     87   
pub fn ser_malformed_timestamp_header_default_http_error(
   60     88   
    error: &crate::error::MalformedTimestampHeaderDefaultError,
   61     89   
) -> std::result::Result<
   62     90   
    ::aws_smithy_http_server::response::Response,
   63     91   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   64     92   
> {
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   65     94   
    Ok({
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   66     96   
        match error {
          97  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   67     98   
            crate::error::MalformedTimestampHeaderDefaultError::ValidationException(output) => {
          99  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   68    100   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         101  +
                /* RustType.kt:516 */
   69    102   
                #[allow(unused_mut)]
         103  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   70    104   
                let mut builder = ::http::Response::builder();
         105  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   71    106   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   72    107   
                    builder,
   73    108   
                    ::http::header::CONTENT_TYPE,
   74    109   
                    "application/json",
   75    110   
                );
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   76    112   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   77    113   
                    builder,
   78    114   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   79    115   
                    "ValidationException",
   80    116   
                );
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   81    118   
                let content_length = payload.len();
   82    119   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   83    120   
                    builder,
   84    121   
                    ::http::header::CONTENT_LENGTH,
   85    122   
                    content_length,
   86    123   
                );
         124  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   87    125   
                builder
   88    126   
                    .status(400)
   89    127   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         129  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   90    130   
        }
   91         -
        }
         131  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   92    132   
    })
         133  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   93    134   
}

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

@@ -1,1 +22,25 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:153 */
    2      3   
pub(crate) fn de_timestamp_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::aws_smithy_types::DateTime>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("timestamp");
    9         -
    let var_1: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(
   10         -
        headers,
   11         -
        ::aws_smithy_types::date_time::Format::HttpDate,
   12         -
    )?;
          11  +
    /* HttpBindingGenerator.kt:394 */
          12  +
    let var_1: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::HttpDate)?
          13  +
    /* HttpBindingGenerator.kt:402 */;
          14  +
    /* HttpBindingGenerator.kt:468 */
   13     15   
    if var_1.len() > 1 {
   14     16   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   15     17   
            "expected one item but found {}",
   16     18   
            var_1.len()
   17     19   
        )))
   18     20   
    } else {
   19     21   
        let mut var_1 = var_1;
   20     22   
        Ok(var_1.pop())
   21     23   
    }
          24  +
    /* HttpBindingGenerator.kt:153 */
   22     25   
}

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

@@ -1,1 +93,134 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_timestamp_header_epoch_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedTimestampHeaderEpochInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_timestamp_header_epoch_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:794 */
   22     30   
        if let Some(value) = crate::protocol_serde::shape_malformed_timestamp_header_epoch_input::de_timestamp_header(&headers)? {
   23     31   
                                input = input.set_timestamp(value)
   24     32   
                            }
          33  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   25     34   
        input.build()?
          35  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   26     36   
    })
          37  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   27     38   
}
   28     39   
          40  +
/* RustType.kt:516 */
   29     41   
#[allow(clippy::unnecessary_wraps)]
          42  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   30     43   
pub fn ser_malformed_timestamp_header_epoch_http_response(
   31     44   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampHeaderEpochOutput,
   32     45   
) -> std::result::Result<
   33     46   
    ::aws_smithy_http_server::response::Response,
   34     47   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   35     48   
> {
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   36     50   
    Ok({
          51  +
        /* RustType.kt:516 */
   37     52   
        #[allow(unused_mut)]
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   38     54   
        let mut builder = ::http::Response::builder();
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   39     56   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   40     57   
            builder,
   41     58   
            ::http::header::CONTENT_TYPE,
   42     59   
            "application/json",
   43     60   
        );
          61  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   44     62   
        let http_status: u16 = 200;
   45     63   
        builder = builder.status(http_status);
   46         -
        let payload = "";
          64  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          65  +
        let payload =
          66  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          68  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   47     69   
        let content_length = payload.len();
   48     70   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   49     71   
            builder,
   50     72   
            ::http::header::CONTENT_LENGTH,
   51     73   
            content_length,
   52     74   
        );
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   53     76   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   54     78   
        builder.body(body)?
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   55     80   
    })
          81  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   56     82   
}
   57     83   
          84  +
/* RustType.kt:516 */
   58     85   
#[allow(clippy::unnecessary_wraps)]
          86  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   59     87   
pub fn ser_malformed_timestamp_header_epoch_http_error(
   60     88   
    error: &crate::error::MalformedTimestampHeaderEpochError,
   61     89   
) -> std::result::Result<
   62     90   
    ::aws_smithy_http_server::response::Response,
   63     91   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   64     92   
> {
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   65     94   
    Ok({
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   66     96   
        match error {
          97  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   67     98   
            crate::error::MalformedTimestampHeaderEpochError::ValidationException(output) => {
          99  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   68    100   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         101  +
                /* RustType.kt:516 */
   69    102   
                #[allow(unused_mut)]
         103  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   70    104   
                let mut builder = ::http::Response::builder();
         105  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   71    106   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   72    107   
                    builder,
   73    108   
                    ::http::header::CONTENT_TYPE,
   74    109   
                    "application/json",
   75    110   
                );
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   76    112   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   77    113   
                    builder,
   78    114   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   79    115   
                    "ValidationException",
   80    116   
                );
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   81    118   
                let content_length = payload.len();
   82    119   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   83    120   
                    builder,
   84    121   
                    ::http::header::CONTENT_LENGTH,
   85    122   
                    content_length,
   86    123   
                );
         124  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   87    125   
                builder
   88    126   
                    .status(400)
   89    127   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         128  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         129  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   90    130   
        }
   91         -
        }
         131  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
   92    132   
    })
         133  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
   93    134   
}

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

@@ -1,1 +22,25 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* HttpBindingGenerator.kt:153 */
    2      3   
pub(crate) fn de_timestamp_header(
    3      4   
    header_map: &::aws_smithy_runtime_api::http::Headers,
    4      5   
) -> ::std::result::Result<
    5      6   
    ::std::option::Option<::aws_smithy_types::DateTime>,
    6      7   
    ::aws_smithy_http::header::ParseError,
    7      8   
> {
           9  +
    /* HttpBindingGenerator.kt:160 */
    8     10   
    let headers = header_map.get_all("timestamp");
    9         -
    let var_1: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(
   10         -
        headers,
   11         -
        ::aws_smithy_types::date_time::Format::EpochSeconds,
   12         -
    )?;
          11  +
    /* HttpBindingGenerator.kt:394 */
          12  +
    let var_1: Vec<::aws_smithy_types::DateTime> = ::aws_smithy_http::header::many_dates(headers, ::aws_smithy_types::date_time::Format::EpochSeconds)?
          13  +
    /* HttpBindingGenerator.kt:402 */;
          14  +
    /* HttpBindingGenerator.kt:468 */
   13     15   
    if var_1.len() > 1 {
   14     16   
        Err(::aws_smithy_http::header::ParseError::new(format!(
   15     17   
            "expected one item but found {}",
   16     18   
            var_1.len()
   17     19   
        )))
   18     20   
    } else {
   19     21   
        let mut var_1 = var_1;
   20     22   
        Ok(var_1.pop())
   21     23   
    }
          24  +
    /* HttpBindingGenerator.kt:153 */
   22     25   
}

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

@@ -1,1 +111,154 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_timestamp_path_default_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedTimestampPathDefaultInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_timestamp_path_default_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:986 */
   22     30   
        let input_string = uri.path();
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:998 */
   23     32   
        let (input_string, (_, m1)) =
   24     33   
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
   25     34   
                ::nom::sequence::preceded(
   26     35   
                    ::nom::bytes::complete::tag("/"),
   27     36   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
   28     37   
                        "MalformedTimestampPathDefault",
   29     38   
                    ),
   30     39   
                ),
   31     40   
                ::nom::sequence::preceded(
   32     41   
                    ::nom::bytes::complete::tag("/"),
   33     42   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   34     43   
                        ::nom::bytes::complete::take_until("/"),
   35     44   
                        ::nom::combinator::rest,
   36     45   
                    )),
   37     46   
                ),
   38     47   
            ))(input_string)?;
   39     48   
        debug_assert_eq!("", input_string);
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   40     50   
        input = input.set_timestamp(
   41     51   
            crate::protocol_serde::shape_malformed_timestamp_path_default_input::de_timestamp(m1)?,
   42     52   
        );
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   43     54   
        input.build()?
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   44     56   
    })
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   45     58   
}
   46     59   
          60  +
/* RustType.kt:516 */
   47     61   
#[allow(clippy::unnecessary_wraps)]
          62  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   48     63   
pub fn ser_malformed_timestamp_path_default_http_response(
   49     64   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampPathDefaultOutput,
   50     65   
) -> std::result::Result<
   51     66   
    ::aws_smithy_http_server::response::Response,
   52     67   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   53     68   
> {
          69  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   54     70   
    Ok({
          71  +
        /* RustType.kt:516 */
   55     72   
        #[allow(unused_mut)]
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   56     74   
        let mut builder = ::http::Response::builder();
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   57     76   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   58     77   
            builder,
   59     78   
            ::http::header::CONTENT_TYPE,
   60     79   
            "application/json",
   61     80   
        );
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   62     82   
        let http_status: u16 = 200;
   63     83   
        builder = builder.status(http_status);
   64         -
        let payload = "";
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          85  +
        let payload =
          86  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   65     89   
        let content_length = payload.len();
   66     90   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   67     91   
            builder,
   68     92   
            ::http::header::CONTENT_LENGTH,
   69     93   
            content_length,
   70     94   
        );
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   71     96   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   72     98   
        builder.body(body)?
          99  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   73    100   
    })
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   74    102   
}
   75    103   
         104  +
/* RustType.kt:516 */
   76    105   
#[allow(clippy::unnecessary_wraps)]
         106  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   77    107   
pub fn ser_malformed_timestamp_path_default_http_error(
   78    108   
    error: &crate::error::MalformedTimestampPathDefaultError,
   79    109   
) -> std::result::Result<
   80    110   
    ::aws_smithy_http_server::response::Response,
   81    111   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   82    112   
> {
         113  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   83    114   
    Ok({
         115  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   84    116   
        match error {
         117  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   85    118   
            crate::error::MalformedTimestampPathDefaultError::ValidationException(output) => {
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   86    120   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         121  +
                /* RustType.kt:516 */
   87    122   
                #[allow(unused_mut)]
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   88    124   
                let mut builder = ::http::Response::builder();
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   89    126   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   90    127   
                    builder,
   91    128   
                    ::http::header::CONTENT_TYPE,
   92    129   
                    "application/json",
   93    130   
                );
         131  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   94    132   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   95    133   
                    builder,
   96    134   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   97    135   
                    "ValidationException",
   98    136   
                );
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   99    138   
                let content_length = payload.len();
  100    139   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  101    140   
                    builder,
  102    141   
                    ::http::header::CONTENT_LENGTH,
  103    142   
                    content_length,
  104    143   
                );
         144  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  105    145   
                builder
  106    146   
                    .status(400)
  107    147   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         148  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         149  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  108    150   
        }
  109         -
        }
         151  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  110    152   
    })
         153  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  111    154   
}

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

@@ -1,1 +14,16 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_timestamp(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_types::DateTime,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1323 */
    8     10   
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
    9         -
    let value = ::aws_smithy_types::DateTime::from_str(
   10         -
        value.as_ref(),
   11         -
        ::aws_smithy_types::date_time::Format::DateTime,
   12         -
    )?;
          11  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::DateTime)?
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   13     14   
    Ok(value)
          15  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   14     16   
}

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

@@ -1,1 +111,154 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_timestamp_path_epoch_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedTimestampPathEpochInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_timestamp_path_epoch_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:986 */
   22     30   
        let input_string = uri.path();
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:998 */
   23     32   
        let (input_string, (_, m1)) =
   24     33   
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
   25     34   
                ::nom::sequence::preceded(
   26     35   
                    ::nom::bytes::complete::tag("/"),
   27     36   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
   28     37   
                        "MalformedTimestampPathEpoch",
   29     38   
                    ),
   30     39   
                ),
   31     40   
                ::nom::sequence::preceded(
   32     41   
                    ::nom::bytes::complete::tag("/"),
   33     42   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   34     43   
                        ::nom::bytes::complete::take_until("/"),
   35     44   
                        ::nom::combinator::rest,
   36     45   
                    )),
   37     46   
                ),
   38     47   
            ))(input_string)?;
   39     48   
        debug_assert_eq!("", input_string);
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   40     50   
        input = input.set_timestamp(
   41     51   
            crate::protocol_serde::shape_malformed_timestamp_path_epoch_input::de_timestamp(m1)?,
   42     52   
        );
          53  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   43     54   
        input.build()?
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   44     56   
    })
          57  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   45     58   
}
   46     59   
          60  +
/* RustType.kt:516 */
   47     61   
#[allow(clippy::unnecessary_wraps)]
          62  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   48     63   
pub fn ser_malformed_timestamp_path_epoch_http_response(
   49     64   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampPathEpochOutput,
   50     65   
) -> std::result::Result<
   51     66   
    ::aws_smithy_http_server::response::Response,
   52     67   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   53     68   
> {
          69  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   54     70   
    Ok({
          71  +
        /* RustType.kt:516 */
   55     72   
        #[allow(unused_mut)]
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   56     74   
        let mut builder = ::http::Response::builder();
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   57     76   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   58     77   
            builder,
   59     78   
            ::http::header::CONTENT_TYPE,
   60     79   
            "application/json",
   61     80   
        );
          81  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   62     82   
        let http_status: u16 = 200;
   63     83   
        builder = builder.status(http_status);
   64         -
        let payload = "";
          84  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          85  +
        let payload =
          86  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          88  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   65     89   
        let content_length = payload.len();
   66     90   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   67     91   
            builder,
   68     92   
            ::http::header::CONTENT_LENGTH,
   69     93   
            content_length,
   70     94   
        );
          95  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   71     96   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   72     98   
        builder.body(body)?
          99  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   73    100   
    })
         101  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   74    102   
}
   75    103   
         104  +
/* RustType.kt:516 */
   76    105   
#[allow(clippy::unnecessary_wraps)]
         106  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   77    107   
pub fn ser_malformed_timestamp_path_epoch_http_error(
   78    108   
    error: &crate::error::MalformedTimestampPathEpochError,
   79    109   
) -> std::result::Result<
   80    110   
    ::aws_smithy_http_server::response::Response,
   81    111   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   82    112   
> {
         113  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   83    114   
    Ok({
         115  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   84    116   
        match error {
         117  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   85    118   
            crate::error::MalformedTimestampPathEpochError::ValidationException(output) => {
         119  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   86    120   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         121  +
                /* RustType.kt:516 */
   87    122   
                #[allow(unused_mut)]
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   88    124   
                let mut builder = ::http::Response::builder();
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   89    126   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   90    127   
                    builder,
   91    128   
                    ::http::header::CONTENT_TYPE,
   92    129   
                    "application/json",
   93    130   
                );
         131  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   94    132   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   95    133   
                    builder,
   96    134   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   97    135   
                    "ValidationException",
   98    136   
                );
         137  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   99    138   
                let content_length = payload.len();
  100    139   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  101    140   
                    builder,
  102    141   
                    ::http::header::CONTENT_LENGTH,
  103    142   
                    content_length,
  104    143   
                );
         144  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  105    145   
                builder
  106    146   
                    .status(400)
  107    147   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         148  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         149  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  108    150   
        }
  109         -
        }
         151  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  110    152   
    })
         153  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  111    154   
}

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

@@ -1,1 +14,16 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_timestamp(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_types::DateTime,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1323 */
    8     10   
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
    9         -
    let value = ::aws_smithy_types::DateTime::from_str(
   10         -
        value.as_ref(),
   11         -
        ::aws_smithy_types::date_time::Format::EpochSeconds,
   12         -
    )?;
          11  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::EpochSeconds)?
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   13     14   
    Ok(value)
          15  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   14     16   
}

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

@@ -1,1 +113,156 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_timestamp_path_http_date_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedTimestampPathHttpDateInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_timestamp_path_http_date_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:986 */
   22     30   
        let input_string = uri.path();
          31  +
        /* ServerHttpBoundProtocolGenerator.kt:998 */
   23     32   
        let (input_string, (_, m1)) =
   24     33   
            ::nom::sequence::tuple::<_, _, ::nom::error::Error<&str>, _>((
   25     34   
                ::nom::sequence::preceded(
   26     35   
                    ::nom::bytes::complete::tag("/"),
   27     36   
                    ::nom::bytes::complete::tag::<_, _, ::nom::error::Error<&str>>(
   28     37   
                        "MalformedTimestampPathHttpDate",
   29     38   
                    ),
   30     39   
                ),
   31     40   
                ::nom::sequence::preceded(
   32     41   
                    ::nom::bytes::complete::tag("/"),
   33     42   
                    ::nom::branch::alt::<_, _, ::nom::error::Error<&str>, _>((
   34     43   
                        ::nom::bytes::complete::take_until("/"),
   35     44   
                        ::nom::combinator::rest,
   36     45   
                    )),
   37     46   
                ),
   38     47   
            ))(input_string)?;
   39     48   
        debug_assert_eq!("", input_string);
          49  +
        /* ServerHttpBoundProtocolGenerator.kt:1009 */
   40     50   
        input = input.set_timestamp(
   41     51   
            crate::protocol_serde::shape_malformed_timestamp_path_http_date_input::de_timestamp(
   42     52   
                m1,
   43     53   
            )?,
   44     54   
        );
          55  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   45     56   
        input.build()?
          57  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   46     58   
    })
          59  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   47     60   
}
   48     61   
          62  +
/* RustType.kt:516 */
   49     63   
#[allow(clippy::unnecessary_wraps)]
          64  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   50     65   
pub fn ser_malformed_timestamp_path_http_date_http_response(
   51     66   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampPathHttpDateOutput,
   52     67   
) -> std::result::Result<
   53     68   
    ::aws_smithy_http_server::response::Response,
   54     69   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   55     70   
> {
          71  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   56     72   
    Ok({
          73  +
        /* RustType.kt:516 */
   57     74   
        #[allow(unused_mut)]
          75  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   58     76   
        let mut builder = ::http::Response::builder();
          77  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   59     78   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   60     79   
            builder,
   61     80   
            ::http::header::CONTENT_TYPE,
   62     81   
            "application/json",
   63     82   
        );
          83  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   64     84   
        let http_status: u16 = 200;
   65     85   
        builder = builder.status(http_status);
   66         -
        let payload = "";
          86  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          87  +
        let payload =
          88  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          90  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   67     91   
        let content_length = payload.len();
   68     92   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   69     93   
            builder,
   70     94   
            ::http::header::CONTENT_LENGTH,
   71     95   
            content_length,
   72     96   
        );
          97  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   73     98   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          99  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   74    100   
        builder.body(body)?
         101  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   75    102   
    })
         103  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   76    104   
}
   77    105   
         106  +
/* RustType.kt:516 */
   78    107   
#[allow(clippy::unnecessary_wraps)]
         108  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   79    109   
pub fn ser_malformed_timestamp_path_http_date_http_error(
   80    110   
    error: &crate::error::MalformedTimestampPathHttpDateError,
   81    111   
) -> std::result::Result<
   82    112   
    ::aws_smithy_http_server::response::Response,
   83    113   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   84    114   
> {
         115  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   85    116   
    Ok({
         117  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   86    118   
        match error {
         119  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   87    120   
            crate::error::MalformedTimestampPathHttpDateError::ValidationException(output) => {
         121  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   88    122   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         123  +
                /* RustType.kt:516 */
   89    124   
                #[allow(unused_mut)]
         125  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   90    126   
                let mut builder = ::http::Response::builder();
         127  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   91    128   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   92    129   
                    builder,
   93    130   
                    ::http::header::CONTENT_TYPE,
   94    131   
                    "application/json",
   95    132   
                );
         133  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   96    134   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   97    135   
                    builder,
   98    136   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   99    137   
                    "ValidationException",
  100    138   
                );
         139  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
  101    140   
                let content_length = payload.len();
  102    141   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
  103    142   
                    builder,
  104    143   
                    ::http::header::CONTENT_LENGTH,
  105    144   
                    content_length,
  106    145   
                );
         146  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
  107    147   
                builder
  108    148   
                    .status(400)
  109    149   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         150  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         151  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
  110    152   
        }
  111         -
        }
         153  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  112    154   
    })
         155  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  113    156   
}

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

@@ -1,1 +14,16 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_timestamp(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_types::DateTime,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1323 */
    8     10   
    let value = ::percent_encoding::percent_decode_str(value).decode_utf8()?;
    9         -
    let value = ::aws_smithy_types::DateTime::from_str(
   10         -
        value.as_ref(),
   11         -
        ::aws_smithy_types::date_time::Format::HttpDate,
   12         -
    )?;
          11  +
    let value = ::aws_smithy_types::DateTime::from_str(value.as_ref(), ::aws_smithy_types::date_time::Format::HttpDate)?
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
          13  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   13     14   
    Ok(value)
          15  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   14     16   
}

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

@@ -1,1 +101,146 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_timestamp_query_default_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedTimestampQueryDefaultInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_timestamp_query_default_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   24     33   
        let mut timestamp_seen = false;
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   25     35   
        for (k, v) in pairs {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   26     37   
            if !timestamp_seen && k == "timestamp" {
   27     38   
                input = input.set_timestamp(
   28     39   
                    crate::protocol_serde::shape_malformed_timestamp_query_default_input::de_timestamp(&v)?
   29     40   
                );
   30     41   
                timestamp_seen = true;
   31     42   
            }
          43  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   32     44   
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   33     46   
        input.build()?
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   34     48   
    })
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   35     50   
}
   36     51   
          52  +
/* RustType.kt:516 */
   37     53   
#[allow(clippy::unnecessary_wraps)]
          54  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   38     55   
pub fn ser_malformed_timestamp_query_default_http_response(
   39     56   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampQueryDefaultOutput,
   40     57   
) -> std::result::Result<
   41     58   
    ::aws_smithy_http_server::response::Response,
   42     59   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     60   
> {
          61  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   44     62   
    Ok({
          63  +
        /* RustType.kt:516 */
   45     64   
        #[allow(unused_mut)]
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   46     66   
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   47     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     69   
            builder,
   49     70   
            ::http::header::CONTENT_TYPE,
   50     71   
            "application/json",
   51     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   52     74   
        let http_status: u16 = 200;
   53     75   
        builder = builder.status(http_status);
   54         -
        let payload = "";
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          77  +
        let payload =
          78  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   55     81   
        let content_length = payload.len();
   56     82   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     83   
            builder,
   58     84   
            ::http::header::CONTENT_LENGTH,
   59     85   
            content_length,
   60     86   
        );
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   61     88   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   62     90   
        builder.body(body)?
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   63     92   
    })
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   64     94   
}
   65     95   
          96  +
/* RustType.kt:516 */
   66     97   
#[allow(clippy::unnecessary_wraps)]
          98  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   67     99   
pub fn ser_malformed_timestamp_query_default_http_error(
   68    100   
    error: &crate::error::MalformedTimestampQueryDefaultError,
   69    101   
) -> std::result::Result<
   70    102   
    ::aws_smithy_http_server::response::Response,
   71    103   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    104   
> {
         105  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   73    106   
    Ok({
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   74    108   
        match error {
         109  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   75    110   
            crate::error::MalformedTimestampQueryDefaultError::ValidationException(output) => {
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   76    112   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         113  +
                /* RustType.kt:516 */
   77    114   
                #[allow(unused_mut)]
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   78    116   
                let mut builder = ::http::Response::builder();
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   79    118   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    119   
                    builder,
   81    120   
                    ::http::header::CONTENT_TYPE,
   82    121   
                    "application/json",
   83    122   
                );
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   84    124   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    125   
                    builder,
   86    126   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   87    127   
                    "ValidationException",
   88    128   
                );
         129  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   89    130   
                let content_length = payload.len();
   90    131   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    132   
                    builder,
   92    133   
                    ::http::header::CONTENT_LENGTH,
   93    134   
                    content_length,
   94    135   
                );
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   95    137   
                builder
   96    138   
                    .status(400)
   97    139   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         141  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   98    142   
        }
   99         -
        }
         143  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  100    144   
    })
         145  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  101    146   
}

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

@@ -1,1 +13,15 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_timestamp(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_types::DateTime,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
    8         -
    let value = ::aws_smithy_types::DateTime::from_str(
    9         -
        value,
   10         -
        ::aws_smithy_types::date_time::Format::DateTime,
   11         -
    )?;
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1332 */
          10  +
    let value = ::aws_smithy_types::DateTime::from_str(value, ::aws_smithy_types::date_time::Format::DateTime)?
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   12     13   
    Ok(value)
          14  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   13     15   
}

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

@@ -1,1 +101,146 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* RustType.kt:516 */
    2      3   
#[allow(clippy::unnecessary_wraps)]
           4  +
/* ServerHttpBoundProtocolGenerator.kt:383 */
    3      5   
pub async fn de_malformed_timestamp_query_epoch_http_request<B>(
    4      6   
    #[allow(unused_variables)] request: ::http::Request<B>,
    5      7   
) -> std::result::Result<
    6      8   
    crate::input::MalformedTimestampQueryEpochInput,
    7      9   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    8     10   
>
    9     11   
where
   10     12   
    B: ::aws_smithy_http_server::body::HttpBody + Send,
   11     13   
    B::Data: Send,
   12     14   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
   13     15   
        From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
   14     16   
{
          17  +
    /* ServerHttpBoundProtocolGenerator.kt:399 */
   15     18   
    Ok({
          19  +
        /* RustType.kt:516 */
   16     20   
        #[allow(unused_mut)]
          21  +
        /* ServerHttpBoundProtocolGenerator.kt:723 */
   17     22   
        let mut input = crate::input::malformed_timestamp_query_epoch_input::Builder::default();
          23  +
        /* RustType.kt:516 */
   18     24   
        #[allow(unused_variables)]
          25  +
        /* ServerHttpBoundProtocolGenerator.kt:728 */
   19     26   
        let ::aws_smithy_runtime_api::http::RequestParts {
   20     27   
            uri, headers, body, ..
   21     28   
        } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
          29  +
        /* ServerHttpBoundProtocolGenerator.kt:1073 */
   22     30   
        let query_string = uri.query().unwrap_or("");
   23     31   
        let pairs = ::form_urlencoded::parse(query_string.as_bytes());
          32  +
        /* ServerHttpBoundProtocolGenerator.kt:1099 */
   24     33   
        let mut timestamp_seen = false;
          34  +
        /* ServerHttpBoundProtocolGenerator.kt:1105 */
   25     35   
        for (k, v) in pairs {
          36  +
            /* ServerHttpBoundProtocolGenerator.kt:1109 */
   26     37   
            if !timestamp_seen && k == "timestamp" {
   27     38   
                input = input.set_timestamp(
   28     39   
                    crate::protocol_serde::shape_malformed_timestamp_query_epoch_input::de_timestamp(&v)?
   29     40   
                );
   30     41   
                timestamp_seen = true;
   31     42   
            }
          43  +
            /* ServerHttpBoundProtocolGenerator.kt:1105 */
   32     44   
        }
          45  +
        /* ServerHttpBoundProtocolGenerator.kt:834 */
   33     46   
        input.build()?
          47  +
        /* ServerHttpBoundProtocolGenerator.kt:399 */
   34     48   
    })
          49  +
    /* ServerHttpBoundProtocolGenerator.kt:383 */
   35     50   
}
   36     51   
          52  +
/* RustType.kt:516 */
   37     53   
#[allow(clippy::unnecessary_wraps)]
          54  +
/* ServerHttpBoundProtocolGenerator.kt:421 */
   38     55   
pub fn ser_malformed_timestamp_query_epoch_http_response(
   39     56   
    #[allow(unused_variables)] output: crate::output::MalformedTimestampQueryEpochOutput,
   40     57   
) -> std::result::Result<
   41     58   
    ::aws_smithy_http_server::response::Response,
   42     59   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   43     60   
> {
          61  +
    /* ServerHttpBoundProtocolGenerator.kt:433 */
   44     62   
    Ok({
          63  +
        /* RustType.kt:516 */
   45     64   
        #[allow(unused_mut)]
          65  +
        /* ServerHttpBoundProtocolGenerator.kt:523 */
   46     66   
        let mut builder = ::http::Response::builder();
          67  +
        /* ServerHttpBoundProtocolGenerator.kt:597 */
   47     68   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   48     69   
            builder,
   49     70   
            ::http::header::CONTENT_TYPE,
   50     71   
            "application/json",
   51     72   
        );
          73  +
        /* ServerHttpBoundProtocolGenerator.kt:682 */
   52     74   
        let http_status: u16 = 200;
   53     75   
        builder = builder.status(http_status);
   54         -
        let payload = "";
          76  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */
          77  +
        let payload =
          78  +
            /* HttpBoundProtocolPayloadGenerator.kt:235 */""
          79  +
        /* ServerHttpBoundProtocolGenerator.kt:561 */;
          80  +
        /* ServerHttpBoundProtocolGenerator.kt:663 */
   55     81   
        let content_length = payload.len();
   56     82   
        builder = ::aws_smithy_http::header::set_response_header_if_absent(
   57     83   
            builder,
   58     84   
            ::http::header::CONTENT_LENGTH,
   59     85   
            content_length,
   60     86   
        );
          87  +
        /* ServerHttpBoundProtocolGenerator.kt:567 */
   61     88   
        let body = ::aws_smithy_http_server::body::to_boxed(payload);
          89  +
        /* ServerHttpBoundProtocolGenerator.kt:575 */
   62     90   
        builder.body(body)?
          91  +
        /* ServerHttpBoundProtocolGenerator.kt:433 */
   63     92   
    })
          93  +
    /* ServerHttpBoundProtocolGenerator.kt:421 */
   64     94   
}
   65     95   
          96  +
/* RustType.kt:516 */
   66     97   
#[allow(clippy::unnecessary_wraps)]
          98  +
/* ServerHttpBoundProtocolGenerator.kt:447 */
   67     99   
pub fn ser_malformed_timestamp_query_epoch_http_error(
   68    100   
    error: &crate::error::MalformedTimestampQueryEpochError,
   69    101   
) -> std::result::Result<
   70    102   
    ::aws_smithy_http_server::response::Response,
   71    103   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
   72    104   
> {
         105  +
    /* ServerHttpBoundProtocolGenerator.kt:452 */
   73    106   
    Ok({
         107  +
        /* ServerHttpBoundProtocolGenerator.kt:468 */
   74    108   
        match error {
         109  +
            /* ServerHttpBoundProtocolGenerator.kt:476 */
   75    110   
            crate::error::MalformedTimestampQueryEpochError::ValidationException(output) => {
         111  +
                /* ServerHttpBoundProtocolGenerator.kt:477 */
   76    112   
                let payload = crate::protocol_serde::shape_validation_exception::ser_validation_exception_error(output)?;
         113  +
                /* RustType.kt:516 */
   77    114   
                #[allow(unused_mut)]
         115  +
                /* ServerHttpBoundProtocolGenerator.kt:487 */
   78    116   
                let mut builder = ::http::Response::builder();
         117  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   79    118   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   80    119   
                    builder,
   81    120   
                    ::http::header::CONTENT_TYPE,
   82    121   
                    "application/json",
   83    122   
                );
         123  +
                /* ServerHttpBoundProtocolGenerator.kt:597 */
   84    124   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   85    125   
                    builder,
   86    126   
                    ::http::header::HeaderName::from_static("x-amzn-errortype"),
   87    127   
                    "ValidationException",
   88    128   
                );
         129  +
                /* ServerHttpBoundProtocolGenerator.kt:663 */
   89    130   
                let content_length = payload.len();
   90    131   
                builder = ::aws_smithy_http::header::set_response_header_if_absent(
   91    132   
                    builder,
   92    133   
                    ::http::header::CONTENT_LENGTH,
   93    134   
                    content_length,
   94    135   
                );
         136  +
                /* ServerHttpBoundProtocolGenerator.kt:504 */
   95    137   
                builder
   96    138   
                    .status(400)
   97    139   
                    .body(::aws_smithy_http_server::body::to_boxed(payload))?
         140  +
                /* ServerHttpBoundProtocolGenerator.kt:476 */
         141  +
            } /* ServerHttpBoundProtocolGenerator.kt:468 */
   98    142   
        }
   99         -
        }
         143  +
        /* ServerHttpBoundProtocolGenerator.kt:452 */
  100    144   
    })
         145  +
    /* ServerHttpBoundProtocolGenerator.kt:447 */
  101    146   
}

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

@@ -1,1 +13,15 @@
    1      1   
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
           2  +
/* ServerHttpBoundProtocolGenerator.kt:1292 */
    2      3   
pub fn de_timestamp(
    3      4   
    value: &str,
    4      5   
) -> std::result::Result<
    5      6   
    ::aws_smithy_types::DateTime,
    6      7   
    ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
    7      8   
> {
    8         -
    let value = ::aws_smithy_types::DateTime::from_str(
    9         -
        value,
   10         -
        ::aws_smithy_types::date_time::Format::EpochSeconds,
   11         -
    )?;
           9  +
    /* ServerHttpBoundProtocolGenerator.kt:1332 */
          10  +
    let value = ::aws_smithy_types::DateTime::from_str(value, ::aws_smithy_types::date_time::Format::EpochSeconds)?
          11  +
    /* ServerHttpBoundProtocolGenerator.kt:1343 */;
          12  +
    /* ServerHttpBoundProtocolGenerator.kt:1357 */
   12     13   
    Ok(value)
          14  +
    /* ServerHttpBoundProtocolGenerator.kt:1292 */
   13     15   
}