Client Test

Client Test

rev. a25ccedd311e7562a03a1cd07d728cef10c9474c (ignoring whitespace)

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  +
        if !formatted_2.is_empty() {
   35     36   
            let header_value = formatted_2;
   36     37   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   37     38   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   38     39   
                    "integer_in_header",
   39     40   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   40     41   
                )
   41     42   
            })?;
   42     43   
            builder = builder.header("integerInHeader", header_value);
   43     44   
        }
          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)?;
   53     55   
    object.finish();

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  +
        if !formatted_2.is_empty() {
   35     36   
            let header_value = formatted_2;
   36     37   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   37     38   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   38     39   
                    "long_in_header",
   39     40   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   40     41   
                )
   41     42   
            })?;
   42     43   
            builder = builder.header("longInHeader", header_value);
   43     44   
        }
          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)?;
   53     55   
    object.finish();

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  +
        if !formatted_2.is_empty() {
   35     36   
            let header_value = formatted_2;
   36     37   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   37     38   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   38     39   
                    "short_in_header",
   39     40   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   40     41   
                )
   41     42   
            })?;
   42     43   
            builder = builder.header("shortInHeader", header_value);
   43     44   
        }
          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)?;
   53     55   
    object.finish();

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  +
        if !formatted_2.is_empty() {
   34     35   
            let header_value = formatted_2;
   35     36   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   36     37   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   37     38   
                    "blob",
   38     39   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   39     40   
                )
   40     41   
            })?;
   41     42   
            builder = builder.header("amz-media-typed-header", header_value);
   42     43   
        }
          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  +
        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   
                    "timestamp",
   44     45   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   45     46   
                )
   46     47   
            })?;
   47     48   
            builder = builder.header("timestamp", header_value);
   48     49   
        }
          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  +
        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   
                    "timestamp",
   44     45   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   45     46   
                )
   46     47   
            })?;
   47     48   
            builder = builder.header("timestamp", header_value);
   48     49   
        }
          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  +
        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   
                    "timestamp",
   44     45   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   45     46   
                )
   46     47   
            })?;
   47     48   
            builder = builder.header("timestamp", header_value);
   48     49   
        }
          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  +
        if !formatted_2.is_empty() {
   38     39   
            let header_value = formatted_2;
   39     40   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   40     41   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   41     42   
                    "json",
   42     43   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   43     44   
                )
   44     45   
            })?;
   45     46   
            builder = builder.header("X-Json", header_value);
   46     47   
        }
          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  +
        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_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  +
        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_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  +
        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_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)?;
   58     60   
    object.finish();

tmp-codegen-diff/codegen-client-test/rest_json/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_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)?;
   65     67   
    object.finish();

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  +
        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   
    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  +
        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   
                    "foo",
   44     45   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   45     46   
                )
   46     47   
            })?;
   47     48   
            builder = builder.header("X-Foo", header_value);
   48     49   
        }
          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  +
        if !formatted_2.is_empty() {
   54     55   
            let header_value = formatted_2;
   55     56   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   56     57   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   57     58   
                    "foo",
   58     59   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   59     60   
                )
   60     61   
            })?;
   61     62   
            builder = builder.header("X-Foo", header_value);
   62     63   
        }
          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 +81,83 @@
   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  +
        if !formatted_2.is_empty() {
   43     44   
            let header_value = formatted_2;
   44     45   
            let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
   45     46   
                ::aws_smithy_types::error::operation::BuildError::invalid_field(
   46     47   
                    "test_id",
   47     48   
                    format!("`{}` cannot be used as a header value: {}", &header_value, err),
   48     49   
                )
   49     50   
            })?;
   50     51   
            builder = builder.header("x-amz-test-id", header_value);
   51     52   
        }
          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)?;
   61     63   
    object.finish();