Client Test

Client Test

rev. 000b37a512bd3be1a17b4f3d5bf60e5446dbc2dd

Files changed:

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

@@ -5,5 +55,57 @@
   25     25   
    })
   26     26   
}
   27     27   
   28     28   
pub fn ser_malformed_integer_headers(
   29     29   
    input: &crate::operation::malformed_integer::MalformedIntegerInput,
   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.integer_in_header {
   33     33   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_1);
   34     34   
        let formatted_2 = encoder.encode();
   35         -
        let header_value = formatted_2;
   36         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   37         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   38         -
                "integer_in_header",
   39         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   40         -
            )
   41         -
        })?;
   42         -
        builder = builder.header("integerInHeader", header_value);
          35  +
        if !formatted_2.is_empty() {
          36  +
            let header_value = formatted_2;
          37  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          38  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          39  +
                    "integer_in_header",
          40  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          41  +
                )
          42  +
            })?;
          43  +
            builder = builder.header("integerInHeader", header_value);
          44  +
        }
   43     45   
    }
   44     46   
    Ok(builder)
   45     47   
}
   46     48   
   47     49   
pub fn ser_malformed_integer_input(
   48     50   
    input: &crate::operation::malformed_integer::MalformedIntegerInput,
   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_integer_input::ser_malformed_integer_input_input(&mut object, input)?;

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

@@ -5,5 +55,57 @@
   25     25   
    })
   26     26   
}
   27     27   
   28     28   
pub fn ser_malformed_long_headers(
   29     29   
    input: &crate::operation::malformed_long::MalformedLongInput,
   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.long_in_header {
   33     33   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_1);
   34     34   
        let formatted_2 = encoder.encode();
   35         -
        let header_value = formatted_2;
   36         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   37         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   38         -
                "long_in_header",
   39         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   40         -
            )
   41         -
        })?;
   42         -
        builder = builder.header("longInHeader", header_value);
          35  +
        if !formatted_2.is_empty() {
          36  +
            let header_value = formatted_2;
          37  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          38  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          39  +
                    "long_in_header",
          40  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          41  +
                )
          42  +
            })?;
          43  +
            builder = builder.header("longInHeader", header_value);
          44  +
        }
   43     45   
    }
   44     46   
    Ok(builder)
   45     47   
}
   46     48   
   47     49   
pub fn ser_malformed_long_input(
   48     50   
    input: &crate::operation::malformed_long::MalformedLongInput,
   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_long_input::ser_malformed_long_input_input(&mut object, input)?;

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

@@ -5,5 +55,57 @@
   25     25   
    })
   26     26   
}
   27     27   
   28     28   
pub fn ser_malformed_short_headers(
   29     29   
    input: &crate::operation::malformed_short::MalformedShortInput,
   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.short_in_header {
   33     33   
        let mut encoder = ::aws_smithy_types::primitive::Encoder::from(*inner_1);
   34     34   
        let formatted_2 = encoder.encode();
   35         -
        let header_value = formatted_2;
   36         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   37         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   38         -
                "short_in_header",
   39         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   40         -
            )
   41         -
        })?;
   42         -
        builder = builder.header("shortInHeader", header_value);
          35  +
        if !formatted_2.is_empty() {
          36  +
            let header_value = formatted_2;
          37  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          38  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          39  +
                    "short_in_header",
          40  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          41  +
                )
          42  +
            })?;
          43  +
            builder = builder.header("shortInHeader", header_value);
          44  +
        }
   43     45   
    }
   44     46   
    Ok(builder)
   45     47   
}
   46     48   
   47     49   
pub fn ser_malformed_short_input(
   48     50   
    input: &crate::operation::malformed_short::MalformedShortInput,
   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_short_input::ser_malformed_short_input_input(&mut object, input)?;

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

@@ -4,4 +44,46 @@
   24     24   
        output.build()
   25     25   
    })
   26     26   
}
   27     27   
   28     28   
pub fn ser_malformed_string_headers(
   29     29   
    input: &crate::operation::malformed_string::MalformedStringInput,
   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.blob {
   33     33   
        let formatted_2 = ::aws_smithy_types::base64::encode(inner_1);
   34         -
        let header_value = formatted_2;
   35         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   36         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   37         -
                "blob",
   38         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   39         -
            )
   40         -
        })?;
   41         -
        builder = builder.header("amz-media-typed-header", header_value);
          34  +
        if !formatted_2.is_empty() {
          35  +
            let header_value = formatted_2;
          36  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          37  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          38  +
                    "blob",
          39  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          40  +
                )
          41  +
            })?;
          42  +
            builder = builder.header("amz-media-typed-header", header_value);
          43  +
        }
   42     44   
    }
   43     45   
    Ok(builder)
   44     46   
}

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

@@ -10,10 +50,52 @@
   30     30   
        output.build()
   31     31   
    })
   32     32   
}
   33     33   
   34     34   
pub fn ser_malformed_timestamp_header_date_time_headers(
   35     35   
    input: &crate::operation::malformed_timestamp_header_date_time::MalformedTimestampHeaderDateTimeInput,
   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.timestamp {
   39     39   
        let formatted_2 = inner_1.fmt(::aws_smithy_types::date_time::Format::DateTime)?;
   40         -
        let header_value = formatted_2;
   41         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   42         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   43         -
                "timestamp",
   44         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   45         -
            )
   46         -
        })?;
   47         -
        builder = builder.header("timestamp", header_value);
          40  +
        if !formatted_2.is_empty() {
          41  +
            let header_value = formatted_2;
          42  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          43  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          44  +
                    "timestamp",
          45  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          46  +
                )
          47  +
            })?;
          48  +
            builder = builder.header("timestamp", header_value);
          49  +
        }
   48     50   
    }
   49     51   
    Ok(builder)
   50     52   
}

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

@@ -10,10 +50,52 @@
   30     30   
        output.build()
   31     31   
    })
   32     32   
}
   33     33   
   34     34   
pub fn ser_malformed_timestamp_header_default_headers(
   35     35   
    input: &crate::operation::malformed_timestamp_header_default::MalformedTimestampHeaderDefaultInput,
   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.timestamp {
   39     39   
        let formatted_2 = inner_1.fmt(::aws_smithy_types::date_time::Format::HttpDate)?;
   40         -
        let header_value = formatted_2;
   41         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   42         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   43         -
                "timestamp",
   44         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   45         -
            )
   46         -
        })?;
   47         -
        builder = builder.header("timestamp", header_value);
          40  +
        if !formatted_2.is_empty() {
          41  +
            let header_value = formatted_2;
          42  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          43  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          44  +
                    "timestamp",
          45  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          46  +
                )
          47  +
            })?;
          48  +
            builder = builder.header("timestamp", header_value);
          49  +
        }
   48     50   
    }
   49     51   
    Ok(builder)
   50     52   
}

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

@@ -10,10 +50,52 @@
   30     30   
        output.build()
   31     31   
    })
   32     32   
}
   33     33   
   34     34   
pub fn ser_malformed_timestamp_header_epoch_headers(
   35     35   
    input: &crate::operation::malformed_timestamp_header_epoch::MalformedTimestampHeaderEpochInput,
   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.timestamp {
   39     39   
        let formatted_2 = inner_1.fmt(::aws_smithy_types::date_time::Format::EpochSeconds)?;
   40         -
        let header_value = formatted_2;
   41         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   42         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   43         -
                "timestamp",
   44         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   45         -
            )
   46         -
        })?;
   47         -
        builder = builder.header("timestamp", header_value);
          40  +
        if !formatted_2.is_empty() {
          41  +
            let header_value = formatted_2;
          42  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          43  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          44  +
                    "timestamp",
          45  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          46  +
                )
          47  +
            })?;
          48  +
            builder = builder.header("timestamp", header_value);
          49  +
        }
   48     50   
    }
   49     51   
    Ok(builder)
   50     52   
}

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

@@ -8,8 +48,50 @@
   28     28   
        output.build()
   29     29   
    })
   30     30   
}
   31     31   
   32     32   
pub fn ser_media_type_header_headers(
   33     33   
    input: &crate::operation::media_type_header::MediaTypeHeaderInput,
   34     34   
    mut builder: ::http::request::Builder,
   35     35   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   36     36   
    if let ::std::option::Option::Some(inner_1) = &input.json {
   37     37   
        let formatted_2 = ::aws_smithy_types::base64::encode(inner_1);
   38         -
        let header_value = formatted_2;
   39         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   40         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   41         -
                "json",
   42         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   43         -
            )
   44         -
        })?;
   45         -
        builder = builder.header("X-Json", header_value);
          38  +
        if !formatted_2.is_empty() {
          39  +
            let header_value = formatted_2;
          40  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          41  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          42  +
                    "json",
          43  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          44  +
                )
          45  +
            })?;
          46  +
            builder = builder.header("X-Json", header_value);
          47  +
        }
   46     48   
    }
   47     49   
    Ok(builder)
   48     50   
}

tmp-codegen-diff/codegen-client-test/rest_json/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         -
        let header_value = formatted_2;
   58         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   59         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   60         -
                "a",
   61         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   62         -
            )
   63         -
        })?;
   64         -
        builder = builder.header("X-A", header_value);
          57  +
        if !formatted_2.is_empty() {
          58  +
            let header_value = formatted_2;
          59  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          60  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          61  +
                    "a",
          62  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          63  +
                )
          64  +
            })?;
          65  +
            builder = builder.header("X-A", header_value);
          66  +
        }
   65     67   
    }
   66     68   
    if let ::std::option::Option::Some(inner_3) = &input.b {
   67     69   
        let formatted_4 = inner_3.as_str();
   68         -
        let header_value = formatted_4;
   69         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   70         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   71         -
                "b",
   72         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   73         -
            )
   74         -
        })?;
   75         -
        builder = builder.header("X-B", header_value);
          70  +
        if !formatted_4.is_empty() {
          71  +
            let header_value = formatted_4;
          72  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          73  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          74  +
                    "b",
          75  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          76  +
                )
          77  +
            })?;
          78  +
            builder = builder.header("X-B", header_value);
          79  +
        }
   76     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         -
            for inner_6 in inner_5 {
   83         -
                let formatted_7 = ::aws_smithy_http::header::quote_header_value(inner_6.as_str());
          82  +
        for inner_6 in inner_5 {
          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_json/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         -
        let header_value = formatted_2;
   58         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   59         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   60         -
                "a",
   61         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   62         -
            )
   63         -
        })?;
   64         -
        builder = builder.header("X-A", header_value);
          57  +
        if !formatted_2.is_empty() {
          58  +
            let header_value = formatted_2;
          59  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          60  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          61  +
                    "a",
          62  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          63  +
                )
          64  +
            })?;
          65  +
            builder = builder.header("X-A", header_value);
          66  +
        }
   65     67   
    }
   66     68   
    if let ::std::option::Option::Some(inner_3) = &input.b {
   67     69   
        let formatted_4 = inner_3.as_str();
   68         -
        let header_value = formatted_4;
   69         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   70         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   71         -
                "b",
   72         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   73         -
            )
   74         -
        })?;
   75         -
        builder = builder.header("X-B", header_value);
          70  +
        if !formatted_4.is_empty() {
          71  +
            let header_value = formatted_4;
          72  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          73  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          74  +
                    "b",
          75  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          76  +
                )
          77  +
            })?;
          78  +
            builder = builder.header("X-B", header_value);
          79  +
        }
   76     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         -
            for inner_6 in inner_5 {
   83         -
                let formatted_7 = ::aws_smithy_http::header::quote_header_value(inner_6.as_str());
          82  +
        for inner_6 in inner_5 {
          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_json/rust-client-codegen/src/protocol_serde/shape_put_with_content_encoding.rs

@@ -10,10 +60,62 @@
   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         -
        let header_value = formatted_2;
   41         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   42         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   43         -
                "encoding",
   44         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   45         -
            )
   46         -
        })?;
   47         -
        builder = builder.header("Content-Encoding", header_value);
          40  +
        if !formatted_2.is_empty() {
          41  +
            let header_value = formatted_2;
          42  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          43  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          44  +
                    "encoding",
          45  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          46  +
                )
          47  +
            })?;
          48  +
            builder = builder.header("Content-Encoding", header_value);
          49  +
        }
   48     50   
    }
   49     51   
    Ok(builder)
   50     52   
}
   51     53   
   52     54   
pub fn ser_put_with_content_encoding_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   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   57     59   
    crate::protocol_serde::shape_put_with_content_encoding_input::ser_put_with_content_encoding_input_input(&mut object, input)?;

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

@@ -17,17 +84,86 @@
   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         -
        let header_value = formatted_2;
   48         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   49         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   50         -
                "foo",
   51         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   52         -
            )
   53         -
        })?;
   54         -
        builder = builder.header("X-Foo", header_value);
          47  +
        if !formatted_2.is_empty() {
          48  +
            let header_value = formatted_2;
          49  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          50  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          51  +
                    "foo",
          52  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          53  +
                )
          54  +
            })?;
          55  +
            builder = builder.header("X-Foo", header_value);
          56  +
        }
   55     57   
    }
   56     58   
    Ok(builder)
   57     59   
}
   58     60   
   59     61   
pub fn ser_simple_scalar_properties_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   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   64     66   
    crate::protocol_serde::shape_simple_scalar_properties_input::ser_simple_scalar_properties_input_input(&mut object, input)?;

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

@@ -15,15 +55,57 @@
   35     35   
    let generic = generic_builder.build();
   36     36   
    Err(crate::operation::streaming_traits::StreamingTraitsError::generic(generic))
   37     37   
}
   38     38   
   39     39   
pub fn ser_streaming_traits_headers(
   40     40   
    input: &crate::operation::streaming_traits::StreamingTraitsInput,
   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         -
        let header_value = formatted_2;
   46         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   47         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   48         -
                "foo",
   49         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   50         -
            )
   51         -
        })?;
   52         -
        builder = builder.header("X-Foo", header_value);
          45  +
        if !formatted_2.is_empty() {
          46  +
            let header_value = formatted_2;
          47  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          48  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          49  +
                    "foo",
          50  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          51  +
                )
          52  +
            })?;
          53  +
            builder = builder.header("X-Foo", header_value);
          54  +
        }
   53     55   
    }
   54     56   
    Ok(builder)
   55     57   
}

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

@@ -10,10 +50,52 @@
   30     30   
        output.build()
   31     31   
    })
   32     32   
}
   33     33   
   34     34   
pub fn ser_streaming_traits_require_length_headers(
   35     35   
    input: &crate::operation::streaming_traits_require_length::StreamingTraitsRequireLengthInput,
   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.foo {
   39     39   
        let formatted_2 = inner_1.as_str();
   40         -
        let header_value = formatted_2;
   41         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   42         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   43         -
                "foo",
   44         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   45         -
            )
   46         -
        })?;
   47         -
        builder = builder.header("X-Foo", header_value);
          40  +
        if !formatted_2.is_empty() {
          41  +
            let header_value = formatted_2;
          42  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          43  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          44  +
                    "foo",
          45  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          46  +
                )
          47  +
            })?;
          48  +
            builder = builder.header("X-Foo", header_value);
          49  +
        }
   48     50   
    }
   49     51   
    Ok(builder)
   50     52   
}

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

@@ -24,24 +64,66 @@
   44     44   
    let generic = generic_builder.build();
   45     45   
    Err(crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeError::generic(generic))
   46     46   
}
   47     47   
   48     48   
pub fn ser_streaming_traits_with_media_type_headers(
   49     49   
    input: &crate::operation::streaming_traits_with_media_type::StreamingTraitsWithMediaTypeInput,
   50     50   
    mut builder: ::http::request::Builder,
   51     51   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   52     52   
    if let ::std::option::Option::Some(inner_1) = &input.foo {
   53     53   
        let formatted_2 = inner_1.as_str();
   54         -
        let header_value = formatted_2;
   55         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   56         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   57         -
                "foo",
   58         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   59         -
            )
   60         -
        })?;
   61         -
        builder = builder.header("X-Foo", header_value);
          54  +
        if !formatted_2.is_empty() {
          55  +
            let header_value = formatted_2;
          56  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          57  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          58  +
                    "foo",
          59  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          60  +
                )
          61  +
            })?;
          62  +
            builder = builder.header("X-Foo", header_value);
          63  +
        }
   62     64   
    }
   63     65   
    Ok(builder)
   64     66   
}

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

@@ -13,13 +80,82 @@
   33     33   
        output.build()
   34     34   
    })
   35     35   
}
   36     36   
   37     37   
pub fn ser_test_body_structure_headers(
   38     38   
    input: &crate::operation::test_body_structure::TestBodyStructureInput,
   39     39   
    mut builder: ::http::request::Builder,
   40     40   
) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> {
   41     41   
    if let ::std::option::Option::Some(inner_1) = &input.test_id {
   42     42   
        let formatted_2 = inner_1.as_str();
   43         -
        let header_value = formatted_2;
   44         -
        let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   45         -
            ::aws_smithy_types::error::operation::BuildError::invalid_field(
   46         -
                "test_id",
   47         -
                format!("`{}` cannot be used as a header value: {}", &header_value, err),
   48         -
            )
   49         -
        })?;
   50         -
        builder = builder.header("x-amz-test-id", header_value);
          43  +
        if !formatted_2.is_empty() {
          44  +
            let header_value = formatted_2;
          45  +
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
          46  +
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
          47  +
                    "test_id",
          48  +
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
          49  +
                )
          50  +
            })?;
          51  +
            builder = builder.header("x-amz-test-id", header_value);
          52  +
        }
   51     53   
    }
   52     54   
    Ok(builder)
   53     55   
}
   54     56   
   55     57   
pub fn ser_test_body_structure_input(
   56     58   
    input: &crate::operation::test_body_structure::TestBodyStructureInput,
   57     59   
) -> Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> {
   58     60   
    let mut out = String::new();
   59     61   
    let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out);
   60     62   
    crate::protocol_serde::shape_test_body_structure_input::ser_test_body_structure_input_input(&mut object, input)?;