27 27 | crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError,
|
28 28 | > {
|
29 29 | Ok({
|
30 30 | #[allow(unused_mut)]
|
31 31 | let mut output = crate::operation::null_and_empty_headers_client::builders::NullAndEmptyHeadersClientOutputBuilder::default();
|
32 32 | output = output.set_a(
|
33 33 | crate::protocol_serde::shape_null_and_empty_headers_client_output::de_a_header(_response_headers).map_err(|_| {
|
34 34 | crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::unhandled("Failed to parse a from header `X-A")
|
35 35 | })?,
|
36 36 | );
|
37 37 | output = output.set_b(
|
38 38 | crate::protocol_serde::shape_null_and_empty_headers_client_output::de_b_header(_response_headers).map_err(|_| {
|
39 39 | crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::unhandled("Failed to parse b from header `X-B")
|
40 40 | })?,
|
41 41 | );
|
42 42 | output = output.set_c(
|
43 43 | crate::protocol_serde::shape_null_and_empty_headers_client_output::de_c_header(_response_headers).map_err(|_| {
|
44 44 | crate::operation::null_and_empty_headers_client::NullAndEmptyHeadersClientError::unhandled("Failed to parse c from header `X-C")
|
45 45 | })?,
|
46 46 | );
|
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 | }
|