1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | #[allow(clippy::unnecessary_wraps)]
|
3 3 | pub async fn de_null_and_empty_headers_client_http_request<B>(
|
4 4 | #[allow(unused_variables)] request: ::http::Request<B>,
|
5 5 | ) -> std::result::Result<
|
6 6 | crate::input::NullAndEmptyHeadersClientInput,
|
7 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
7 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
8 8 | >
|
9 9 | where
|
10 - | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
11 11 | B::Data: Send,
|
12 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
13 - | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
12 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
13 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
14 14 | {
|
15 15 | Ok({
|
16 16 | #[allow(unused_mut)]
|
17 17 | let mut input =
|
18 18 | crate::input::null_and_empty_headers_client_input_internal::Builder::default();
|
19 19 | #[allow(unused_variables)]
|
20 20 | let ::aws_smithy_runtime_api::http::RequestParts {
|
21 21 | uri, headers, body, ..
|
22 22 | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
23 23 | if let Some(value) =
|
24 24 | crate::protocol_serde::shape_null_and_empty_headers_client_input::de_a_header(&headers)?
|
25 25 | {
|
26 26 | input = input.set_a(Some(value))
|
27 27 | }
|
28 28 | if let Some(value) =
|
29 29 | crate::protocol_serde::shape_null_and_empty_headers_client_input::de_b_header(&headers)?
|
30 30 | {
|
31 31 | input = input.set_b(Some(value))
|
32 32 | }
|
33 33 | if let Some(value) =
|
34 34 | crate::protocol_serde::shape_null_and_empty_headers_client_input::de_c_header(&headers)?
|
35 35 | {
|
36 36 | input = input.set_c(Some(value))
|
37 37 | }
|
38 38 | input.build()
|
39 39 | })
|
40 40 | }
|
41 41 |
|
42 42 | #[allow(clippy::unnecessary_wraps)]
|
43 43 | pub fn ser_null_and_empty_headers_client_http_response(
|
44 44 | #[allow(unused_variables)] output: crate::output::NullAndEmptyHeadersClientOutput,
|
45 45 | ) -> std::result::Result<
|
46 - | ::aws_smithy_http_server::response::Response,
|
47 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
46 + | ::aws_smithy_legacy_http_server::response::Response,
|
47 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
48 48 | > {
|
49 49 | Ok({
|
50 50 | #[allow(unused_mut)]
|
51 51 | let mut builder = ::http::Response::builder();
|
52 52 | builder = crate::protocol_serde::shape_null_and_empty_headers_client::ser_null_and_empty_headers_client_headers(&output, builder)?;
|
53 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
53 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
54 54 | builder,
|
55 55 | ::http::header::CONTENT_TYPE,
|
56 56 | "application/json",
|
57 57 | );
|
58 58 | let http_status: u16 = 200;
|
59 59 | builder = builder.status(http_status);
|
60 60 | let payload =
|
61 61 | crate::protocol_serde::shape_null_and_empty_headers_client_output::ser_null_and_empty_headers_client_output_output_output(&output)?
|
62 62 | ;
|
63 63 | let content_length = payload.len();
|
64 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
64 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
65 65 | builder,
|
66 66 | ::http::header::CONTENT_LENGTH,
|
67 67 | content_length,
|
68 68 | );
|
69 - | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
69 + | let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
|
70 70 | builder.body(body)?
|
71 71 | })
|
72 72 | }
|
73 73 |
|
74 74 | #[allow(clippy::unnecessary_wraps)]
|
75 75 | pub fn ser_null_and_empty_headers_client_http_error(
|
76 76 | error: &crate::error::NullAndEmptyHeadersClientError,
|
77 77 | ) -> std::result::Result<
|
78 - | ::aws_smithy_http_server::response::Response,
|
79 - | ::aws_smithy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
78 + | ::aws_smithy_legacy_http_server::response::Response,
|
79 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
80 80 | > {
|
81 81 | Ok({
|
82 82 | match error {
|
83 83 | crate::error::NullAndEmptyHeadersClientError::InternalServerError(output) => {
|
84 84 | let payload = crate::protocol_serde::shape_internal_server_error::ser_internal_server_error_error(output)?;
|
85 85 | #[allow(unused_mut)]
|
86 86 | let mut builder = ::http::Response::builder();
|
87 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
87 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
88 88 | builder,
|
89 89 | ::http::header::CONTENT_TYPE,
|
90 90 | "application/json",
|
91 91 | );
|
92 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
92 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
93 93 | builder,
|
94 94 | ::http::header::HeaderName::from_static("x-amzn-errortype"),
|
95 95 | "InternalServerError",
|
96 96 | );
|
97 97 | let content_length = payload.len();
|
98 - | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
98 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
99 99 | builder,
|
100 100 | ::http::header::CONTENT_LENGTH,
|
101 101 | content_length,
|
102 102 | );
|
103 103 | builder
|
104 104 | .status(500)
|
105 - | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
105 + | .body(::aws_smithy_legacy_http_server::body::to_boxed(payload))?
|
106 106 | }
|
107 107 | }
|
108 108 | })
|
109 109 | }
|
110 110 |
|
111 111 | pub fn ser_null_and_empty_headers_client_headers(
|
112 112 | input: &crate::output::NullAndEmptyHeadersClientOutput,
|
113 113 | mut builder: ::http::response::Builder,
|
114 114 | ) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
|
115 115 | {
|
116 116 | if let ::std::option::Option::Some(inner_1) = &input.a {
|
117 117 | let formatted_2 = inner_1.as_str();
|
118 118 | if !formatted_2.is_empty() {
|
119 119 | let header_value = formatted_2;
|
120 120 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
121 121 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
122 122 | "a",
|
123 123 | format!(
|
124 124 | "`{}` cannot be used as a header value: {}",
|
125 125 | &header_value, err
|
126 126 | ),
|
127 127 | )
|
128 128 | })?;
|
129 129 | builder = builder.header("X-A", header_value);
|
130 130 | }
|
131 131 | }
|
132 132 | if let ::std::option::Option::Some(inner_3) = &input.b {
|
133 133 | let formatted_4 = inner_3.as_str();
|
134 134 | if !formatted_4.is_empty() {
|
135 135 | let header_value = formatted_4;
|
136 136 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
137 137 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
138 138 | "b",
|
139 139 | format!(
|
140 140 | "`{}` cannot be used as a header value: {}",
|
141 141 | &header_value, err
|
142 142 | ),
|
143 143 | )
|
144 144 | })?;
|
145 145 | builder = builder.header("X-B", header_value);
|
146 146 | }
|
147 147 | }
|
148 148 | if let ::std::option::Option::Some(inner_5) = &input.c {
|
149 149 | for inner_6 in inner_5 {
|
150 - | let formatted_7 = ::aws_smithy_http::header::quote_header_value(inner_6.as_str());
|
150 + | let formatted_7 =
|
151 + | ::aws_smithy_legacy_http::header::quote_header_value(inner_6.as_str());
|
151 152 | if !formatted_7.is_empty() {
|
152 153 | let header_value = formatted_7;
|
153 154 | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
154 155 | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
155 156 | "c",
|
156 157 | format!(
|
157 158 | "`{}` cannot be used as a header value: {}",
|
158 159 | &header_value, err
|
159 160 | ),
|
160 161 | )
|