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_greeting_with_errors_http_request<B>(
|
4 - | #[allow(unused_variables)] request: ::http::Request<B>,
|
4 + | #[allow(unused_variables)] request: ::http_1x::Request<B>,
|
5 5 | ) -> std::result::Result<
|
6 6 | crate::input::GreetingWithErrorsInput,
|
7 7 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection,
|
8 8 | >
|
9 9 | where
|
10 10 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
11 11 | B::Data: Send,
|
12 12 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
13 13 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
14 14 | {
|
15 15 | Ok({
|
16 16 | #[allow(unused_mut)]
|
17 17 | let mut input = crate::input::greeting_with_errors_input::Builder::default();
|
18 18 | #[allow(unused_variables)]
|
19 19 | let ::aws_smithy_runtime_api::http::RequestParts {
|
20 20 | uri, headers, body, ..
|
21 21 | } = ::aws_smithy_runtime_api::http::Request::try_from(request)?.into_parts();
|
22 - | let bytes = ::hyper::body::to_bytes(body).await?;
|
22 + | let bytes = {
|
23 + | use ::http_body_util::BodyExt;
|
24 + | body.collect().await?.to_bytes()
|
25 + | };
|
23 26 | if !bytes.is_empty() {
|
24 27 | ::aws_smithy_http_server::protocol::content_type_header_classifier_smithy(
|
25 28 | &headers,
|
26 29 | Some("application/x-amz-json-1.0"),
|
27 30 | )?;
|
28 31 | input = crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors(
|
29 32 | bytes.as_ref(),
|
30 33 | input,
|
31 34 | )?;
|
32 35 | }
|
33 36 | input.build()
|
34 37 | })
|
35 38 | }
|
36 39 |
|
37 40 | #[allow(clippy::unnecessary_wraps)]
|
38 41 | pub fn ser_greeting_with_errors_http_response(
|
39 42 | #[allow(unused_variables)] output: crate::output::GreetingWithErrorsOutput,
|
40 43 | ) -> std::result::Result<
|
41 44 | ::aws_smithy_http_server::response::Response,
|
42 45 | ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
|
43 46 | > {
|
44 47 | Ok({
|
45 48 | #[allow(unused_mut)]
|
46 - | let mut builder = ::http::Response::builder();
|
49 + | let mut builder = ::http_1x::Response::builder();
|
47 50 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
48 51 | builder,
|
49 - | ::http::header::CONTENT_TYPE,
|
52 + | ::http_1x::header::CONTENT_TYPE,
|
50 53 | "application/x-amz-json-1.0",
|
51 54 | );
|
52 55 | let http_status: u16 = 200;
|
53 56 | builder = builder.status(http_status);
|
54 57 | let payload =
|
55 58 | crate::protocol_serde::shape_greeting_with_errors_output::ser_greeting_with_errors_output_output_output(&output)?
|
56 59 | ;
|
57 60 | let content_length = payload.len();
|
58 61 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
59 62 | builder,
|
60 - | ::http::header::CONTENT_LENGTH,
|
63 + | ::http_1x::header::CONTENT_LENGTH,
|
61 64 | content_length,
|
62 65 | );
|
63 66 | let body = ::aws_smithy_http_server::body::to_boxed(payload);
|
64 67 | builder.body(body)?
|
65 68 | })
|
66 69 | }
|
67 70 |
|
68 71 | #[allow(clippy::unnecessary_wraps)]
|
69 72 | pub fn ser_greeting_with_errors_http_error(
|
70 73 | error: &crate::error::GreetingWithErrorsError,
|
71 74 | ) -> std::result::Result<
|
72 75 | ::aws_smithy_http_server::response::Response,
|
73 76 | ::aws_smithy_http_server::protocol::aws_json::rejection::ResponseRejection,
|
74 77 | > {
|
75 78 | Ok({
|
76 79 | match error {
|
77 80 | crate::error::GreetingWithErrorsError::InvalidGreeting(output) => {
|
78 81 | let payload =
|
79 82 | crate::protocol_serde::shape_invalid_greeting::ser_invalid_greeting_error(
|
80 83 | output,
|
81 84 | )?;
|
82 85 | #[allow(unused_mut)]
|
83 - | let mut builder = ::http::Response::builder();
|
86 + | let mut builder = ::http_1x::Response::builder();
|
84 87 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
85 88 | builder,
|
86 - | ::http::header::CONTENT_TYPE,
|
89 + | ::http_1x::header::CONTENT_TYPE,
|
87 90 | "application/x-amz-json-1.0",
|
88 91 | );
|
89 92 | let content_length = payload.len();
|
90 93 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
91 94 | builder,
|
92 - | ::http::header::CONTENT_LENGTH,
|
95 + | ::http_1x::header::CONTENT_LENGTH,
|
93 96 | content_length,
|
94 97 | );
|
95 98 | builder
|
96 99 | .status(400)
|
97 100 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
98 101 | }
|
99 102 | crate::error::GreetingWithErrorsError::ComplexError(output) => {
|
100 103 | let payload =
|
101 104 | crate::protocol_serde::shape_complex_error::ser_complex_error_error(output)?;
|
102 105 | #[allow(unused_mut)]
|
103 - | let mut builder = ::http::Response::builder();
|
106 + | let mut builder = ::http_1x::Response::builder();
|
104 107 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
105 108 | builder,
|
106 - | ::http::header::CONTENT_TYPE,
|
109 + | ::http_1x::header::CONTENT_TYPE,
|
107 110 | "application/x-amz-json-1.0",
|
108 111 | );
|
109 112 | let content_length = payload.len();
|
110 113 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
111 114 | builder,
|
112 - | ::http::header::CONTENT_LENGTH,
|
115 + | ::http_1x::header::CONTENT_LENGTH,
|
113 116 | content_length,
|
114 117 | );
|
115 118 | builder
|
116 119 | .status(400)
|
117 120 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
118 121 | }
|
119 122 | crate::error::GreetingWithErrorsError::FooError(output) => {
|
120 123 | let payload = crate::protocol_serde::shape_foo_error::ser_foo_error_error(output)?;
|
121 124 | #[allow(unused_mut)]
|
122 - | let mut builder = ::http::Response::builder();
|
125 + | let mut builder = ::http_1x::Response::builder();
|
123 126 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
124 127 | builder,
|
125 - | ::http::header::CONTENT_TYPE,
|
128 + | ::http_1x::header::CONTENT_TYPE,
|
126 129 | "application/x-amz-json-1.0",
|
127 130 | );
|
128 131 | let content_length = payload.len();
|
129 132 | builder = ::aws_smithy_http::header::set_response_header_if_absent(
|
130 133 | builder,
|
131 - | ::http::header::CONTENT_LENGTH,
|
134 + | ::http_1x::header::CONTENT_LENGTH,
|
132 135 | content_length,
|
133 136 | );
|
134 137 | builder
|
135 138 | .status(500)
|
136 139 | .body(::aws_smithy_http_server::body::to_boxed(payload))?
|
137 140 | }
|
138 141 | }
|
139 142 | })
|
140 143 | }
|
141 144 |
|