1 + | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 + | /* RustType.kt:534 */
|
3 + | #[allow(clippy::unnecessary_wraps)]
|
4 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
5 + | pub async fn de_http_empty_prefix_headers_http_request<B>(
|
6 + | #[allow(unused_variables)] request: ::http::Request<B>,
|
7 + | ) -> std::result::Result<
|
8 + | crate::input::HttpEmptyPrefixHeadersInput,
|
9 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection,
|
10 + | >
|
11 + | where
|
12 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
13 + | B::Data: Send,
|
14 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
15 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
16 + | {
|
17 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
18 + | Ok({
|
19 + | /* RustType.kt:534 */
|
20 + | #[allow(unused_mut)]
|
21 + | /* ServerHttpBoundProtocolGenerator.kt:759 */
|
22 + | let mut input = crate::input::http_empty_prefix_headers_input::Builder::default();
|
23 + | /* RustType.kt:534 */
|
24 + | #[allow(unused_variables)]
|
25 + | /* ServerHttpBoundProtocolGenerator.kt:764 */
|
26 + | let ::aws_smithy_runtime_api::http::RequestParts {
|
27 + | uri, headers, body, ..
|
28 + | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
29 + | /* ServerHttpBoundProtocolGenerator.kt:856 */
|
30 + | if let Some(value) = crate::protocol_serde::shape_http_empty_prefix_headers_input::de_prefix_headers_prefix_header(&headers)? {
|
31 + | input = input.set_prefix_headers(Some(value))
|
32 + | }
|
33 + | /* ServerHttpBoundProtocolGenerator.kt:856 */
|
34 + | if let Some(value) =
|
35 + | crate::protocol_serde::shape_http_empty_prefix_headers_input::de_specific_header_header(
|
36 + | &headers,
|
37 + | )?
|
38 + | {
|
39 + | input = input.set_specific_header(Some(value))
|
40 + | }
|
41 + | /* ServerHttpBoundProtocolGenerator.kt:896 */
|
42 + | input.build()
|
43 + | /* ServerHttpBoundProtocolGenerator.kt:424 */
|
44 + | })
|
45 + | /* ServerHttpBoundProtocolGenerator.kt:408 */
|
46 + | }
|
47 + |
|
48 + | /* RustType.kt:534 */
|
49 + | #[allow(clippy::unnecessary_wraps)]
|
50 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
51 + | pub fn ser_http_empty_prefix_headers_http_response(
|
52 + | #[allow(unused_variables)] output: crate::output::HttpEmptyPrefixHeadersOutput,
|
53 + | ) -> std::result::Result<
|
54 + | ::aws_smithy_legacy_http_server::response::Response,
|
55 + | ::aws_smithy_legacy_http_server::protocol::rest_json_1::rejection::ResponseRejection,
|
56 + | > {
|
57 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
58 + | Ok({
|
59 + | /* RustType.kt:534 */
|
60 + | #[allow(unused_mut)]
|
61 + | /* ServerHttpBoundProtocolGenerator.kt:547 */
|
62 + | let mut builder = ::http::Response::builder();
|
63 + | /* ServerHttpBoundProtocolGenerator.kt:665 */
|
64 + | builder = crate::protocol_serde::shape_http_empty_prefix_headers::ser_http_empty_prefix_headers_headers(&output, builder)?;
|
65 + | /* ServerHttpBoundProtocolGenerator.kt:633 */
|
66 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
67 + | builder,
|
68 + | ::http::header::CONTENT_TYPE,
|
69 + | "application/json",
|
70 + | );
|
71 + | /* ServerHttpBoundProtocolGenerator.kt:718 */
|
72 + | let http_status: u16 = 200;
|
73 + | builder = builder.status(http_status);
|
74 + | /* ServerHttpBoundProtocolGenerator.kt:597 */
|
75 + | let payload =
|
76 + | /* HttpBoundProtocolPayloadGenerator.kt:235 */crate::protocol_serde::shape_http_empty_prefix_headers_output::ser_http_empty_prefix_headers_output_output_output(&output)?
|
77 + | /* ServerHttpBoundProtocolGenerator.kt:597 */;
|
78 + | /* ServerHttpBoundProtocolGenerator.kt:699 */
|
79 + | let content_length = payload.len();
|
80 + | builder = ::aws_smithy_legacy_http::header::set_response_header_if_absent(
|
81 + | builder,
|
82 + | ::http::header::CONTENT_LENGTH,
|
83 + | content_length,
|
84 + | );
|
85 + | /* ServerHttpBoundProtocolGenerator.kt:603 */
|
86 + | let body = ::aws_smithy_legacy_http_server::body::to_boxed(payload);
|
87 + | /* ServerHttpBoundProtocolGenerator.kt:611 */
|
88 + | builder.body(body)?
|
89 + | /* ServerHttpBoundProtocolGenerator.kt:457 */
|
90 + | })
|
91 + | /* ServerHttpBoundProtocolGenerator.kt:445 */
|
92 + | }
|
93 + |
|
94 + | /* HttpBindingGenerator.kt:565 */
|
95 + | pub fn ser_http_empty_prefix_headers_headers(
|
96 + | input: &crate::output::HttpEmptyPrefixHeadersOutput,
|
97 + | mut builder: ::http::response::Builder,
|
98 + | ) -> std::result::Result<::http::response::Builder, ::aws_smithy_types::error::operation::BuildError>
|
99 + | {
|
100 + | /* HttpBindingGenerator.kt:615 */
|
101 + | if let ::std::option::Option::Some(inner_1) = &input.specific_header {
|
102 + | /* HttpBindingGenerator.kt:727 */
|
103 + | let formatted_2 = inner_1.as_str();
|
104 + | /* HttpBindingGenerator.kt:728 */
|
105 + | if !formatted_2.is_empty() {
|
106 + | /* HttpBindingGenerator.kt:729 */
|
107 + | let header_value = formatted_2;
|
108 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
109 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
110 + | "specific_header",
|
111 + | format!(
|
112 + | "`{}` cannot be used as a header value: {}",
|
113 + | &header_value, err
|
114 + | ),
|
115 + | )
|
116 + | })?;
|
117 + | builder = builder.header("hello", header_value);
|
118 + | /* HttpBindingGenerator.kt:728 */
|
119 + | }
|
120 + | /* HttpBindingGenerator.kt:615 */
|
121 + | }
|
122 + | /* HttpBindingGenerator.kt:764 */
|
123 + | if let ::std::option::Option::Some(inner_3) = &input.prefix_headers {
|
124 + | /* HttpBindingGenerator.kt:764 */
|
125 + | {
|
126 + | /* HttpBindingGenerator.kt:770 */
|
127 + | for (k, v) in inner_3 {
|
128 + | use std::str::FromStr;
|
129 + | let header_name =
|
130 + | ::http::HeaderName::from_str(&format!("{}{}", "", &k)).map_err(|err| {
|
131 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
132 + | "prefix_headers",
|
133 + | format!("`{k}` cannot be used as a header name: {err}"),
|
134 + | )
|
135 + | })?;
|
136 + | let header_value = v.as_str();
|
137 + | let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| {
|
138 + | ::aws_smithy_types::error::operation::BuildError::invalid_field(
|
139 + | "prefix_headers",
|
140 + | format!("`{v}` cannot be used as a header value: {err}"),
|
141 + | )
|
142 + | })?;
|
143 + | builder = builder.header(header_name, header_value);
|
144 + | }
|
145 + | /* HttpBindingGenerator.kt:764 */
|
146 + | }
|
147 + | /* HttpBindingGenerator.kt:764 */
|
148 + | }
|
149 + | /* HttpBindingGenerator.kt:578 */
|
150 + | Ok(builder)
|
151 + | /* HttpBindingGenerator.kt:565 */
|
152 + | }
|