Client Test

Client Test

rev. a7fb2e3446d314cfbe48069306e4e0a389b39aeb (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/ebs/rust-client-codegen/src/protocol_serde/shape_complete_snapshot.rs

@@ -110,110 +211,219 @@
  130    130   
    })
  131    131   
}
  132    132   
  133    133   
pub fn ser_complete_snapshot_headers(
  134    134   
    input: &crate::operation::complete_snapshot::CompleteSnapshotInput,
  135    135   
    mut builder: ::http::request::Builder,
  136    136   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  137    137   
    if let ::std::option::Option::Some(inner_1) = &input.changed_blocks_count {
  138    138   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_1);
  139    139   
        let formatted_2 = encoder.encode();
         140  +
        if !formatted_2.is_empty() {
  140    141   
            let header_value = formatted_2;
  141    142   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  142    143   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  143    144   
                    "changed_blocks_count",
  144    145   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  145    146   
                )
  146    147   
            })?;
  147    148   
            builder = builder.header("x-amz-ChangedBlocksCount", header_value);
  148    149   
        }
         150  +
    }
  149    151   
    if let ::std::option::Option::Some(inner_3) = &input.checksum_aggregation_method {
  150    152   
        let formatted_4 = inner_3.as_str();
         153  +
        if !formatted_4.is_empty() {
  151    154   
            let header_value = formatted_4;
  152    155   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  153    156   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  154    157   
                    "checksum_aggregation_method",
  155    158   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  156    159   
                )
  157    160   
            })?;
  158    161   
            builder = builder.header("x-amz-Checksum-Aggregation-Method", header_value);
  159    162   
        }
         163  +
    }
  160    164   
    if let ::std::option::Option::Some(inner_5) = &input.checksum_algorithm {
  161    165   
        let formatted_6 = inner_5.as_str();
         166  +
        if !formatted_6.is_empty() {
  162    167   
            let header_value = formatted_6;
  163    168   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  164    169   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  165    170   
                    "checksum_algorithm",
  166    171   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  167    172   
                )
  168    173   
            })?;
  169    174   
            builder = builder.header("x-amz-Checksum-Algorithm", header_value);
  170    175   
        }
         176  +
    }
  171    177   
    if let ::std::option::Option::Some(inner_7) = &input.checksum {
  172    178   
        let formatted_8 = inner_7.as_str();
         179  +
        if !formatted_8.is_empty() {
  173    180   
            let header_value = formatted_8;
  174    181   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  175    182   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  176    183   
                    "checksum",
  177    184   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  178    185   
                )
  179    186   
            })?;
  180    187   
            builder = builder.header("x-amz-Checksum", header_value);
  181    188   
        }
         189  +
    }
  182    190   
    Ok(builder)
  183    191   
}
  184    192   
  185    193   
pub(crate) fn de_complete_snapshot(
  186    194   
    value: &[u8],
  187    195   
    mut builder: crate::operation::complete_snapshot::builders::CompleteSnapshotOutputBuilder,
  188    196   
) -> Result<crate::operation::complete_snapshot::builders::CompleteSnapshotOutputBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
  189    197   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
  190    198   
    let tokens = &mut tokens_owned;
  191    199   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;

tmp-codegen-diff/codegen-client-test/ebs/rust-client-codegen/src/protocol_serde/shape_put_snapshot_block.rs

@@ -119,119 +194,202 @@
  139    139   
        output.build()
  140    140   
    })
  141    141   
}
  142    142   
  143    143   
pub fn ser_put_snapshot_block_headers(
  144    144   
    input: &crate::operation::put_snapshot_block::PutSnapshotBlockInput,
  145    145   
    mut builder: ::http::request::Builder,
  146    146   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  147    147   
    if let ::std::option::Option::Some(inner_1) = &input.checksum {
  148    148   
        let formatted_2 = inner_1.as_str();
         149  +
        if !formatted_2.is_empty() {
  149    150   
            let header_value = formatted_2;
  150    151   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  151    152   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  152    153   
                    "checksum",
  153    154   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  154    155   
                )
  155    156   
            })?;
  156    157   
            builder = builder.header("x-amz-Checksum", header_value);
  157    158   
        }
         159  +
    }
  158    160   
    if let ::std::option::Option::Some(inner_3) = &input.progress {
  159    161   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_3);
  160    162   
        let formatted_4 = encoder.encode();
         163  +
        if !formatted_4.is_empty() {
  161    164   
            let header_value = formatted_4;
  162    165   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  163    166   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  164    167   
                    "progress",
  165    168   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  166    169   
                )
  167    170   
            })?;
  168    171   
            builder = builder.header("x-amz-Progress", header_value);
  169    172   
        }
         173  +
    }
  170    174   
    if let ::std::option::Option::Some(inner_5) = &input.data_length {
  171    175   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_5);
  172    176   
        let formatted_6 = encoder.encode();
         177  +
        if !formatted_6.is_empty() {
  173    178   
            let header_value = formatted_6;
  174    179   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  175    180   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  176    181   
                    "data_length",
  177    182   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  178    183   
                )
  179    184   
            })?;
  180    185   
            builder = builder.header("x-amz-Data-Length", header_value);
  181    186   
        }
         187  +
    }
  182    188   
    if let ::std::option::Option::Some(inner_7) = &input.checksum_algorithm {
  183    189   
        let formatted_8 = inner_7.as_str();
         190  +
        if !formatted_8.is_empty() {
  184    191   
            let header_value = formatted_8;
  185    192   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  186    193   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  187    194   
                    "checksum_algorithm",
  188    195   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  189    196   
                )
  190    197   
            })?;
  191    198   
            builder = builder.header("x-amz-Checksum-Algorithm", header_value);
  192    199   
        }
         200  +
    }
  193    201   
    Ok(builder)
  194    202   
}

tmp-codegen-diff/codegen-client-test/misc/rust-client-codegen/src/protocol_serde/shape_required_header_collection_operation.rs

@@ -51,51 +117,111 @@
   71     71   
            .build()
   72     72   
            .map_err(crate::operation::required_header_collection_operation::RequiredHeaderCollectionOperationError::unhandled)?
   73     73   
    })
   74     74   
}
   75     75   
   76     76   
pub fn ser_required_header_collection_operation_headers(
   77     77   
    input: &crate::operation::required_header_collection_operation::RequiredHeaderCollectionOperationInput,
   78     78   
    mut builder: ::http::request::Builder,
   79     79   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   80     80   
    if let ::std::option::Option::Some(inner_1) = &input.required_header_list {
   81         -
        // Empty vec in header is serialized as an empty string
   82         -
        if inner_1.is_empty() {
   83         -
            builder = builder.header("X-Required-List", "");
   84         -
        } else {
   85     81   
        for inner_2 in inner_1 {
   86     82   
            let formatted_3 = ::aws_smithy_http::header::quote_header_value(inner_2.as_str());
          83  +
            if !formatted_3.is_empty() {
   87     84   
                let header_value = formatted_3;
   88     85   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   89     86   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
   90     87   
                        "required_header_list",
   91     88   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
   92     89   
                    )
   93     90   
                })?;
   94     91   
                builder = builder.header("X-Required-List", header_value);
   95     92   
            }
   96     93   
        }
   97     94   
    }
   98     95   
    if let ::std::option::Option::Some(inner_4) = &input.required_header_set {
   99         -
        // Empty vec in header is serialized as an empty string
  100         -
        if inner_4.is_empty() {
  101         -
            builder = builder.header("X-Required-Set", "");
  102         -
        } else {
  103     96   
        for inner_5 in inner_4 {
  104     97   
            let formatted_6 = ::aws_smithy_http::header::quote_header_value(inner_5.as_str());
          98  +
            if !formatted_6.is_empty() {
  105     99   
                let header_value = formatted_6;
  106    100   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  107    101   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  108    102   
                        "required_header_set",
  109    103   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  110    104   
                    )
  111    105   
                })?;
  112    106   
                builder = builder.header("X-Required-Set", header_value);
  113    107   
            }
  114    108   
        }

tmp-codegen-diff/codegen-client-test/pokemon-service-client/rust-client-codegen/src/protocol_serde/shape_get_storage.rs

@@ -60,60 +128,130 @@
   80     80   
            .map_err(crate::operation::get_storage::GetStorageError::unhandled)?
   81     81   
    })
   82     82   
}
   83     83   
   84     84   
pub fn ser_get_storage_headers(
   85     85   
    input: &crate::operation::get_storage::GetStorageInput,
   86     86   
    mut builder: ::http::request::Builder,
   87     87   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   88     88   
    if let ::std::option::Option::Some(inner_1) = &input.passcode {
   89     89   
        let formatted_2 = inner_1.as_str();
          90  +
        if !formatted_2.is_empty() {
   90     91   
            let header_value = formatted_2;
   91     92   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   92     93   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   93     94   
                    "passcode",
   94     95   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   95     96   
                )
   96     97   
            })?;
   97     98   
            builder = builder.header("passcode", header_value);
   98     99   
        }
         100  +
    }
   99    101   
    Ok(builder)
  100    102   
}
  101    103   
  102    104   
pub(crate) fn de_get_storage(
  103    105   
    value: &[u8],
  104    106   
    mut builder: crate::operation::get_storage::builders::GetStorageOutputBuilder,
  105    107   
) -> Result<crate::operation::get_storage::builders::GetStorageOutputBuilder, ::aws_smithy_json::deserialize::error::DeserializeError> {
  106    108   
    let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable();
  107    109   
    let tokens = &mut tokens_owned;
  108    110   
    ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?;

tmp-codegen-diff/codegen-client-test/query-compat-test/rust-client-codegen/src/operation/operation.rs

@@ -148,148 +209,207 @@
  168    168   
                uri_base(input, &mut uri)?;
  169    169   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  170    170   
            }
  171    171   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  172    172   
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/x-amz-json-1.0");
  173    173   
            builder = _header_serialization_settings.set_default_header(
  174    174   
                builder,
  175    175   
                ::http::header::HeaderName::from_static("x-amz-target"),
  176    176   
                "QueryCompatService.Operation",
  177    177   
            );
  178         -
            builder =
  179         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("x-amzn-query-mode"), "true");
  180    178   
            builder
  181    179   
        };
  182    180   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_operation::ser_operation_input(&input)?);
  183    181   
        if let Some(content_length) = body.content_length() {
  184    182   
            let content_length = content_length.to_string();
  185    183   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  186    184   
        }
  187    185   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  188    186   
    }
  189    187   
}
@@ -214,212 +274,272 @@
  234    232   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  235    233   
  236    234   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  237    235   
        let result = client
  238    236   
            .operation()
  239    237   
            .set_message(::std::option::Option::Some("hello!".to_owned()))
  240    238   
            .send()
  241    239   
            .await;
  242    240   
        let _ = dbg!(result);
  243    241   
        let http_request = request_receiver.expect_request();
  244         -
        let expected_headers = [("x-amz-target", "QueryCompatService.Operation"), ("x-amzn-query-mode", "true")];
         242  +
        let expected_headers = [("x-amz-target", "QueryCompatService.Operation")];
  245    243   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  246    244   
        let body = http_request.body().bytes().expect("body should be strict");
  247    245   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  248    246   
            body,
  249    247   
            "{\"message\":\"hello!\"}",
  250    248   
            ::aws_smithy_protocol_test::MediaType::from("unknown"),
  251    249   
        ));
  252    250   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  253    251   
        ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
  254    252   
        ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/http_prefix_headers.rs

@@ -232,232 +348,318 @@
  252    252   
        let expected_headers = [("X-Foo", "Foo"), ("X-Foo-Abc", "Abc value"), ("X-Foo-Def", "Def value")];
  253    253   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  254    254   
        let body = http_request.body().bytes().expect("body should be strict");
  255    255   
        // No body.
  256    256   
        ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
  257    257   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  258    258   
        ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
  259    259   
        ::pretty_assertions::assert_eq!(uri.path(), "/HttpPrefixHeaders", "path was incorrect");
  260    260   
    }
  261    261   
  262         -
    /// No prefix headers are serialized because the value is not present
         262  +
    /// No prefix headers are serialized because the value is empty
  263    263   
    /// Test ID: RestJsonHttpPrefixHeadersAreNotPresent
  264    264   
    #[::tokio::test]
  265    265   
    #[::tracing_test::traced_test]
  266    266   
    async fn rest_json_http_prefix_headers_are_not_present_request() {
  267    267   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  268    268   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  269    269   
  270    270   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  271    271   
        let result = client
  272    272   
            .http_prefix_headers()
  273    273   
            .set_foo(::std::option::Option::Some("Foo".to_owned()))
  274    274   
            .set_foo_map(::std::option::Option::Some(::std::collections::HashMap::new()))
  275    275   
            .send()
  276    276   
            .await;
  277    277   
        let _ = dbg!(result);
  278    278   
        let http_request = request_receiver.expect_request();
  279    279   
        let expected_headers = [("X-Foo", "Foo")];
  280    280   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  281    281   
        let body = http_request.body().bytes().expect("body should be strict");
  282    282   
        // No body.
  283    283   
        ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
  284    284   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  285    285   
        ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
  286    286   
        ::pretty_assertions::assert_eq!(uri.path(), "/HttpPrefixHeaders", "path was incorrect");
  287    287   
    }
  288    288   
  289         -
    /// Serialize prefix headers were the value is present but empty
  290         -
    /// Test ID: RestJsonHttpPrefixEmptyHeaders
  291         -
    #[::tokio::test]
  292         -
    #[::tracing_test::traced_test]
  293         -
    async fn rest_json_http_prefix_empty_headers_request() {
  294         -
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  295         -
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  296         -
  297         -
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  298         -
        let result = client
  299         -
            .http_prefix_headers()
  300         -
            .set_foo_map(::std::option::Option::Some({
  301         -
                let mut ret = ::std::collections::HashMap::new();
  302         -
                ret.insert("Abc".to_owned().to_ascii_lowercase(), "".to_owned());
  303         -
                ret
  304         -
            }))
  305         -
            .send()
  306         -
            .await;
  307         -
        let _ = dbg!(result);
  308         -
        let http_request = request_receiver.expect_request();
  309         -
        let expected_headers = [("X-Foo-Abc", "")];
  310         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  311         -
        let body = http_request.body().bytes().expect("body should be strict");
  312         -
        // No body.
  313         -
        ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
  314         -
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  315         -
        ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
  316         -
        ::pretty_assertions::assert_eq!(uri.path(), "/HttpPrefixHeaders", "path was incorrect");
  317         -
    }
  318         -
  319    289   
    /// Adds headers by prefix
  320    290   
    /// Test ID: RestJsonHttpPrefixHeadersArePresent
  321    291   
    #[::tokio::test]
  322    292   
    #[::tracing_test::traced_test]
  323    293   
    async fn rest_json_http_prefix_headers_are_present_response() {
  324    294   
        let expected_output = crate::operation::http_prefix_headers::HttpPrefixHeadersOutput::builder()
  325    295   
            .set_foo(::std::option::Option::Some("Foo".to_owned()))
  326    296   
            .set_foo_map(::std::option::Option::Some({
  327    297   
                let mut ret = ::std::collections::HashMap::new();
  328    298   
                ret.insert("Abc".to_owned().to_ascii_lowercase(), "Abc value".to_owned());

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/operation/null_and_empty_headers_client.rs

@@ -200,200 +280,278 @@
  220    220   
    }
  221    221   
}
  222    222   
  223    223   
// The get_* functions below are generated from JMESPath expressions in the
  224    224   
// operationContextParams trait. They target the operation's input shape.
  225    225   
  226    226   
#[allow(unreachable_code, unused_variables)]
  227    227   
#[cfg(test)]
  228    228   
mod null_and_empty_headers_client_test {
  229    229   
  230         -
    /// Do not send null values, but do send empty strings and empty lists over the wire in headers
         230  +
    /// Do not send null values, empty strings, or empty lists over the wire in headers
  231    231   
    /// Test ID: RestJsonNullAndEmptyHeaders
  232    232   
    #[::tokio::test]
  233    233   
    #[::tracing_test::traced_test]
  234    234   
    async fn rest_json_null_and_empty_headers_request() {
  235    235   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  236    236   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  237    237   
  238    238   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  239    239   
        let result = client
  240    240   
            .null_and_empty_headers_client()
  241    241   
            .set_a(::std::option::Option::None)
  242    242   
            .set_b(::std::option::Option::Some("".to_owned()))
  243    243   
            .set_c(::std::option::Option::Some(vec![]))
  244    244   
            .send()
  245    245   
            .await;
  246    246   
        let _ = dbg!(result);
  247    247   
        let http_request = request_receiver.expect_request();
  248         -
        let expected_headers = [("X-B", ""), ("X-C", "")];
  249         -
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  250         -
        let forbidden_headers = &["X-A"];
         248  +
        let forbidden_headers = &["X-A", "X-B", "X-C"];
  251    249   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::forbid_headers(http_request.headers(), forbidden_headers));
  252    250   
        let body = http_request.body().bytes().expect("body should be strict");
  253    251   
        // No body.
  254    252   
        ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
  255    253   
        let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
  256    254   
        ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
  257    255   
        ::pretty_assertions::assert_eq!(uri.path(), "/NullAndEmptyHeadersClient", "path was incorrect");
  258    256   
    }
  259    257   
}
  260    258   

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

@@ -11,11 +51,53 @@
   31     31   
        output.build()
   32     32   
    })
   33     33   
}
   34     34   
   35     35   
pub fn ser_http_payload_traits_headers(
   36     36   
    input: &crate::operation::http_payload_traits::HttpPayloadTraitsInput,
   37     37   
    mut builder: ::http::request::Builder,
   38     38   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   39     39   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
   40     40   
        let formatted_2 = inner_1.as_str();
          41  +
        if !formatted_2.is_empty() {
   41     42   
            let header_value = formatted_2;
   42     43   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   43     44   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   44     45   
                    "foo",
   45     46   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   46     47   
                )
   47     48   
            })?;
   48     49   
            builder = builder.header("X-Foo", header_value);
   49     50   
        }
          51  +
    }
   50     52   
    Ok(builder)
   51     53   
}

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

@@ -20,20 +60,62 @@
   40     40   
        output.build()
   41     41   
    })
   42     42   
}
   43     43   
   44     44   
pub fn ser_http_payload_traits_with_media_type_headers(
   45     45   
    input: &crate::operation::http_payload_traits_with_media_type::HttpPayloadTraitsWithMediaTypeInput,
   46     46   
    mut builder: ::http::request::Builder,
   47     47   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   48     48   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
   49     49   
        let formatted_2 = inner_1.as_str();
          50  +
        if !formatted_2.is_empty() {
   50     51   
            let header_value = formatted_2;
   51     52   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   52     53   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   53     54   
                    "foo",
   54     55   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   55     56   
                )
   56     57   
            })?;
   57     58   
            builder = builder.header("X-Foo", header_value);
   58     59   
        }
          60  +
    }
   59     61   
    Ok(builder)
   60     62   
}

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

@@ -15,15 +76,78 @@
   35     35   
        output.build()
   36     36   
    })
   37     37   
}
   38     38   
   39     39   
pub fn ser_http_prefix_headers_headers(
   40     40   
    input: &crate::operation::http_prefix_headers::HttpPrefixHeadersInput,
   41     41   
    mut builder: ::http::request::Builder,
   42     42   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   43     43   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
   44     44   
        let formatted_2 = inner_1.as_str();
          45  +
        if !formatted_2.is_empty() {
   45     46   
            let header_value = formatted_2;
   46     47   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   47     48   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   48     49   
                    "foo",
   49     50   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   50     51   
                )
   51     52   
            })?;
   52     53   
            builder = builder.header("X-Foo", header_value);
   53     54   
        }
          55  +
    }
   54     56   
    if let ::std::option::Option::Some(inner_3) = &input.foo_map {
   55     57   
        {
   56     58   
            for (k, v) in inner_3 {
   57     59   
                use std::str::FromStr;
   58     60   
                let header_name = http::header::HeaderName::from_str(&format!("{}{}", "X-Foo-", &k)).map_err(|err| {
   59     61   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
   60     62   
                        "foo_map",
   61     63   
                        format!("`{k}` cannot be used as a header name: {err}"),
   62     64   
                    )
   63     65   
                })?;

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_input_and_output_with_headers.rs

@@ -140,140 +428,429 @@
  160    160   
        output.build()
  161    161   
    })
  162    162   
}
  163    163   
  164    164   
pub fn ser_input_and_output_with_headers_headers(
  165    165   
    input: &crate::operation::input_and_output_with_headers::InputAndOutputWithHeadersInput,
  166    166   
    mut builder: ::http::request::Builder,
  167    167   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  168    168   
    if let ::std::option::Option::Some(inner_1) = &input.header_string {
  169    169   
        let formatted_2 = inner_1.as_str();
         170  +
        if !formatted_2.is_empty() {
  170    171   
            let header_value = formatted_2;
  171    172   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  172    173   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  173    174   
                    "header_string",
  174    175   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  175    176   
                )
  176    177   
            })?;
  177    178   
            builder = builder.header("X-String", header_value);
  178    179   
        }
         180  +
    }
  179    181   
    if let ::std::option::Option::Some(inner_3) = &input.header_byte {
  180    182   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_3);
  181    183   
        let formatted_4 = encoder.encode();
         184  +
        if !formatted_4.is_empty() {
  182    185   
            let header_value = formatted_4;
  183    186   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  184    187   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  185    188   
                    "header_byte",
  186    189   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  187    190   
                )
  188    191   
            })?;
  189    192   
            builder = builder.header("X-Byte", header_value);
  190    193   
        }
         194  +
    }
  191    195   
    if let ::std::option::Option::Some(inner_5) = &input.header_short {
  192    196   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_5);
  193    197   
        let formatted_6 = encoder.encode();
         198  +
        if !formatted_6.is_empty() {
  194    199   
            let header_value = formatted_6;
  195    200   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  196    201   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  197    202   
                    "header_short",
  198    203   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  199    204   
                )
  200    205   
            })?;
  201    206   
            builder = builder.header("X-Short", header_value);
  202    207   
        }
         208  +
    }
  203    209   
    if let ::std::option::Option::Some(inner_7) = &input.header_integer {
  204    210   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_7);
  205    211   
        let formatted_8 = encoder.encode();
         212  +
        if !formatted_8.is_empty() {
  206    213   
            let header_value = formatted_8;
  207    214   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  208    215   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  209    216   
                    "header_integer",
  210    217   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  211    218   
                )
  212    219   
            })?;
  213    220   
            builder = builder.header("X-Integer", header_value);
  214    221   
        }
         222  +
    }
  215    223   
    if let ::std::option::Option::Some(inner_9) = &input.header_long {
  216    224   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_9);
  217    225   
        let formatted_10 = encoder.encode();
         226  +
        if !formatted_10.is_empty() {
  218    227   
            let header_value = formatted_10;
  219    228   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  220    229   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  221    230   
                    "header_long",
  222    231   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  223    232   
                )
  224    233   
            })?;
  225    234   
            builder = builder.header("X-Long", header_value);
  226    235   
        }
         236  +
    }
  227    237   
    if let ::std::option::Option::Some(inner_11) = &input.header_float {
  228    238   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_11);
  229    239   
        let formatted_12 = encoder.encode();
         240  +
        if !formatted_12.is_empty() {
  230    241   
            let header_value = formatted_12;
  231    242   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  232    243   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  233    244   
                    "header_float",
  234    245   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  235    246   
                )
  236    247   
            })?;
  237    248   
            builder = builder.header("X-Float", header_value);
  238    249   
        }
         250  +
    }
  239    251   
    if let ::std::option::Option::Some(inner_13) = &input.header_double {
  240    252   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_13);
  241    253   
        let formatted_14 = encoder.encode();
         254  +
        if !formatted_14.is_empty() {
  242    255   
            let header_value = formatted_14;
  243    256   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  244    257   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  245    258   
                    "header_double",
  246    259   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  247    260   
                )
  248    261   
            })?;
  249    262   
            builder = builder.header("X-Double", header_value);
  250    263   
        }
         264  +
    }
  251    265   
    if let ::std::option::Option::Some(inner_15) = &input.header_true_bool {
  252    266   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_15);
  253    267   
        let formatted_16 = encoder.encode();
         268  +
        if !formatted_16.is_empty() {
  254    269   
            let header_value = formatted_16;
  255    270   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  256    271   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  257    272   
                    "header_true_bool",
  258    273   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  259    274   
                )
  260    275   
            })?;
  261    276   
            builder = builder.header("X-Boolean1", header_value);
  262    277   
        }
         278  +
    }
  263    279   
    if let ::std::option::Option::Some(inner_17) = &input.header_false_bool {
  264    280   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_17);
  265    281   
        let formatted_18 = encoder.encode();
         282  +
        if !formatted_18.is_empty() {
  266    283   
            let header_value = formatted_18;
  267    284   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  268    285   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  269    286   
                    "header_false_bool",
  270    287   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  271    288   
                )
  272    289   
            })?;
  273    290   
            builder = builder.header("X-Boolean2", header_value);
  274    291   
        }
         292  +
    }
  275    293   
    if let ::std::option::Option::Some(inner_19) = &input.header_string_list {
  276         -
        // Empty vec in header is serialized as an empty string
  277         -
        if inner_19.is_empty() {
  278         -
            builder = builder.header("X-StringList", "");
  279         -
        } else {
  280    294   
        for inner_20 in inner_19 {
  281    295   
            let formatted_21 = ::aws_smithy_http::header::quote_header_value(inner_20.as_str());
         296  +
            if !formatted_21.is_empty() {
  282    297   
                let header_value = formatted_21;
  283    298   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  284    299   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  285    300   
                        "header_string_list",
  286    301   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  287    302   
                    )
  288    303   
                })?;
  289    304   
                builder = builder.header("X-StringList", header_value);
  290    305   
            }
  291    306   
        }
  292    307   
    }
  293    308   
    if let ::std::option::Option::Some(inner_22) = &input.header_string_set {
  294         -
        // Empty vec in header is serialized as an empty string
  295         -
        if inner_22.is_empty() {
  296         -
            builder = builder.header("X-StringSet", "");
  297         -
        } else {
  298    309   
        for inner_23 in inner_22 {
  299    310   
            let formatted_24 = ::aws_smithy_http::header::quote_header_value(inner_23.as_str());
         311  +
            if !formatted_24.is_empty() {
  300    312   
                let header_value = formatted_24;
  301    313   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  302    314   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  303    315   
                        "header_string_set",
  304    316   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  305    317   
                    )
  306    318   
                })?;
  307    319   
                builder = builder.header("X-StringSet", header_value);
  308    320   
            }
  309    321   
        }
  310    322   
    }
  311    323   
    if let ::std::option::Option::Some(inner_25) = &input.header_integer_list {
  312         -
        // Empty vec in header is serialized as an empty string
  313         -
        if inner_25.is_empty() {
  314         -
            builder = builder.header("X-IntegerList", "");
  315         -
        } else {
  316    324   
        for inner_26 in inner_25 {
  317    325   
            let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_26);
  318    326   
            let formatted_27 = encoder.encode();
         327  +
            if !formatted_27.is_empty() {
  319    328   
                let header_value = formatted_27;
  320    329   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  321    330   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  322    331   
                        "header_integer_list",
  323    332   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  324    333   
                    )
  325    334   
                })?;
  326    335   
                builder = builder.header("X-IntegerList", header_value);
  327    336   
            }
  328    337   
        }
  329    338   
    }
  330    339   
    if let ::std::option::Option::Some(inner_28) = &input.header_boolean_list {
  331         -
        // Empty vec in header is serialized as an empty string
  332         -
        if inner_28.is_empty() {
  333         -
            builder = builder.header("X-BooleanList", "");
  334         -
        } else {
  335    340   
        for inner_29 in inner_28 {
  336    341   
            let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_29);
  337    342   
            let formatted_30 = encoder.encode();
         343  +
            if !formatted_30.is_empty() {
  338    344   
                let header_value = formatted_30;
  339    345   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  340    346   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  341    347   
                        "header_boolean_list",
  342    348   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  343    349   
                    )
  344    350   
                })?;
  345    351   
                builder = builder.header("X-BooleanList", header_value);
  346    352   
            }
  347    353   
        }
  348    354   
    }
  349    355   
    if let ::std::option::Option::Some(inner_31) = &input.header_timestamp_list {
  350         -
        // Empty vec in header is serialized as an empty string
  351         -
        if inner_31.is_empty() {
  352         -
            builder = builder.header("X-TimestampList", "");
  353         -
        } else {
  354    356   
        for inner_32 in inner_31 {
  355    357   
            let formatted_33 = inner_32.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
         358  +
            if !formatted_33.is_empty() {
  356    359   
                let header_value = formatted_33;
  357    360   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  358    361   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  359    362   
                        "header_timestamp_list",
  360    363   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  361    364   
                    )
  362    365   
                })?;
  363    366   
                builder = builder.header("X-TimestampList", header_value);
  364    367   
            }
  365    368   
        }
  366    369   
    }
  367    370   
    if let ::std::option::Option::Some(inner_34) = &input.header_enum {
  368    371   
        let formatted_35 = inner_34.as_str();
         372  +
        if !formatted_35.is_empty() {
  369    373   
            let header_value = formatted_35;
  370    374   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  371    375   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  372    376   
                    "header_enum",
  373    377   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  374    378   
                )
  375    379   
            })?;
  376    380   
            builder = builder.header("X-Enum", header_value);
  377    381   
        }
         382  +
    }
  378    383   
    if let ::std::option::Option::Some(inner_36) = &input.header_enum_list {
  379         -
        // Empty vec in header is serialized as an empty string
  380         -
        if inner_36.is_empty() {
  381         -
            builder = builder.header("X-EnumList", "");
  382         -
        } else {
  383    384   
        for inner_37 in inner_36 {
  384    385   
            let formatted_38 = ::aws_smithy_http::header::quote_header_value(inner_37.as_str());
         386  +
            if !formatted_38.is_empty() {
  385    387   
                let header_value = formatted_38;
  386    388   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  387    389   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  388    390   
                        "header_enum_list",
  389    391   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  390    392   
                    )
  391    393   
                })?;
  392    394   
                builder = builder.header("X-EnumList", header_value);
  393    395   
            }
  394    396   
        }
  395    397   
    }
  396    398   
    if let ::std::option::Option::Some(inner_39) = &input.header_integer_enum {
  397    399   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_39);
  398    400   
        let formatted_40 = encoder.encode();
         401  +
        if !formatted_40.is_empty() {
  399    402   
            let header_value = formatted_40;
  400    403   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  401    404   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  402    405   
                    "header_integer_enum",
  403    406   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  404    407   
                )
  405    408   
            })?;
  406    409   
            builder = builder.header("X-IntegerEnum", header_value);
  407    410   
        }
         411  +
    }
  408    412   
    if let ::std::option::Option::Some(inner_41) = &input.header_integer_enum_list {
  409         -
        // Empty vec in header is serialized as an empty string
  410         -
        if inner_41.is_empty() {
  411         -
            builder = builder.header("X-IntegerEnumList", "");
  412         -
        } else {
  413    413   
        for inner_42 in inner_41 {
  414    414   
            let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_42);
  415    415   
            let formatted_43 = encoder.encode();
         416  +
            if !formatted_43.is_empty() {
  416    417   
                let header_value = formatted_43;
  417    418   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  418    419   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
  419    420   
                        "header_integer_enum_list",
  420    421   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
  421    422   
                    )
  422    423   
                })?;
  423    424   
                builder = builder.header("X-IntegerEnumList", header_value);
  424    425   
            }
  425    426   
        }

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_malformed_boolean.rs

@@ -5,5 +55,57 @@
   25     25   
    })
   26     26   
}
   27     27   
   28     28   
pub fn ser_malformed_boolean_headers(
   29     29   
    input: &crate::operation::malformed_boolean::MalformedBooleanInput,
   30     30   
    mut builder: ::http::request::Builder,
   31     31   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   32     32   
    if let ::std::option::Option::Some(inner_1) = &input.boolean_in_header {
   33     33   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_1);
   34     34   
        let formatted_2 = encoder.encode();
          35  +
        if !formatted_2.is_empty() {
   35     36   
            let header_value = formatted_2;
   36     37   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   37     38   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   38     39   
                    "boolean_in_header",
   39     40   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   40     41   
                )
   41     42   
            })?;
   42     43   
            builder = builder.header("booleanInHeader", header_value);
   43     44   
        }
          45  +
    }
   44     46   
    Ok(builder)
   45     47   
}
   46     48   
   47     49   
pub fn ser_malformed_boolean_input(
   48     50   
    input: &crate::operation::malformed_boolean::MalformedBooleanInput,
   49     51   
) -> Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   50     52   
    let mut out = String::new();
   51     53   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   52     54   
    crate::protocol_serde::shape_malformed_boolean_input::ser_malformed_boolean_input_input(&mut object, input)?;
   53     55   
    object.finish();

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_malformed_byte.rs

@@ -5,5 +55,57 @@
   25     25   
    })
   26     26   
}
   27     27   
   28     28   
pub fn ser_malformed_byte_headers(
   29     29   
    input: &crate::operation::malformed_byte::MalformedByteInput,
   30     30   
    mut builder: ::http::request::Builder,
   31     31   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   32     32   
    if let ::std::option::Option::Some(inner_1) = &input.byte_in_header {
   33     33   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_1);
   34     34   
        let formatted_2 = encoder.encode();
          35  +
        if !formatted_2.is_empty() {
   35     36   
            let header_value = formatted_2;
   36     37   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   37     38   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   38     39   
                    "byte_in_header",
   39     40   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   40     41   
                )
   41     42   
            })?;
   42     43   
            builder = builder.header("byteInHeader", header_value);
   43     44   
        }
          45  +
    }
   44     46   
    Ok(builder)
   45     47   
}
   46     48   
   47     49   
pub fn ser_malformed_byte_input(
   48     50   
    input: &crate::operation::malformed_byte::MalformedByteInput,
   49     51   
) -> Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   50     52   
    let mut out = String::new();
   51     53   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   52     54   
    crate::protocol_serde::shape_malformed_byte_input::ser_malformed_byte_input_input(&mut object, input)?;
   53     55   
    object.finish();

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_malformed_double.rs

@@ -5,5 +55,57 @@
   25     25   
    })
   26     26   
}
   27     27   
   28     28   
pub fn ser_malformed_double_headers(
   29     29   
    input: &crate::operation::malformed_double::MalformedDoubleInput,
   30     30   
    mut builder: ::http::request::Builder,
   31     31   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   32     32   
    if let ::std::option::Option::Some(inner_1) = &input.double_in_header {
   33     33   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_1);
   34     34   
        let formatted_2 = encoder.encode();
          35  +
        if !formatted_2.is_empty() {
   35     36   
            let header_value = formatted_2;
   36     37   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   37     38   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   38     39   
                    "double_in_header",
   39     40   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   40     41   
                )
   41     42   
            })?;
   42     43   
            builder = builder.header("doubleInHeader", header_value);
   43     44   
        }
          45  +
    }
   44     46   
    Ok(builder)
   45     47   
}
   46     48   
   47     49   
pub fn ser_malformed_double_input(
   48     50   
    input: &crate::operation::malformed_double::MalformedDoubleInput,
   49     51   
) -> Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   50     52   
    let mut out = String::new();
   51     53   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   52     54   
    crate::protocol_serde::shape_malformed_double_input::ser_malformed_double_input_input(&mut object, input)?;
   53     55   
    object.finish();

tmp-codegen-diff/codegen-client-test/rest_json/rust-client-codegen/src/protocol_serde/shape_malformed_float.rs

@@ -5,5 +55,57 @@
   25     25   
    })
   26     26   
}
   27     27   
   28     28   
pub fn ser_malformed_float_headers(
   29     29   
    input: &crate::operation::malformed_float::MalformedFloatInput,
   30     30   
    mut builder: ::http::request::Builder,
   31     31   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   32     32   
    if let ::std::option::Option::Some(inner_1) = &input.float_in_header {
   33     33   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_1);
   34     34   
        let formatted_2 = encoder.encode();
          35  +
        if !formatted_2.is_empty() {
   35     36   
            let header_value = formatted_2;
   36     37   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   37     38   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   38     39   
                    "float_in_header",
   39     40   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   40     41   
                )
   41     42   
            })?;
   42     43   
            builder = builder.header("floatInHeader", header_value);
   43     44   
        }
          45  +
    }
   44     46   
    Ok(builder)
   45     47   
}
   46     48   
   47     49   
pub fn ser_malformed_float_input(
   48     50   
    input: &crate::operation::malformed_float::MalformedFloatInput,
   49     51   
) -> Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   50     52   
    let mut out = String::new();
   51     53   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   52     54   
    crate::protocol_serde::shape_malformed_float_input::ser_malformed_float_input_input(&mut object, input)?;
   53     55   
    object.finish();