Client Test

Client Test

rev. a25ccedd311e7562a03a1cd07d728cef10c9474c (ignoring whitespace)

Files changed:

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/protocol_serde/shape_endpoint_with_host_label_header_operation.rs

@@ -11,11 +51,53 @@
   31     31   
        output.build()
   32     32   
    })
   33     33   
}
   34     34   
   35     35   
pub fn ser_endpoint_with_host_label_header_operation_headers(
   36     36   
    input: &crate::operation::endpoint_with_host_label_header_operation::EndpointWithHostLabelHeaderOperationInput,
   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.account_id {
   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   
                    "account_id",
   45     46   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   46     47   
                )
   47     48   
            })?;
   48     49   
            builder = builder.header("X-Amz-Account-Id", header_value);
   49     50   
        }
          51  +
    }
   50     52   
    Ok(builder)
   51     53   
}

tmp-codegen-diff/codegen-client-test/rest_xml/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_xml/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_xml/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_xml/rust-client-codegen/src/protocol_serde/shape_input_and_output_with_headers.rs

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

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/protocol_serde/shape_nested_xml_map_with_xml_name.rs

@@ -1,0 +85,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
#[allow(clippy::unnecessary_wraps)]
    3         -
pub fn de_nested_xml_map_with_xml_name_http_error(
    4         -
    _response_status: u16,
    5         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
    6         -
    _response_body: &[u8],
    7         -
) -> std::result::Result<
    8         -
    crate::operation::nested_xml_map_with_xml_name::NestedXmlMapWithXmlNameOutput,
    9         -
    crate::operation::nested_xml_map_with_xml_name::NestedXmlMapWithXmlNameError,
   10         -
> {
   11         -
    #[allow(unused_mut)]
   12         -
    let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body)
   13         -
        .map_err(crate::operation::nested_xml_map_with_xml_name::NestedXmlMapWithXmlNameError::unhandled)?;
   14         -
    let generic = generic_builder.build();
   15         -
    Err(crate::operation::nested_xml_map_with_xml_name::NestedXmlMapWithXmlNameError::generic(
   16         -
        generic,
   17         -
    ))
   18         -
}
   19         -
   20         -
#[allow(clippy::unnecessary_wraps)]
   21         -
pub fn de_nested_xml_map_with_xml_name_http_response(
   22         -
    _response_status: u16,
   23         -
    _response_headers: &::aws_smithy_runtime_api::http::Headers,
   24         -
    _response_body: &[u8],
   25         -
) -> std::result::Result<
   26         -
    crate::operation::nested_xml_map_with_xml_name::NestedXmlMapWithXmlNameOutput,
   27         -
    crate::operation::nested_xml_map_with_xml_name::NestedXmlMapWithXmlNameError,
   28         -
> {
   29         -
    Ok({
   30         -
        #[allow(unused_mut)]
   31         -
        let mut output = crate::operation::nested_xml_map_with_xml_name::builders::NestedXmlMapWithXmlNameOutputBuilder::default();
   32         -
        output = crate::protocol_serde::shape_nested_xml_map_with_xml_name::de_nested_xml_map_with_xml_name(_response_body, output)
   33         -
            .map_err(crate::operation::nested_xml_map_with_xml_name::NestedXmlMapWithXmlNameError::unhandled)?;
   34         -
        output.build()
   35         -
    })
   36         -
}
   37         -
   38         -
pub fn ser_nested_xml_map_with_xml_name_op_input(
   39         -
    input: &crate::operation::nested_xml_map_with_xml_name::NestedXmlMapWithXmlNameInput,
   40         -
) -> Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   41         -
    let mut out = String::new();
   42         -
    {
   43         -
        let mut writer = ::aws_smithy_xml::encode::XmlWriter::new(&mut out);
   44         -
        #[allow(unused_mut)]
   45         -
        let mut root = writer.start_el("NestedXmlMapWithXmlNameInputOutput");
   46         -
        crate::protocol_serde::shape_nested_xml_map_with_xml_name_input::ser_nested_xml_map_with_xml_name_input_input_input(input, root)?
   47         -
    }
   48         -
    Ok(::aws_smithy_types::body::SdkBody::from(out))
   49         -
}
   50         -
   51         -
#[allow(unused_mut)]
   52         -
pub fn de_nested_xml_map_with_xml_name(
   53         -
    inp: &[u8],
   54         -
    mut builder: crate::operation::nested_xml_map_with_xml_name::builders::NestedXmlMapWithXmlNameOutputBuilder,
   55         -
) -> Result<crate::operation::nested_xml_map_with_xml_name::builders::NestedXmlMapWithXmlNameOutputBuilder, ::aws_smithy_xml::decode::XmlDecodeError>
   56         -
{
   57         -
    let mut doc = ::aws_smithy_xml::decode::Document::try_from(inp)?;
   58         -
   59         -
    #[allow(unused_mut)]
   60         -
    let mut decoder = doc.root_element()?;
   61         -
    #[allow(unused_variables)]
   62         -
    let start_el = decoder.start_el();
   63         -
    if !start_el.matches("NestedXmlMapWithXmlNameInputOutput") {
   64         -
        return Err(::aws_smithy_xml::decode::XmlDecodeError::custom(format!(
   65         -
            "encountered invalid XML root: expected NestedXmlMapWithXmlNameInputOutput but got {:?}. This is likely a bug in the SDK.",
   66         -
            start_el
   67         -
        )));
   68         -
    }
   69         -
    while let Some(mut tag) = decoder.next_tag() {
   70         -
        match tag.start_el() {
   71         -
            s if s.matches("nestedXmlMapWithXmlNameMap") /* nestedXmlMapWithXmlNameMap aws.protocoltests.restxml.synthetic#NestedXmlMapWithXmlNameOutput$nestedXmlMapWithXmlNameMap */ =>  {
   72         -
                let var_1 =
   73         -
                    Some(
   74         -
                        crate::protocol_serde::shape_nested_xml_map_with_xml_name_map::de_nested_xml_map_with_xml_name_map(&mut tag)
   75         -
                        ?
   76         -
                    )
   77         -
                ;
   78         -
                builder = builder.set_nested_xml_map_with_xml_name_map(var_1);
   79         -
            }
   80         -
            ,
   81         -
            _ => {}
   82         -
        }
   83         -
    }
   84         -
    Ok(builder)
   85         -
}

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/protocol_serde/shape_nested_xml_map_with_xml_name_inner_map.rs

@@ -1,0 +54,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn de_nested_xml_map_with_xml_name_inner_map(
    3         -
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
    4         -
) -> Result<::std::collections::HashMap<::std::string::String, ::std::string::String>, ::aws_smithy_xml::decode::XmlDecodeError> {
    5         -
    let mut out = ::std::collections::HashMap::new();
    6         -
    while let Some(mut tag) = decoder.next_tag() {
    7         -
        match tag.start_el() {
    8         -
            s if s.matches("entry") => {
    9         -
                crate::protocol_serde::shape_nested_xml_map_with_xml_name_inner_map::de_nested_xml_map_with_xml_name_inner_map_entry(
   10         -
                    &mut tag, &mut out,
   11         -
                )?;
   12         -
            }
   13         -
            _ => {}
   14         -
        }
   15         -
    }
   16         -
    Ok(out)
   17         -
}
   18         -
   19         -
pub fn de_nested_xml_map_with_xml_name_inner_map_entry(
   20         -
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
   21         -
    out: &mut ::std::collections::HashMap<::std::string::String, ::std::string::String>,
   22         -
) -> Result<(), ::aws_smithy_xml::decode::XmlDecodeError> {
   23         -
    let mut k: Option<::std::string::String> = None;
   24         -
    let mut v: Option<::std::string::String> = None;
   25         -
    while let Some(mut tag) = decoder.next_tag() {
   26         -
        match tag.start_el() {
   27         -
            s if s.matches("InnerKey") /* key aws.protocoltests.restxml#NestedXmlMapWithXmlNameInnerMap$key */ =>  {
   28         -
                k = Some(
   29         -
                    Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
   30         -
                        ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
   31         -
                        .into()
   32         -
                    )
   33         -
                    ?
   34         -
                )
   35         -
            }
   36         -
            ,
   37         -
            s if s.matches("InnerValue") /* value aws.protocoltests.restxml#NestedXmlMapWithXmlNameInnerMap$value */ =>  {
   38         -
                v = Some(
   39         -
                    Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
   40         -
                        ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
   41         -
                        .into()
   42         -
                    )
   43         -
                    ?
   44         -
                )
   45         -
            }
   46         -
            ,
   47         -
            _ => {}
   48         -
        }
   49         -
    }
   50         -
    let k = k.ok_or_else(|| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing key map entry"))?;
   51         -
    let v = v.ok_or_else(|| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing value map entry"))?;
   52         -
    out.insert(k, v);
   53         -
    Ok(())
   54         -
}

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/protocol_serde/shape_nested_xml_map_with_xml_name_input.rs

@@ -1,0 +34,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn ser_nested_xml_map_with_xml_name_input_input_input(
    3         -
    input: &crate::operation::nested_xml_map_with_xml_name::NestedXmlMapWithXmlNameInput,
    4         -
    writer: ::aws_smithy_xml::encode::ElWriter,
    5         -
) -> Result<(), ::aws_smithy_types::error::operation::SerializationError> {
    6         -
    #[allow(unused_mut)]
    7         -
    let mut scope = writer.finish();
    8         -
    if let Some(var_1) = &input.nested_xml_map_with_xml_name_map {
    9         -
        let mut inner_writer = scope.start_el("nestedXmlMapWithXmlNameMap").finish();
   10         -
        for (key_2, value_3) in var_1 {
   11         -
            let mut entry = inner_writer.start_el("entry").finish();
   12         -
            {
   13         -
                let mut inner_writer = entry.start_el("OuterKey").finish();
   14         -
                inner_writer.data(key_2.as_str());
   15         -
            }
   16         -
            {
   17         -
                let mut inner_writer = entry.start_el("value").finish();
   18         -
                for (key_4, value_5) in value_3 {
   19         -
                    let mut entry = inner_writer.start_el("entry").finish();
   20         -
                    {
   21         -
                        let mut inner_writer = entry.start_el("InnerKey").finish();
   22         -
                        inner_writer.data(key_4.as_str());
   23         -
                    }
   24         -
                    {
   25         -
                        let mut inner_writer = entry.start_el("InnerValue").finish();
   26         -
                        inner_writer.data(value_5.as_str());
   27         -
                    }
   28         -
                }
   29         -
            }
   30         -
        }
   31         -
    }
   32         -
    scope.finish();
   33         -
    Ok(())
   34         -
}

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/protocol_serde/shape_nested_xml_map_with_xml_name_map.rs

@@ -1,0 +52,0 @@
    1         -
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
    2         -
pub fn de_nested_xml_map_with_xml_name_map(
    3         -
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
    4         -
) -> Result<
    5         -
    ::std::collections::HashMap<::std::string::String, ::std::collections::HashMap<::std::string::String, ::std::string::String>>,
    6         -
    ::aws_smithy_xml::decode::XmlDecodeError,
    7         -
> {
    8         -
    let mut out = ::std::collections::HashMap::new();
    9         -
    while let Some(mut tag) = decoder.next_tag() {
   10         -
        match tag.start_el() {
   11         -
            s if s.matches("entry") => {
   12         -
                crate::protocol_serde::shape_nested_xml_map_with_xml_name_map::de_nested_xml_map_with_xml_name_map_entry(&mut tag, &mut out)?;
   13         -
            }
   14         -
            _ => {}
   15         -
        }
   16         -
    }
   17         -
    Ok(out)
   18         -
}
   19         -
   20         -
pub fn de_nested_xml_map_with_xml_name_map_entry(
   21         -
    decoder: &mut ::aws_smithy_xml::decode::ScopedDecoder,
   22         -
    out: &mut ::std::collections::HashMap<::std::string::String, ::std::collections::HashMap<::std::string::String, ::std::string::String>>,
   23         -
) -> Result<(), ::aws_smithy_xml::decode::XmlDecodeError> {
   24         -
    let mut k: Option<::std::string::String> = None;
   25         -
    let mut v: Option<::std::collections::HashMap<::std::string::String, ::std::string::String>> = None;
   26         -
    while let Some(mut tag) = decoder.next_tag() {
   27         -
        match tag.start_el() {
   28         -
            s if s.matches("OuterKey") /* key aws.protocoltests.restxml#NestedXmlMapWithXmlNameMap$key */ =>  {
   29         -
                k = Some(
   30         -
                    Result::<::std::string::String, ::aws_smithy_xml::decode::XmlDecodeError>::Ok(
   31         -
                        ::aws_smithy_xml::decode::try_data(&mut tag)?.as_ref()
   32         -
                        .into()
   33         -
                    )
   34         -
                    ?
   35         -
                )
   36         -
            }
   37         -
            ,
   38         -
            s if s.matches("value") /* value aws.protocoltests.restxml#NestedXmlMapWithXmlNameMap$value */ =>  {
   39         -
                v = Some(
   40         -
                    crate::protocol_serde::shape_nested_xml_map_with_xml_name_inner_map::de_nested_xml_map_with_xml_name_inner_map(&mut tag)
   41         -
                    ?
   42         -
                )
   43         -
            }
   44         -
            ,
   45         -
            _ => {}
   46         -
        }
   47         -
    }
   48         -
    let k = k.ok_or_else(|| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing key map entry"))?;
   49         -
    let v = v.ok_or_else(|| ::aws_smithy_xml::decode::XmlDecodeError::custom("missing value map entry"))?;
   50         -
    out.insert(k, v);
   51         -
    Ok(())
   52         -
}

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/protocol_serde/shape_null_and_empty_headers_client.rs

@@ -27,27 +96,97 @@
   47     47   
        output.build()
   48     48   
    })
   49     49   
}
   50     50   
   51     51   
pub fn ser_null_and_empty_headers_client_headers(
   52     52   
    input: &crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientInput,
   53     53   
    mut builder: ::http::request::Builder,
   54     54   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   55     55   
    if let ::std::option::Option::Some(inner_1) = &input.a {
   56     56   
        let formatted_2 = inner_1.as_str();
          57  +
        if !formatted_2.is_empty() {
   57     58   
            let header_value = formatted_2;
   58     59   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   59     60   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   60     61   
                    "a",
   61     62   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   62     63   
                )
   63     64   
            })?;
   64     65   
            builder = builder.header("X-A", header_value);
   65     66   
        }
          67  +
    }
   66     68   
    if let ::std::option::Option::Some(inner_3) = &input.b {
   67     69   
        let formatted_4 = inner_3.as_str();
          70  +
        if !formatted_4.is_empty() {
   68     71   
            let header_value = formatted_4;
   69     72   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   70     73   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   71     74   
                    "b",
   72     75   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   73     76   
                )
   74     77   
            })?;
   75     78   
            builder = builder.header("X-B", header_value);
   76     79   
        }
          80  +
    }
   77     81   
    if let ::std::option::Option::Some(inner_5) = &input.c {
   78         -
        // Empty vec in header is serialized as an empty string
   79         -
        if inner_5.is_empty() {
   80         -
            builder = builder.header("X-C", "");
   81         -
        } else {
   82     82   
        for inner_6 in inner_5 {
   83     83   
            let formatted_7 = ::aws_smithy_http::header::quote_header_value(inner_6.as_str());
          84  +
            if !formatted_7.is_empty() {
   84     85   
                let header_value = formatted_7;
   85     86   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   86     87   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
   87     88   
                        "c",
   88     89   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
   89     90   
                    )
   90     91   
                })?;
   91     92   
                builder = builder.header("X-C", header_value);
   92     93   
            }
   93     94   
        }

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/protocol_serde/shape_null_and_empty_headers_server.rs

@@ -27,27 +96,97 @@
   47     47   
        output.build()
   48     48   
    })
   49     49   
}
   50     50   
   51     51   
pub fn ser_null_and_empty_headers_server_headers(
   52     52   
    input: &crate::operation::null_and_empty_headers_server::NullAndEmptyHeadersServerInput,
   53     53   
    mut builder: ::http::request::Builder,
   54     54   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   55     55   
    if let ::std::option::Option::Some(inner_1) = &input.a {
   56     56   
        let formatted_2 = inner_1.as_str();
          57  +
        if !formatted_2.is_empty() {
   57     58   
            let header_value = formatted_2;
   58     59   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   59     60   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   60     61   
                    "a",
   61     62   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   62     63   
                )
   63     64   
            })?;
   64     65   
            builder = builder.header("X-A", header_value);
   65     66   
        }
          67  +
    }
   66     68   
    if let ::std::option::Option::Some(inner_3) = &input.b {
   67     69   
        let formatted_4 = inner_3.as_str();
          70  +
        if !formatted_4.is_empty() {
   68     71   
            let header_value = formatted_4;
   69     72   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   70     73   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   71     74   
                    "b",
   72     75   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   73     76   
                )
   74     77   
            })?;
   75     78   
            builder = builder.header("X-B", header_value);
   76     79   
        }
          80  +
    }
   77     81   
    if let ::std::option::Option::Some(inner_5) = &input.c {
   78         -
        // Empty vec in header is serialized as an empty string
   79         -
        if inner_5.is_empty() {
   80         -
            builder = builder.header("X-C", "");
   81         -
        } else {
   82     82   
        for inner_6 in inner_5 {
   83     83   
            let formatted_7 = ::aws_smithy_http::header::quote_header_value(inner_6.as_str());
          84  +
            if !formatted_7.is_empty() {
   84     85   
                let header_value = formatted_7;
   85     86   
                let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   86     87   
                    ::aws_smithy_types::error::operation::BuildError::invalid_field(
   87     88   
                        "c",
   88     89   
                        format!("`{}` cannot be used as a header value: {}", &header_value, err),
   89     90   
                    )
   90     91   
                })?;
   91     92   
                builder = builder.header("X-C", header_value);
   92     93   
            }
   93     94   
        }

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/protocol_serde/shape_put_with_content_encoding.rs

@@ -10,10 +63,65 @@
   30     30   
        output.build()
   31     31   
    })
   32     32   
}
   33     33   
   34     34   
pub fn ser_put_with_content_encoding_headers(
   35     35   
    input: &crate::operation::put_with_content_encoding::PutWithContentEncodingInput,
   36     36   
    mut builder: ::http::request::Builder,
   37     37   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   38     38   
    if let ::std::option::Option::Some(inner_1) = &input.encoding {
   39     39   
        let formatted_2 = inner_1.as_str();
          40  +
        if !formatted_2.is_empty() {
   40     41   
            let header_value = formatted_2;
   41     42   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   42     43   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   43     44   
                    "encoding",
   44     45   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   45     46   
                )
   46     47   
            })?;
   47     48   
            builder = builder.header("Content-Encoding", header_value);
   48     49   
        }
          50  +
    }
   49     51   
    Ok(builder)
   50     52   
}
   51     53   
   52     54   
pub fn ser_put_with_content_encoding_op_input(
   53     55   
    input: &crate::operation::put_with_content_encoding::PutWithContentEncodingInput,
   54     56   
) -> Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   55     57   
    let mut out = String::new();
   56     58   
    {
   57     59   
        let mut writer = ::aws_smithy_xml::encode::XmlWriter::new(&mut out);
   58     60   
        #[allow(unused_mut)]

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/protocol_serde/shape_simple_scalar_properties.rs

@@ -17,17 +85,87 @@
   37     37   
        output.build()
   38     38   
    })
   39     39   
}
   40     40   
   41     41   
pub fn ser_simple_scalar_properties_headers(
   42     42   
    input: &crate::operation::simple_scalar_properties::SimpleScalarPropertiesInput,
   43     43   
    mut builder: ::http::request::Builder,
   44     44   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   45     45   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
   46     46   
        let formatted_2 = inner_1.as_str();
          47  +
        if !formatted_2.is_empty() {
   47     48   
            let header_value = formatted_2;
   48     49   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   49     50   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   50     51   
                    "foo",
   51     52   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   52     53   
                )
   53     54   
            })?;
   54     55   
            builder = builder.header("X-Foo", header_value);
   55     56   
        }
          57  +
    }
   56     58   
    Ok(builder)
   57     59   
}
   58     60   
   59     61   
pub fn ser_simple_scalar_properties_op_input(
   60     62   
    input: &crate::operation::simple_scalar_properties::SimpleScalarPropertiesInput,
   61     63   
) -> Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   62     64   
    let mut out = String::new();
   63     65   
    {
   64     66   
        let mut writer = ::aws_smithy_xml::encode::XmlWriter::new(&mut out);
   65     67   
        #[allow(unused_mut)]

tmp-codegen-diff/codegen-client-test/rest_xml/rust-client-codegen/src/protocol_serde/shape_timestamp_format_headers.rs

@@ -59,59 +165,179 @@
   79     79   
        output.build()
   80     80   
    })
   81     81   
}
   82     82   
   83     83   
pub fn ser_timestamp_format_headers_headers(
   84     84   
    input: &crate::operation::timestamp_format_headers::TimestampFormatHeadersInput,
   85     85   
    mut builder: ::http::request::Builder,
   86     86   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   87     87   
    if let ::std::option::Option::Some(inner_1) = &input.member_epoch_seconds {
   88     88   
        let formatted_2 = inner_1.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
          89  +
        if !formatted_2.is_empty() {
   89     90   
            let header_value = formatted_2;
   90     91   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   91     92   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   92     93   
                    "member_epoch_seconds",
   93     94   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   94     95   
                )
   95     96   
            })?;
   96     97   
            builder = builder.header("X-memberEpochSeconds", header_value);
   97     98   
        }
          99  +
    }
   98    100   
    if let ::std::option::Option::Some(inner_3) = &input.member_http_date {
   99    101   
        let formatted_4 = inner_3.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
         102  +
        if !formatted_4.is_empty() {
  100    103   
            let header_value = formatted_4;
  101    104   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  102    105   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  103    106   
                    "member_http_date",
  104    107   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  105    108   
                )
  106    109   
            })?;
  107    110   
            builder = builder.header("X-memberHttpDate", header_value);
  108    111   
        }
         112  +
    }
  109    113   
    if let ::std::option::Option::Some(inner_5) = &input.member_date_time {
  110    114   
        let formatted_6 = inner_5.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
         115  +
        if !formatted_6.is_empty() {
  111    116   
            let header_value = formatted_6;
  112    117   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  113    118   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  114    119   
                    "member_date_time",
  115    120   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  116    121   
                )
  117    122   
            })?;
  118    123   
            builder = builder.header("X-memberDateTime", header_value);
  119    124   
        }
         125  +
    }
  120    126   
    if let ::std::option::Option::Some(inner_7) = &input.default_format {
  121    127   
        let formatted_8 = inner_7.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
         128  +
        if !formatted_8.is_empty() {
  122    129   
            let header_value = formatted_8;
  123    130   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  124    131   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  125    132   
                    "default_format",
  126    133   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  127    134   
                )
  128    135   
            })?;
  129    136   
            builder = builder.header("X-defaultFormat", header_value);
  130    137   
        }
         138  +
    }
  131    139   
    if let ::std::option::Option::Some(inner_9) = &input.target_epoch_seconds {
  132    140   
        let formatted_10 = inner_9.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
         141  +
        if !formatted_10.is_empty() {
  133    142   
            let header_value = formatted_10;
  134    143   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  135    144   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  136    145   
                    "target_epoch_seconds",
  137    146   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  138    147   
                )
  139    148   
            })?;
  140    149   
            builder = builder.header("X-targetEpochSeconds", header_value);
  141    150   
        }
         151  +
    }
  142    152   
    if let ::std::option::Option::Some(inner_11) = &input.target_http_date {
  143    153   
        let formatted_12 = inner_11.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
         154  +
        if !formatted_12.is_empty() {
  144    155   
            let header_value = formatted_12;
  145    156   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  146    157   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  147    158   
                    "target_http_date",
  148    159   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  149    160   
                )
  150    161   
            })?;
  151    162   
            builder = builder.header("X-targetHttpDate", header_value);
  152    163   
        }
         164  +
    }
  153    165   
    if let ::std::option::Option::Some(inner_13) = &input.target_date_time {
  154    166   
        let formatted_14 = inner_13.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
         167  +
        if !formatted_14.is_empty() {
  155    168   
            let header_value = formatted_14;
  156    169   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
  157    170   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
  158    171   
                    "target_date_time",
  159    172   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
  160    173   
                )
  161    174   
            })?;
  162    175   
            builder = builder.header("X-targetDateTime", header_value);
  163    176   
        }
         177  +
    }
  164    178   
    Ok(builder)
  165    179   
}

tmp-codegen-diff/codegen-client-test/rest_xml_namespace/rust-client-codegen/src/protocol_serde/shape_simple_scalar_properties.rs

@@ -17,17 +85,87 @@
   37     37   
        output.build()
   38     38   
    })
   39     39   
}
   40     40   
   41     41   
pub fn ser_simple_scalar_properties_headers(
   42     42   
    input: &crate::operation::simple_scalar_properties::SimpleScalarPropertiesInput,
   43     43   
    mut builder: ::http::request::Builder,
   44     44   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   45     45   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
   46     46   
        let formatted_2 = inner_1.as_str();
          47  +
        if !formatted_2.is_empty() {
   47     48   
            let header_value = formatted_2;
   48     49   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   49     50   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   50     51   
                    "foo",
   51     52   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   52     53   
                )
   53     54   
            })?;
   54     55   
            builder = builder.header("X-Foo", header_value);
   55     56   
        }
          57  +
    }
   56     58   
    Ok(builder)
   57     59   
}
   58     60   
   59     61   
pub fn ser_simple_scalar_properties_op_input(
   60     62   
    input: &crate::operation::simple_scalar_properties::SimpleScalarPropertiesInput,
   61     63   
) -> Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   62     64   
    let mut out = String::new();
   63     65   
    {
   64     66   
        let mut writer = ::aws_smithy_xml::encode::XmlWriter::new(&mut out);
   65     67   
        #[allow(unused_mut)]

tmp-codegen-diff/codegen-client-test/rpcv2Cbor/rust-client-codegen/src/operation/empty_input_output.rs

@@ -150,150 +211,209 @@
  170    170   
                builder: ::http::request::Builder,
  171    171   
            ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
  172    172   
                let mut uri = ::std::string::String::new();
  173    173   
                uri_base(input, &mut uri)?;
  174    174   
                ::std::result::Result::Ok(builder.method("POST").uri(uri))
  175    175   
            }
  176    176   
            let mut builder = update_http_builder(&input, ::http::request::Builder::new())?;
  177    177   
            builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/cbor");
  178    178   
            builder =
  179    179   
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("smithy-protocol"), "rpc-v2-cbor");
  180         -
            builder =
  181         -
                _header_serialization_settings.set_default_header(builder, ::http::header::HeaderName::from_static("accept"), "application/cbor");
  182    180   
            builder
  183    181   
        };
  184    182   
        let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_empty_input_output::ser_empty_input_output_input(&input)?);
  185    183   
        if let Some(content_length) = body.content_length() {
  186    184   
            let content_length = content_length.to_string();
  187    185   
            request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length);
  188    186   
        }
  189    187   
        ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap())
  190    188   
    }
  191    189   
}
@@ -213,211 +277,271 @@
  233    231   
    #[::tokio::test]
  234    232   
    #[::tracing_test::traced_test]
  235    233   
    async fn empty_input_request() {
  236    234   
        let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
  237    235   
        let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
  238    236   
  239    237   
        let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
  240    238   
        let result = client.empty_input_output().send().await;
  241    239   
        let _ = dbg!(result);
  242    240   
        let http_request = request_receiver.expect_request();
  243         -
        let expected_headers = [
  244         -
            ("Accept", "application/cbor"),
  245         -
            ("Content-Type", "application/cbor"),
  246         -
            ("smithy-protocol", "rpc-v2-cbor"),
  247         -
        ];
         241  +
        let expected_headers = [("Content-Type", "application/cbor"), ("smithy-protocol", "rpc-v2-cbor")];
  248    242   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
  249    243   
        let forbidden_headers = &["X-Amz-Target"];
  250    244   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::forbid_headers(http_request.headers(), forbidden_headers));
  251    245   
        let required_headers = &["Content-Length"];
  252    246   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::require_headers(http_request.headers(), required_headers));
  253    247   
        let body = http_request.body().bytes().expect("body should be strict");
  254    248   
        ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
  255    249   
            body,
  256    250   
            "v/8=",
  257    251   
            ::aws_smithy_protocol_test::MediaType::from("application/cbor"),