1 1 | // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
|
2 2 | ::pin_project_lite::pin_project! {
|
3 3 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
4 - | /// [`StreamingOperationWithOptionalDataInput`](crate::input::StreamingOperationWithOptionalDataInput) using modelled bindings.
|
5 - | pub struct StreamingOperationWithOptionalDataInputFuture {
|
6 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::StreamingOperationWithOptionalDataInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
4 + | /// [`SimpleStructOperationInput`](crate::input::SimpleStructOperationInput) using modelled bindings.
|
5 + | pub struct SimpleStructOperationInputFuture {
|
6 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SimpleStructOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
7 7 | }
|
8 8 | }
|
9 9 |
|
10 - | impl std::future::Future for StreamingOperationWithOptionalDataInputFuture {
|
10 + | impl std::future::Future for SimpleStructOperationInputFuture {
|
11 11 | type Output = Result<
|
12 - | crate::input::StreamingOperationWithOptionalDataInput,
|
12 + | crate::input::SimpleStructOperationInput,
|
13 13 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
14 14 | >;
|
15 15 |
|
16 16 | fn poll(
|
17 17 | self: std::pin::Pin<&mut Self>,
|
18 18 | cx: &mut std::task::Context<'_>,
|
19 19 | ) -> std::task::Poll<Self::Output> {
|
20 20 | let this = self.project();
|
21 21 | this.inner.as_mut().poll(cx)
|
22 22 | }
|
23 23 | }
|
24 24 |
|
25 25 | impl<B>
|
26 26 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
27 27 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
28 28 | B,
|
29 - | > for crate::input::StreamingOperationWithOptionalDataInput
|
29 + | > for crate::input::SimpleStructOperationInput
|
30 30 | where
|
31 31 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
32 32 | B: 'static,
|
33 33 |
|
34 - | B: Into<::aws_smithy_types::byte_stream::ByteStream>,
|
35 34 | B::Data: Send,
|
36 35 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
37 36 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
38 37 | {
|
39 38 | type Rejection =
|
40 39 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
41 - | type Future = StreamingOperationWithOptionalDataInputFuture;
|
40 + | type Future = SimpleStructOperationInputFuture;
|
42 41 |
|
43 42 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
44 43 | let fut = async move {
|
45 44 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
46 - | request.headers(),
|
47 - | &crate::mimes::CONTENT_TYPE_APPLICATION_VND_AMAZON_EVENTSTREAM,
|
48 - | ) && !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
49 45 | request.headers(),
|
50 46 | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
51 47 | ) {
|
52 48 | return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
53 49 | }
|
54 - | crate::protocol_serde::shape_streaming_operation_with_optional_data::de_streaming_operation_with_optional_data_http_request(request)
|
50 + | crate::protocol_serde::shape_simple_struct_operation::de_simple_struct_operation_http_request(request)
|
55 51 | .await
|
56 52 | };
|
57 53 | use ::futures_util::future::TryFutureExt;
|
58 54 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
|
59 55 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
60 56 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
|
61 57 | });
|
62 - | StreamingOperationWithOptionalDataInputFuture {
|
58 + | SimpleStructOperationInputFuture {
|
63 59 | inner: Box::pin(fut),
|
64 60 | }
|
65 61 | }
|
66 62 | }
|
67 63 | impl
|
68 64 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
69 65 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
70 - | > for crate::output::StreamingOperationWithOptionalDataOutput
|
66 + | > for crate::output::SimpleStructOperationOutput
|
71 67 | {
|
72 68 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
73 - | match crate::protocol_serde::shape_streaming_operation_with_optional_data::ser_streaming_operation_with_optional_data_http_response(self) {
|
69 + | match crate::protocol_serde::shape_simple_struct_operation::ser_simple_struct_operation_http_response(self) {
|
74 70 | Ok(response) => response,
|
75 71 | Err(e) => {
|
76 72 | ::tracing::error!(error = %e, "failed to serialize response");
|
77 73 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
78 74 | }
|
79 75 | }
|
80 76 | }
|
81 77 | }
|
82 78 | impl
|
83 79 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
84 80 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
85 - | > for crate::error::StreamingOperationWithOptionalDataError
|
81 + | > for crate::error::SimpleStructOperationError
|
86 82 | {
|
87 83 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
88 - | match crate::protocol_serde::shape_streaming_operation_with_optional_data::ser_streaming_operation_with_optional_data_http_error(&self) {
|
84 + | match crate::protocol_serde::shape_simple_struct_operation::ser_simple_struct_operation_http_error(&self) {
|
89 85 | Ok(mut response) => {
|
90 86 | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
91 87 | response
|
92 88 | },
|
93 89 | Err(e) => {
|
94 90 | ::tracing::error!(error = %e, "failed to serialize response");
|
95 91 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
96 92 | }
|
97 93 | }
|
98 94 | }
|
99 95 | }
|
100 96 |
|
97 + | #[allow(unreachable_code, unused_variables)]
|
98 + | #[cfg(test)]
|
99 + | mod simple_struct_operation_test {
|
100 + |
|
101 + | /// Test ID: SimpleStruct
|
102 + | #[::tokio::test]
|
103 + | #[::tracing_test::traced_test]
|
104 + | async fn simple_struct_response() {
|
105 + | let output =crate::output::SimpleStructOperationOutput {
|
106 + | blob:
|
107 + | ::std::option::Option::Some(
|
108 + | ::aws_smithy_types::Blob::new("blobby blob")
|
109 + | )
|
110 + | ,
|
111 + | boolean:
|
112 + | ::std::option::Option::Some(
|
113 + | false
|
114 + | )
|
115 + | ,
|
116 + | string:
|
117 + | ::std::option::Option::Some(
|
118 + | "There are three things all wise men fear: the sea in storm, a night with no moon, and the anger of a gentle man.".to_owned()
|
119 + | )
|
120 + | ,
|
121 + | byte:
|
122 + | ::std::option::Option::Some(
|
123 + | 69
|
124 + | )
|
125 + | ,
|
126 + | short:
|
127 + | ::std::option::Option::Some(
|
128 + | 70
|
129 + | )
|
130 + | ,
|
131 + | integer:
|
132 + | ::std::option::Option::Some(
|
133 + | 71
|
134 + | )
|
135 + | ,
|
136 + | long:
|
137 + | ::std::option::Option::Some(
|
138 + | 72
|
139 + | )
|
140 + | ,
|
141 + | float:
|
142 + | ::std::option::Option::Some(
|
143 + | 0.69_f32
|
144 + | )
|
145 + | ,
|
146 + | double:
|
147 + | ::std::option::Option::Some(
|
148 + | 0.6969_f64
|
149 + | )
|
150 + | ,
|
151 + | timestamp:
|
152 + | ::std::option::Option::Some(
|
153 + | ::aws_smithy_types::DateTime::from_fractional_secs(1546300800, 0_f64)
|
154 + | )
|
155 + | ,
|
156 + | r#enum:
|
157 + | ::std::option::Option::Some(
|
158 + | "DIAMOND".parse::<crate::model::Suit>().expect("static value validated to member")
|
159 + | )
|
160 + | ,
|
161 + | required_blob:
|
162 + | ::aws_smithy_types::Blob::new("blobby blob")
|
163 + | ,
|
164 + | required_boolean:
|
165 + | false
|
166 + | ,
|
167 + | required_string:
|
168 + | "There are three things all wise men fear: the sea in storm, a night with no moon, and the anger of a gentle man.".to_owned()
|
169 + | ,
|
170 + | required_byte:
|
171 + | 69
|
172 + | ,
|
173 + | required_short:
|
174 + | 70
|
175 + | ,
|
176 + | required_integer:
|
177 + | 71
|
178 + | ,
|
179 + | required_long:
|
180 + | 72
|
181 + | ,
|
182 + | required_float:
|
183 + | 0.69_f32
|
184 + | ,
|
185 + | required_double:
|
186 + | 0.6969_f64
|
187 + | ,
|
188 + | required_timestamp:
|
189 + | ::aws_smithy_types::DateTime::from_fractional_secs(1546300800, 0_f64)
|
190 + | ,
|
191 + | required_enum:
|
192 + | "DIAMOND".parse::<crate::model::Suit>().expect("static value validated to member")
|
193 + | ,
|
194 + | }
|
195 + | ;
|
196 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
197 + | let http_response = output.into_response();
|
198 + | ::pretty_assertions::assert_eq!(
|
199 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
200 + | http_response.status()
|
201 + | );
|
202 + | let expected_headers = [
|
203 + | ("Content-Type", "application/cbor"),
|
204 + | ("smithy-protocol", "rpc-v2-cbor"),
|
205 + | ];
|
206 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
207 + | http_response.headers(),
|
208 + | expected_headers,
|
209 + | ));
|
210 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
211 + | .await
|
212 + | .expect("unable to extract body to bytes");
|
213 + | ::aws_smithy_protocol_test::assert_ok(
|
214 + | ::aws_smithy_protocol_test::validate_body(&body, "v2RibG9iS2Jsb2JieSBibG9iZ2Jvb2xlYW70ZnN0cmluZ3hwVGhlcmUgYXJlIHRocmVlIHRoaW5ncyBhbGwgd2lzZSBtZW4gZmVhcjogdGhlIHNlYSBpbiBzdG9ybSwgYSBuaWdodCB3aXRoIG5vIG1vb24sIGFuZCB0aGUgYW5nZXIgb2YgYSBnZW50bGUgbWFuLmRieXRlGEVlc2hvcnQYRmdpbnRlZ2VyGEdkbG9uZxhIZWZsb2F0+j8wo9dmZG91Ymxl+z/mTQE6kqMFaXRpbWVzdGFtcMH7QdcKq2AAAABkZW51bWdESUFNT05EbHJlcXVpcmVkQmxvYktibG9iYnkgYmxvYm9yZXF1aXJlZEJvb2xlYW70bnJlcXVpcmVkU3RyaW5neHBUaGVyZSBhcmUgdGhyZWUgdGhpbmdzIGFsbCB3aXNlIG1lbiBmZWFyOiB0aGUgc2VhIGluIHN0b3JtLCBhIG5pZ2h0IHdpdGggbm8gbW9vbiwgYW5kIHRoZSBhbmdlciBvZiBhIGdlbnRsZSBtYW4ubHJlcXVpcmVkQnl0ZRhFbXJlcXVpcmVkU2hvcnQYRm9yZXF1aXJlZEludGVnZXIYR2xyZXF1aXJlZExvbmcYSG1yZXF1aXJlZEZsb2F0+j8wo9ducmVxdWlyZWREb3VibGX7P+ZNATqSowVxcmVxdWlyZWRUaW1lc3RhbXDB+0HXCqtgAAAAbHJlcXVpcmVkRW51bWdESUFNT05E/w==", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
215 + | );
|
216 + | }
|
217 + | /// Test ID: SimpleStructWithOptionsSetToNone
|
218 + | #[::tokio::test]
|
219 + | #[::tracing_test::traced_test]
|
220 + | async fn simple_struct_with_options_set_to_none_response() {
|
221 + | let output =crate::output::SimpleStructOperationOutput {
|
222 + | required_blob:
|
223 + | ::aws_smithy_types::Blob::new("blobby blob")
|
224 + | ,
|
225 + | required_boolean:
|
226 + | false
|
227 + | ,
|
228 + | required_string:
|
229 + | "There are three things all wise men fear: the sea in storm, a night with no moon, and the anger of a gentle man.".to_owned()
|
230 + | ,
|
231 + | required_byte:
|
232 + | 69
|
233 + | ,
|
234 + | required_short:
|
235 + | 70
|
236 + | ,
|
237 + | required_integer:
|
238 + | 71
|
239 + | ,
|
240 + | required_long:
|
241 + | 72
|
242 + | ,
|
243 + | required_float:
|
244 + | 0.69_f32
|
245 + | ,
|
246 + | required_double:
|
247 + | 0.6969_f64
|
248 + | ,
|
249 + | required_timestamp:
|
250 + | ::aws_smithy_types::DateTime::from_fractional_secs(1546300800, 0_f64)
|
251 + | ,
|
252 + | required_enum:
|
253 + | "DIAMOND".parse::<crate::model::Suit>().expect("static value validated to member")
|
254 + | ,
|
255 + | blob:
|
256 + | ::std::option::Option::None
|
257 + | ,
|
258 + | boolean:
|
259 + | ::std::option::Option::None
|
260 + | ,
|
261 + | string:
|
262 + | ::std::option::Option::None
|
263 + | ,
|
264 + | byte:
|
265 + | ::std::option::Option::None
|
266 + | ,
|
267 + | short:
|
268 + | ::std::option::Option::None
|
269 + | ,
|
270 + | integer:
|
271 + | ::std::option::Option::None
|
272 + | ,
|
273 + | long:
|
274 + | ::std::option::Option::None
|
275 + | ,
|
276 + | float:
|
277 + | ::std::option::Option::None
|
278 + | ,
|
279 + | double:
|
280 + | ::std::option::Option::None
|
281 + | ,
|
282 + | timestamp:
|
283 + | ::std::option::Option::None
|
284 + | ,
|
285 + | r#enum:
|
286 + | ::std::option::Option::None
|
287 + | ,
|
288 + | }
|
289 + | ;
|
290 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
291 + | let http_response = output.into_response();
|
292 + | ::pretty_assertions::assert_eq!(
|
293 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
294 + | http_response.status()
|
295 + | );
|
296 + | let expected_headers = [
|
297 + | ("Content-Type", "application/cbor"),
|
298 + | ("smithy-protocol", "rpc-v2-cbor"),
|
299 + | ];
|
300 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
301 + | http_response.headers(),
|
302 + | expected_headers,
|
303 + | ));
|
304 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
305 + | .await
|
306 + | .expect("unable to extract body to bytes");
|
307 + | ::aws_smithy_protocol_test::assert_ok(
|
308 + | ::aws_smithy_protocol_test::validate_body(&body, "v2xyZXF1aXJlZEJsb2JLYmxvYmJ5IGJsb2JvcmVxdWlyZWRCb29sZWFu9G5yZXF1aXJlZFN0cmluZ3hwVGhlcmUgYXJlIHRocmVlIHRoaW5ncyBhbGwgd2lzZSBtZW4gZmVhcjogdGhlIHNlYSBpbiBzdG9ybSwgYSBuaWdodCB3aXRoIG5vIG1vb24sIGFuZCB0aGUgYW5nZXIgb2YgYSBnZW50bGUgbWFuLmxyZXF1aXJlZEJ5dGUYRW1yZXF1aXJlZFNob3J0GEZvcmVxdWlyZWRJbnRlZ2VyGEdscmVxdWlyZWRMb25nGEhtcmVxdWlyZWRGbG9hdPo/MKPXbnJlcXVpcmVkRG91Ymxl+z/mTQE6kqMFcXJlcXVpcmVkVGltZXN0YW1wwftB1wqrYAAAAGxyZXF1aXJlZEVudW1nRElBTU9ORP8=", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
309 + | );
|
310 + | }
|
311 + | }
|
312 + |
|
101 313 | ::pin_project_lite::pin_project! {
|
102 314 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
103 - | /// [`StreamingOperationWithInitialResponseInput`](crate::input::StreamingOperationWithInitialResponseInput) using modelled bindings.
|
104 - | pub struct StreamingOperationWithInitialResponseInputFuture {
|
105 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::StreamingOperationWithInitialResponseInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
315 + | /// [`ErrorSerializationOperationInput`](crate::input::ErrorSerializationOperationInput) using modelled bindings.
|
316 + | pub struct ErrorSerializationOperationInputFuture {
|
317 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ErrorSerializationOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
106 318 | }
|
107 319 | }
|
108 320 |
|
109 - | impl std::future::Future for StreamingOperationWithInitialResponseInputFuture {
|
321 + | impl std::future::Future for ErrorSerializationOperationInputFuture {
|
110 322 | type Output = Result<
|
111 - | crate::input::StreamingOperationWithInitialResponseInput,
|
323 + | crate::input::ErrorSerializationOperationInput,
|
112 324 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
113 325 | >;
|
114 326 |
|
115 327 | fn poll(
|
116 328 | self: std::pin::Pin<&mut Self>,
|
117 329 | cx: &mut std::task::Context<'_>,
|
118 330 | ) -> std::task::Poll<Self::Output> {
|
119 331 | let this = self.project();
|
120 332 | this.inner.as_mut().poll(cx)
|
121 333 | }
|
122 334 | }
|
123 335 |
|
124 336 | impl<B>
|
125 337 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
126 338 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
127 339 | B,
|
128 - | > for crate::input::StreamingOperationWithInitialResponseInput
|
340 + | > for crate::input::ErrorSerializationOperationInput
|
129 341 | where
|
130 342 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
131 343 | B: 'static,
|
132 344 |
|
133 - | B: Into<::aws_smithy_types::byte_stream::ByteStream>,
|
134 345 | B::Data: Send,
|
135 346 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
136 347 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
137 348 | {
|
138 349 | type Rejection =
|
139 350 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
140 - | type Future = StreamingOperationWithInitialResponseInputFuture;
|
351 + | type Future = ErrorSerializationOperationInputFuture;
|
141 352 |
|
142 353 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
143 354 | let fut = async move {
|
144 355 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
145 - | request.headers(),
|
146 - | &crate::mimes::CONTENT_TYPE_APPLICATION_VND_AMAZON_EVENTSTREAM,
|
147 - | ) && !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
148 356 | request.headers(),
|
149 357 | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
150 358 | ) {
|
151 359 | return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
152 360 | }
|
153 - | crate::protocol_serde::shape_streaming_operation_with_initial_response::de_streaming_operation_with_initial_response_http_request(request)
|
361 + | crate::protocol_serde::shape_error_serialization_operation::de_error_serialization_operation_http_request(request)
|
154 362 | .await
|
155 363 | };
|
156 364 | use ::futures_util::future::TryFutureExt;
|
157 365 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
|
158 366 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
159 367 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
|
160 368 | });
|
161 - | StreamingOperationWithInitialResponseInputFuture {
|
369 + | ErrorSerializationOperationInputFuture {
|
162 370 | inner: Box::pin(fut),
|
163 371 | }
|
164 372 | }
|
165 373 | }
|
166 374 | impl
|
167 375 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
168 376 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
169 - | > for crate::output::StreamingOperationWithInitialResponseOutput
|
377 + | > for crate::output::ErrorSerializationOperationOutput
|
170 378 | {
|
171 379 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
172 - | match crate::protocol_serde::shape_streaming_operation_with_initial_response::ser_streaming_operation_with_initial_response_http_response(self) {
|
380 + | match crate::protocol_serde::shape_error_serialization_operation::ser_error_serialization_operation_http_response(self) {
|
173 381 | Ok(response) => response,
|
174 382 | Err(e) => {
|
175 383 | ::tracing::error!(error = %e, "failed to serialize response");
|
176 384 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
177 385 | }
|
178 386 | }
|
179 387 | }
|
180 388 | }
|
181 389 | impl
|
182 390 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
183 391 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
184 - | > for crate::error::StreamingOperationWithInitialResponseError
|
392 + | > for crate::error::ErrorSerializationOperationError
|
185 393 | {
|
186 394 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
187 - | match crate::protocol_serde::shape_streaming_operation_with_initial_response::ser_streaming_operation_with_initial_response_http_error(&self) {
|
395 + | match crate::protocol_serde::shape_error_serialization_operation::ser_error_serialization_operation_http_error(&self) {
|
188 396 | Ok(mut response) => {
|
189 397 | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
190 398 | response
|
191 399 | },
|
192 400 | Err(e) => {
|
193 401 | ::tracing::error!(error = %e, "failed to serialize response");
|
194 402 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
195 403 | }
|
196 404 | }
|
197 405 | }
|
198 406 | }
|
199 407 |
|
408 + | #[allow(unreachable_code, unused_variables)]
|
409 + | #[cfg(test)]
|
410 + | mod error_serialization_operation_test {
|
411 + |
|
412 + | /// Despite the operation output being a structure shape with the `@error` trait,
|
413 + | /// `__type` field should, in a strict interpretation of the spec, not be included,
|
414 + | /// because we're not serializing a server error response. However, we do, because
|
415 + | /// there shouldn't™️ be any harm in doing so, and it greatly simplifies the
|
416 + | /// code generator. This test just pins this behavior in case we ever modify it.
|
417 + | /// Test ID: OperationOutputSerializationQuestionablyIncludesTypeField
|
418 + | #[::tokio::test]
|
419 + | #[::tracing_test::traced_test]
|
420 + | async fn operation_output_serialization_questionably_includes_type_field_response() {
|
421 + | let output = crate::output::ErrorSerializationOperationOutput {
|
422 + | error_shape: ::std::option::Option::Some(crate::error::ValidationException {
|
423 + | message: "ValidationException message field".to_owned(),
|
424 + | field_list: ::std::option::Option::None,
|
425 + | }),
|
426 + | };
|
427 + | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
428 + | let http_response = output.into_response();
|
429 + | ::pretty_assertions::assert_eq!(
|
430 + | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
431 + | http_response.status()
|
432 + | );
|
433 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
434 + | .await
|
435 + | .expect("unable to extract body to bytes");
|
436 + | ::aws_smithy_protocol_test::assert_ok(
|
437 + | ::aws_smithy_protocol_test::validate_body(&body, "v2plcnJvclNoYXBlv2ZfX3R5cGV4JHNtaXRoeS5mcmFtZXdvcmsjVmFsaWRhdGlvbkV4Y2VwdGlvbmdtZXNzYWdleCFWYWxpZGF0aW9uRXhjZXB0aW9uIG1lc3NhZ2UgZmllbGT//w==", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
438 + | );
|
439 + | }
|
440 + |
|
441 + | /// When invalid input is provided the request should be rejected with
|
442 + | /// a validation exception, and a `__type` field should be included
|
443 + | /// Test ID: ErrorSerializationIncludesTypeField
|
444 + | #[::tokio::test]
|
445 + | #[::tracing_test::traced_test]
|
446 + | async fn error_serialization_includes_type_field_malformed_request() {
|
447 + | {
|
448 + | #[allow(unused_mut)]
|
449 + | let mut http_request = ::http::Request::builder()
|
450 + | .uri("/service/RpcV2CborService/operation/ErrorSerializationOperation")
|
451 + | .method("POST")
|
452 + | .header("smithy-protocol", "rpc-v2-cbor")
|
453 + | .header("Accept", "application/cbor")
|
454 + | .header("Content-Type", "application/cbor")
|
455 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
456 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
457 + | "oA==".as_bytes(),
|
458 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
459 + | )),
|
460 + | ))
|
461 + | .unwrap();
|
462 + | #[allow(unused_mut)]
|
463 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
464 + | let config = crate::service::RpcV2CborServiceConfig::builder().build();
|
465 + | let service = crate::service::RpcV2CborService::builder::<::hyper::body::Body, _, _, _>(config)
|
466 + | .error_serialization_operation(move |input: crate::input::ErrorSerializationOperationInput| {
|
467 + | let sender = sender.clone();
|
468 + | async move {
|
469 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::ErrorSerializationOperationOutput, crate::error::ErrorSerializationOperationError> };
|
470 + | sender.send(()).await.expect("receiver dropped early");
|
471 + | result
|
472 + | }
|
473 + | })
|
474 + | .build_unchecked();
|
475 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
476 + | .await
|
477 + | .expect("unable to make an HTTP request");
|
478 + | ::pretty_assertions::assert_eq!(
|
479 + | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
480 + | http_response.status()
|
481 + | );
|
482 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
483 + | .await
|
484 + | .expect("unable to extract body to bytes");
|
485 + | ::aws_smithy_protocol_test::assert_ok(
|
486 + | ::aws_smithy_protocol_test::validate_body(&body, "v2ZfX3R5cGV4JHNtaXRoeS5mcmFtZXdvcmsjVmFsaWRhdGlvbkV4Y2VwdGlvbmdtZXNzYWdleGsxIHZhbGlkYXRpb24gZXJyb3IgZGV0ZWN0ZWQuIFZhbHVlIGF0ICcvcmVxdWlyZWRCbG9iJyBmYWlsZWQgdG8gc2F0aXNmeSBjb25zdHJhaW50OiBNZW1iZXIgbXVzdCBub3QgYmUgbnVsbGlmaWVsZExpc3SBv2RwYXRobS9yZXF1aXJlZEJsb2JnbWVzc2FnZXhOVmFsdWUgYXQgJy9yZXF1aXJlZEJsb2InIGZhaWxlZCB0byBzYXRpc2Z5IGNvbnN0cmFpbnQ6IE1lbWJlciBtdXN0IG5vdCBiZSBudWxs//8=", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
487 + | );
|
488 + | }
|
489 + | }
|
490 + | }
|
491 + |
|
200 492 | ::pin_project_lite::pin_project! {
|
201 493 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
202 - | /// [`StreamingOperationWithInitialDataInput`](crate::input::StreamingOperationWithInitialDataInput) using modelled bindings.
|
203 - | pub struct StreamingOperationWithInitialDataInputFuture {
|
204 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::StreamingOperationWithInitialDataInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
494 + | /// [`ComplexStructOperationInput`](crate::input::ComplexStructOperationInput) using modelled bindings.
|
495 + | pub struct ComplexStructOperationInputFuture {
|
496 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ComplexStructOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
205 497 | }
|
206 498 | }
|
207 499 |
|
208 - | impl std::future::Future for StreamingOperationWithInitialDataInputFuture {
|
500 + | impl std::future::Future for ComplexStructOperationInputFuture {
|
209 501 | type Output = Result<
|
210 - | crate::input::StreamingOperationWithInitialDataInput,
|
502 + | crate::input::ComplexStructOperationInput,
|
211 503 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
212 504 | >;
|
213 505 |
|
214 506 | fn poll(
|
215 507 | self: std::pin::Pin<&mut Self>,
|
216 508 | cx: &mut std::task::Context<'_>,
|
217 509 | ) -> std::task::Poll<Self::Output> {
|
218 510 | let this = self.project();
|
219 511 | this.inner.as_mut().poll(cx)
|
220 512 | }
|
221 513 | }
|
222 514 |
|
223 515 | impl<B>
|
224 516 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
225 517 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
226 518 | B,
|
227 - | > for crate::input::StreamingOperationWithInitialDataInput
|
519 + | > for crate::input::ComplexStructOperationInput
|
228 520 | where
|
229 521 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
230 522 | B: 'static,
|
231 523 |
|
232 - | B: Into<::aws_smithy_types::byte_stream::ByteStream>,
|
233 524 | B::Data: Send,
|
234 525 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
235 526 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
236 527 | {
|
237 528 | type Rejection =
|
238 529 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
239 - | type Future = StreamingOperationWithInitialDataInputFuture;
|
530 + | type Future = ComplexStructOperationInputFuture;
|
240 531 |
|
241 532 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
242 533 | let fut = async move {
|
243 534 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
244 - | request.headers(),
|
245 - | &crate::mimes::CONTENT_TYPE_APPLICATION_VND_AMAZON_EVENTSTREAM,
|
246 - | ) && !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
247 535 | request.headers(),
|
248 536 | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
249 537 | ) {
|
250 538 | return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
251 539 | }
|
252 - | crate::protocol_serde::shape_streaming_operation_with_initial_data::de_streaming_operation_with_initial_data_http_request(request)
|
540 + | crate::protocol_serde::shape_complex_struct_operation::de_complex_struct_operation_http_request(request)
|
253 541 | .await
|
254 542 | };
|
255 543 | use ::futures_util::future::TryFutureExt;
|
256 544 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
|
257 545 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
258 546 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
|
259 547 | });
|
260 - | StreamingOperationWithInitialDataInputFuture {
|
548 + | ComplexStructOperationInputFuture {
|
261 549 | inner: Box::pin(fut),
|
262 550 | }
|
263 551 | }
|
264 552 | }
|
265 553 | impl
|
266 554 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
267 555 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
268 - | > for crate::output::StreamingOperationWithInitialDataOutput
|
556 + | > for crate::output::ComplexStructOperationOutput
|
269 557 | {
|
270 558 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
271 - | match crate::protocol_serde::shape_streaming_operation_with_initial_data::ser_streaming_operation_with_initial_data_http_response(self) {
|
559 + | match crate::protocol_serde::shape_complex_struct_operation::ser_complex_struct_operation_http_response(self) {
|
272 560 | Ok(response) => response,
|
273 561 | Err(e) => {
|
274 562 | ::tracing::error!(error = %e, "failed to serialize response");
|
275 563 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
276 564 | }
|
277 565 | }
|
278 566 | }
|
279 567 | }
|
280 568 | impl
|
281 569 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
282 570 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
283 - | > for crate::error::StreamingOperationWithInitialDataError
|
571 + | > for crate::error::ComplexStructOperationError
|
284 572 | {
|
285 573 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
286 - | match crate::protocol_serde::shape_streaming_operation_with_initial_data::ser_streaming_operation_with_initial_data_http_error(&self) {
|
574 + | match crate::protocol_serde::shape_complex_struct_operation::ser_complex_struct_operation_http_error(&self) {
|
287 575 | Ok(mut response) => {
|
288 576 | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
289 577 | response
|
290 578 | },
|
291 579 | Err(e) => {
|
292 580 | ::tracing::error!(error = %e, "failed to serialize response");
|
293 581 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
294 582 | }
|
295 583 | }
|
296 584 | }
|
297 585 | }
|
298 586 |
|
299 587 | ::pin_project_lite::pin_project! {
|
300 588 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
301 - | /// [`StreamingOperationInput`](crate::input::StreamingOperationInput) using modelled bindings.
|
302 - | pub struct StreamingOperationInputFuture {
|
303 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::StreamingOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
589 + | /// [`EmptyStructOperationInput`](crate::input::EmptyStructOperationInput) using modelled bindings.
|
590 + | pub struct EmptyStructOperationInputFuture {
|
591 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EmptyStructOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
304 592 | }
|
305 593 | }
|
306 594 |
|
307 - | impl std::future::Future for StreamingOperationInputFuture {
|
595 + | impl std::future::Future for EmptyStructOperationInputFuture {
|
308 596 | type Output = Result<
|
309 - | crate::input::StreamingOperationInput,
|
597 + | crate::input::EmptyStructOperationInput,
|
310 598 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
311 599 | >;
|
312 600 |
|
313 601 | fn poll(
|
314 602 | self: std::pin::Pin<&mut Self>,
|
315 603 | cx: &mut std::task::Context<'_>,
|
316 604 | ) -> std::task::Poll<Self::Output> {
|
317 605 | let this = self.project();
|
318 606 | this.inner.as_mut().poll(cx)
|
319 607 | }
|
320 608 | }
|
321 609 |
|
322 610 | impl<B>
|
323 611 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
324 612 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
325 613 | B,
|
326 - | > for crate::input::StreamingOperationInput
|
614 + | > for crate::input::EmptyStructOperationInput
|
327 615 | where
|
328 616 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
329 617 | B: 'static,
|
330 618 |
|
331 - | B: Into<::aws_smithy_types::byte_stream::ByteStream>,
|
332 619 | B::Data: Send,
|
333 620 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
334 621 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
335 622 | {
|
336 623 | type Rejection =
|
337 624 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
338 - | type Future = StreamingOperationInputFuture;
|
625 + | type Future = EmptyStructOperationInputFuture;
|
339 626 |
|
340 627 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
341 628 | let fut = async move {
|
342 629 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
343 - | request.headers(),
|
344 - | &crate::mimes::CONTENT_TYPE_APPLICATION_VND_AMAZON_EVENTSTREAM,
|
345 - | ) && !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
346 630 | request.headers(),
|
347 631 | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
348 632 | ) {
|
349 633 | return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
350 634 | }
|
351 - | crate::protocol_serde::shape_streaming_operation::de_streaming_operation_http_request(
|
352 - | request,
|
353 - | )
|
354 - | .await
|
635 + | crate::protocol_serde::shape_empty_struct_operation::de_empty_struct_operation_http_request(request)
|
636 + | .await
|
355 637 | };
|
356 638 | use ::futures_util::future::TryFutureExt;
|
357 639 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
|
358 640 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
359 641 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
|
360 642 | });
|
361 - | StreamingOperationInputFuture {
|
643 + | EmptyStructOperationInputFuture {
|
362 644 | inner: Box::pin(fut),
|
363 645 | }
|
364 646 | }
|
365 647 | }
|
366 648 | impl
|
367 649 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
368 650 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
369 - | > for crate::output::StreamingOperationOutput
|
651 + | > for crate::output::EmptyStructOperationOutput
|
370 652 | {
|
371 653 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
372 - | match crate::protocol_serde::shape_streaming_operation::ser_streaming_operation_http_response(self) {
|
654 + | match crate::protocol_serde::shape_empty_struct_operation::ser_empty_struct_operation_http_response(self) {
|
373 655 | Ok(response) => response,
|
374 656 | Err(e) => {
|
375 657 | ::tracing::error!(error = %e, "failed to serialize response");
|
376 658 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
377 659 | }
|
378 660 | }
|
379 661 | }
|
380 662 | }
|
381 - | impl
|
382 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
383 - | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
384 - | > for crate::error::StreamingOperationError
|
385 - | {
|
386 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
387 - | match crate::protocol_serde::shape_streaming_operation::ser_streaming_operation_http_error(
|
388 - | &self,
|
389 - | ) {
|
390 - | Ok(mut response) => {
|
391 - | response.extensions_mut().insert(
|
392 - | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
393 - | self.name(),
|
394 - | ),
|
395 - | );
|
396 - | response
|
397 - | }
|
398 - | Err(e) => {
|
399 - | ::tracing::error!(error = %e, "failed to serialize response");
|
400 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
401 - | }
|
663 + |
|
664 + | #[allow(unreachable_code, unused_variables)]
|
665 + | #[cfg(test)]
|
666 + | mod empty_struct_operation_test {
|
667 + |
|
668 + | /// When additional tokens are found past where we expect the end of the body,
|
669 + | /// the request should be rejected with a serialization exception.
|
670 + | /// Test ID: AdditionalTokensEmptyStruct
|
671 + | #[::tokio::test]
|
672 + | #[::tracing_test::traced_test]
|
673 + | #[should_panic]
|
674 + | async fn additional_tokens_empty_struct_malformed_request() {
|
675 + | {
|
676 + | #[allow(unused_mut)]
|
677 + | let mut http_request = ::http::Request::builder()
|
678 + | .uri("/service/RpcV2CborService/operation/EmptyStructOperation")
|
679 + | .method("POST")
|
680 + | .header("smithy-protocol", "rpc-v2-cbor")
|
681 + | .header("Accept", "application/cbor")
|
682 + | .header("Content-Type", "application/cbor")
|
683 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
684 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
685 + | "v/+//w==".as_bytes(),
|
686 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
687 + | )),
|
688 + | ))
|
689 + | .unwrap();
|
690 + | #[allow(unused_mut)]
|
691 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
692 + | let config = crate::service::RpcV2CborServiceConfig::builder().build();
|
693 + | let service = crate::service::RpcV2CborService::builder::<::hyper::body::Body, _, _, _>(config)
|
694 + | .empty_struct_operation(move |input: crate::input::EmptyStructOperationInput| {
|
695 + | let sender = sender.clone();
|
696 + | async move {
|
697 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::EmptyStructOperationOutput };
|
698 + | sender.send(()).await.expect("receiver dropped early");
|
699 + | result
|
700 + | }
|
701 + | })
|
702 + | .build_unchecked();
|
703 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
704 + | .await
|
705 + | .expect("unable to make an HTTP request");
|
706 + | ::pretty_assertions::assert_eq!(
|
707 + | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
708 + | http_response.status()
|
709 + | );
|
710 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
711 + | .await
|
712 + | .expect("unable to extract body to bytes");
|
713 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
714 + | &body,
|
715 + | "oA==",
|
716 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
717 + | ));
|
402 718 | }
|
403 719 | }
|
404 720 | }
|
405 721 |
|
406 722 | ::pin_project_lite::pin_project! {
|
407 723 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
408 - | /// [`RecursiveUnionOperationInput`](crate::input::RecursiveUnionOperationInput) using modelled bindings.
|
409 - | pub struct RecursiveUnionOperationInputFuture {
|
410 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::RecursiveUnionOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
724 + | /// [`SingleMemberStructOperationInput`](crate::input::SingleMemberStructOperationInput) using modelled bindings.
|
725 + | pub struct SingleMemberStructOperationInputFuture {
|
726 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SingleMemberStructOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
411 727 | }
|
412 728 | }
|
413 729 |
|
414 - | impl std::future::Future for RecursiveUnionOperationInputFuture {
|
730 + | impl std::future::Future for SingleMemberStructOperationInputFuture {
|
415 731 | type Output = Result<
|
416 - | crate::input::RecursiveUnionOperationInput,
|
732 + | crate::input::SingleMemberStructOperationInput,
|
417 733 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
418 734 | >;
|
419 735 |
|
420 736 | fn poll(
|
421 737 | self: std::pin::Pin<&mut Self>,
|
422 738 | cx: &mut std::task::Context<'_>,
|
423 739 | ) -> std::task::Poll<Self::Output> {
|
424 740 | let this = self.project();
|
425 741 | this.inner.as_mut().poll(cx)
|
426 742 | }
|
427 743 | }
|
428 744 |
|
429 745 | impl<B>
|
430 746 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
431 747 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
432 748 | B,
|
433 - | > for crate::input::RecursiveUnionOperationInput
|
749 + | > for crate::input::SingleMemberStructOperationInput
|
434 750 | where
|
435 751 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
436 752 | B: 'static,
|
437 753 |
|
438 754 | B::Data: Send,
|
439 755 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
440 756 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
441 757 | {
|
442 758 | type Rejection =
|
443 759 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
444 - | type Future = RecursiveUnionOperationInputFuture;
|
760 + | type Future = SingleMemberStructOperationInputFuture;
|
445 761 |
|
446 762 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
447 763 | let fut = async move {
|
448 764 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
449 765 | request.headers(),
|
450 766 | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
451 767 | ) {
|
452 768 | return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
453 769 | }
|
454 - | crate::protocol_serde::shape_recursive_union_operation::de_recursive_union_operation_http_request(request)
|
770 + | crate::protocol_serde::shape_single_member_struct_operation::de_single_member_struct_operation_http_request(request)
|
771 + | .await
|
772 + | };
|
773 + | use ::futures_util::future::TryFutureExt;
|
774 + | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
|
775 + | ::tracing::debug!(error = %e, "failed to deserialize request");
|
776 + | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
|
777 + | });
|
778 + | SingleMemberStructOperationInputFuture {
|
779 + | inner: Box::pin(fut),
|
780 + | }
|
781 + | }
|
782 + | }
|
783 + | impl
|
784 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
785 + | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
786 + | > for crate::output::SingleMemberStructOperationOutput
|
787 + | {
|
788 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
789 + | match crate::protocol_serde::shape_single_member_struct_operation::ser_single_member_struct_operation_http_response(self) {
|
790 + | Ok(response) => response,
|
791 + | Err(e) => {
|
792 + | ::tracing::error!(error = %e, "failed to serialize response");
|
793 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
794 + | }
|
795 + | }
|
796 + | }
|
797 + | }
|
798 + |
|
799 + | #[allow(unreachable_code, unused_variables)]
|
800 + | #[cfg(test)]
|
801 + | mod single_member_struct_operation_test {
|
802 + |
|
803 + | /// When additional tokens are found past where we expect the end of the body,
|
804 + | /// the request should be rejected with a serialization exception.
|
805 + | /// Test ID: AdditionalTokensSingleMemberStruct
|
806 + | #[::tokio::test]
|
807 + | #[::tracing_test::traced_test]
|
808 + | async fn additional_tokens_single_member_struct_malformed_request() {
|
809 + | {
|
810 + | #[allow(unused_mut)]
|
811 + | let mut http_request = ::http::Request::builder()
|
812 + | .uri("/service/RpcV2CborService/operation/SingleMemberStructOperation")
|
813 + | .method("POST")
|
814 + | .header("smithy-protocol", "rpc-v2-cbor")
|
815 + | .header("Accept", "application/cbor")
|
816 + | .header("Content-Type", "application/cbor")
|
817 + | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
818 + | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
819 + | "v/+//w==".as_bytes(),
|
820 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
821 + | )),
|
822 + | ))
|
823 + | .unwrap();
|
824 + | #[allow(unused_mut)]
|
825 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
826 + | let config = crate::service::RpcV2CborServiceConfig::builder().build();
|
827 + | let service = crate::service::RpcV2CborService::builder::<::hyper::body::Body, _, _, _>(config)
|
828 + | .single_member_struct_operation(move |input: crate::input::SingleMemberStructOperationInput| {
|
829 + | let sender = sender.clone();
|
830 + | async move {
|
831 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::SingleMemberStructOperationOutput };
|
832 + | sender.send(()).await.expect("receiver dropped early");
|
833 + | result
|
834 + | }
|
835 + | })
|
836 + | .build_unchecked();
|
837 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
838 + | .await
|
839 + | .expect("unable to make an HTTP request");
|
840 + | ::pretty_assertions::assert_eq!(
|
841 + | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
842 + | http_response.status()
|
843 + | );
|
844 + | let body = ::hyper::body::to_bytes(http_response.into_body())
|
845 + | .await
|
846 + | .expect("unable to extract body to bytes");
|
847 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
848 + | &body,
|
849 + | "oA==",
|
850 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
851 + | ));
|
852 + | }
|
853 + | }
|
854 + | }
|
855 + |
|
856 + | ::pin_project_lite::pin_project! {
|
857 + | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
858 + | /// [`RecursiveUnionOperationInput`](crate::input::RecursiveUnionOperationInput) using modelled bindings.
|
859 + | pub struct RecursiveUnionOperationInputFuture {
|
860 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::RecursiveUnionOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
861 + | }
|
862 + | }
|
863 + |
|
864 + | impl std::future::Future for RecursiveUnionOperationInputFuture {
|
865 + | type Output = Result<
|
866 + | crate::input::RecursiveUnionOperationInput,
|
867 + | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
868 + | >;
|
869 + |
|
870 + | fn poll(
|
871 + | self: std::pin::Pin<&mut Self>,
|
872 + | cx: &mut std::task::Context<'_>,
|
873 + | ) -> std::task::Poll<Self::Output> {
|
874 + | let this = self.project();
|
875 + | this.inner.as_mut().poll(cx)
|
876 + | }
|
877 + | }
|
878 + |
|
879 + | impl<B>
|
880 + | ::aws_smithy_legacy_http_server::request::FromRequest<
|
881 + | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
882 + | B,
|
883 + | > for crate::input::RecursiveUnionOperationInput
|
884 + | where
|
885 + | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
886 + | B: 'static,
|
887 + |
|
888 + | B::Data: Send,
|
889 + | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
890 + | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
891 + | {
|
892 + | type Rejection =
|
893 + | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
894 + | type Future = RecursiveUnionOperationInputFuture;
|
895 + |
|
896 + | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
897 + | let fut = async move {
|
898 + | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
899 + | request.headers(),
|
900 + | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
901 + | ) {
|
902 + | return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
903 + | }
|
904 + | crate::protocol_serde::shape_recursive_union_operation::de_recursive_union_operation_http_request(request)
|
455 905 | .await
|
456 906 | };
|
457 907 | use ::futures_util::future::TryFutureExt;
|
458 908 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
|
459 909 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
460 910 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
|
461 911 | });
|
462 912 | RecursiveUnionOperationInputFuture {
|
463 913 | inner: Box::pin(fut),
|
464 914 | }
|
623 1073 | .await
|
624 1074 | .expect("unable to extract body to bytes");
|
625 1075 | ::aws_smithy_protocol_test::assert_ok(
|
626 1076 | ::aws_smithy_protocol_test::validate_body(&body, "v2ZuZXN0ZWS/Y2Zvb2RGb28xZ3ZhcmlhbnS/Z2Nob2ljZTFrT3V0ZXJDaG9pY2X/Zm5lc3RlZL9jYmFyZEJhcjFvcmVjdXJzaXZlTWVtYmVyv2Nmb29kRm9vMmd2YXJpYW50v2djaG9pY2Uyv2Nmb29kRm9vM2ZuZXN0ZWS/Y2JhcmRCYXIzb3JlY3Vyc2l2ZU1lbWJlcr9jZm9vZEZvbzRndmFyaWFudL9nY2hvaWNlMWtJbm5lckNob2ljZf//////Zm5lc3RlZL9jYmFyZEJhcjL//////w==", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
627 1077 | );
|
628 1078 | }
|
629 1079 | }
|
630 1080 |
|
631 1081 | ::pin_project_lite::pin_project! {
|
632 1082 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
633 - | /// [`SingleMemberStructOperationInput`](crate::input::SingleMemberStructOperationInput) using modelled bindings.
|
634 - | pub struct SingleMemberStructOperationInputFuture {
|
635 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SingleMemberStructOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
1083 + | /// [`StreamingOperationInput`](crate::input::StreamingOperationInput) using modelled bindings.
|
1084 + | pub struct StreamingOperationInputFuture {
|
1085 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::StreamingOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
636 1086 | }
|
637 1087 | }
|
638 1088 |
|
639 - | impl std::future::Future for SingleMemberStructOperationInputFuture {
|
1089 + | impl std::future::Future for StreamingOperationInputFuture {
|
640 1090 | type Output = Result<
|
641 - | crate::input::SingleMemberStructOperationInput,
|
1091 + | crate::input::StreamingOperationInput,
|
642 1092 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
643 1093 | >;
|
644 1094 |
|
645 1095 | fn poll(
|
646 1096 | self: std::pin::Pin<&mut Self>,
|
647 1097 | cx: &mut std::task::Context<'_>,
|
648 1098 | ) -> std::task::Poll<Self::Output> {
|
649 1099 | let this = self.project();
|
650 1100 | this.inner.as_mut().poll(cx)
|
651 1101 | }
|
652 1102 | }
|
653 1103 |
|
654 1104 | impl<B>
|
655 1105 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
656 1106 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
657 1107 | B,
|
658 - | > for crate::input::SingleMemberStructOperationInput
|
1108 + | > for crate::input::StreamingOperationInput
|
659 1109 | where
|
660 1110 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
661 1111 | B: 'static,
|
662 1112 |
|
1113 + | B: Into<::aws_smithy_types::byte_stream::ByteStream>,
|
663 1114 | B::Data: Send,
|
664 1115 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
665 1116 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
666 1117 | {
|
667 1118 | type Rejection =
|
668 1119 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
669 - | type Future = SingleMemberStructOperationInputFuture;
|
1120 + | type Future = StreamingOperationInputFuture;
|
670 1121 |
|
671 1122 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
672 1123 | let fut = async move {
|
673 1124 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
1125 + | request.headers(),
|
1126 + | &crate::mimes::CONTENT_TYPE_APPLICATION_VND_AMAZON_EVENTSTREAM,
|
1127 + | ) && !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
674 1128 | request.headers(),
|
675 1129 | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
676 1130 | ) {
|
677 1131 | return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
678 1132 | }
|
679 - | crate::protocol_serde::shape_single_member_struct_operation::de_single_member_struct_operation_http_request(request)
|
680 - | .await
|
1133 + | crate::protocol_serde::shape_streaming_operation::de_streaming_operation_http_request(
|
1134 + | request,
|
1135 + | )
|
1136 + | .await
|
681 1137 | };
|
682 1138 | use ::futures_util::future::TryFutureExt;
|
683 1139 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
|
684 1140 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
685 1141 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
|
686 1142 | });
|
687 - | SingleMemberStructOperationInputFuture {
|
1143 + | StreamingOperationInputFuture {
|
688 1144 | inner: Box::pin(fut),
|
689 1145 | }
|
690 1146 | }
|
691 1147 | }
|
692 1148 | impl
|
693 1149 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
694 1150 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
695 - | > for crate::output::SingleMemberStructOperationOutput
|
1151 + | > for crate::output::StreamingOperationOutput
|
696 1152 | {
|
697 1153 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
698 - | match crate::protocol_serde::shape_single_member_struct_operation::ser_single_member_struct_operation_http_response(self) {
|
1154 + | match crate::protocol_serde::shape_streaming_operation::ser_streaming_operation_http_response(self) {
|
699 1155 | Ok(response) => response,
|
700 1156 | Err(e) => {
|
701 1157 | ::tracing::error!(error = %e, "failed to serialize response");
|
702 1158 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
703 1159 | }
|
704 1160 | }
|
705 1161 | }
|
706 1162 | }
|
707 - |
|
708 - | #[allow(unreachable_code, unused_variables)]
|
709 - | #[cfg(test)]
|
710 - | mod single_member_struct_operation_test {
|
711 - |
|
712 - | /// When additional tokens are found past where we expect the end of the body,
|
713 - | /// the request should be rejected with a serialization exception.
|
714 - | /// Test ID: AdditionalTokensSingleMemberStruct
|
715 - | #[::tokio::test]
|
716 - | #[::tracing_test::traced_test]
|
717 - | async fn additional_tokens_single_member_struct_malformed_request() {
|
718 - | {
|
719 - | #[allow(unused_mut)]
|
720 - | let mut http_request = ::http::Request::builder()
|
721 - | .uri("/service/RpcV2CborService/operation/SingleMemberStructOperation")
|
722 - | .method("POST")
|
723 - | .header("smithy-protocol", "rpc-v2-cbor")
|
724 - | .header("Accept", "application/cbor")
|
725 - | .header("Content-Type", "application/cbor")
|
726 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
727 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
728 - | "v/+//w==".as_bytes(),
|
729 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
730 - | )),
|
731 - | ))
|
732 - | .unwrap();
|
733 - | #[allow(unused_mut)]
|
734 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
735 - | let config = crate::service::RpcV2CborServiceConfig::builder().build();
|
736 - | let service = crate::service::RpcV2CborService::builder::<::hyper::body::Body, _, _, _>(config)
|
737 - | .single_member_struct_operation(move |input: crate::input::SingleMemberStructOperationInput| {
|
738 - | let sender = sender.clone();
|
739 - | async move {
|
740 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::SingleMemberStructOperationOutput };
|
741 - | sender.send(()).await.expect("receiver dropped early");
|
742 - | result
|
743 - | }
|
744 - | })
|
745 - | .build_unchecked();
|
746 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
747 - | .await
|
748 - | .expect("unable to make an HTTP request");
|
749 - | ::pretty_assertions::assert_eq!(
|
750 - | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
751 - | http_response.status()
|
752 - | );
|
753 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
754 - | .await
|
755 - | .expect("unable to extract body to bytes");
|
756 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
757 - | &body,
|
758 - | "oA==",
|
759 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
760 - | ));
|
1163 + | impl
|
1164 + | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1165 + | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
1166 + | > for crate::error::StreamingOperationError
|
1167 + | {
|
1168 + | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1169 + | match crate::protocol_serde::shape_streaming_operation::ser_streaming_operation_http_error(
|
1170 + | &self,
|
1171 + | ) {
|
1172 + | Ok(mut response) => {
|
1173 + | response.extensions_mut().insert(
|
1174 + | ::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(
|
1175 + | self.name(),
|
1176 + | ),
|
1177 + | );
|
1178 + | response
|
1179 + | }
|
1180 + | Err(e) => {
|
1181 + | ::tracing::error!(error = %e, "failed to serialize response");
|
1182 + | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
1183 + | }
|
761 1184 | }
|
762 1185 | }
|
763 1186 | }
|
764 1187 |
|
765 1188 | ::pin_project_lite::pin_project! {
|
766 1189 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
767 - | /// [`EmptyStructOperationInput`](crate::input::EmptyStructOperationInput) using modelled bindings.
|
768 - | pub struct EmptyStructOperationInputFuture {
|
769 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EmptyStructOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
1190 + | /// [`StreamingOperationWithInitialDataInput`](crate::input::StreamingOperationWithInitialDataInput) using modelled bindings.
|
1191 + | pub struct StreamingOperationWithInitialDataInputFuture {
|
1192 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::StreamingOperationWithInitialDataInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
770 1193 | }
|
771 1194 | }
|
772 1195 |
|
773 - | impl std::future::Future for EmptyStructOperationInputFuture {
|
1196 + | impl std::future::Future for StreamingOperationWithInitialDataInputFuture {
|
774 1197 | type Output = Result<
|
775 - | crate::input::EmptyStructOperationInput,
|
1198 + | crate::input::StreamingOperationWithInitialDataInput,
|
776 1199 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
777 1200 | >;
|
778 1201 |
|
779 1202 | fn poll(
|
780 1203 | self: std::pin::Pin<&mut Self>,
|
781 1204 | cx: &mut std::task::Context<'_>,
|
782 1205 | ) -> std::task::Poll<Self::Output> {
|
783 1206 | let this = self.project();
|
784 1207 | this.inner.as_mut().poll(cx)
|
785 1208 | }
|
786 1209 | }
|
787 1210 |
|
788 1211 | impl<B>
|
789 1212 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
790 1213 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
791 1214 | B,
|
792 - | > for crate::input::EmptyStructOperationInput
|
1215 + | > for crate::input::StreamingOperationWithInitialDataInput
|
793 1216 | where
|
794 1217 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
795 1218 | B: 'static,
|
796 1219 |
|
1220 + | B: Into<::aws_smithy_types::byte_stream::ByteStream>,
|
797 1221 | B::Data: Send,
|
798 1222 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
799 1223 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
800 1224 | {
|
801 1225 | type Rejection =
|
802 1226 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
803 - | type Future = EmptyStructOperationInputFuture;
|
1227 + | type Future = StreamingOperationWithInitialDataInputFuture;
|
804 1228 |
|
805 1229 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
806 1230 | let fut = async move {
|
807 1231 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
808 1232 | request.headers(),
|
809 - | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
810 - | ) {
|
811 - | return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
812 - | }
|
813 - | crate::protocol_serde::shape_empty_struct_operation::de_empty_struct_operation_http_request(request)
|
814 - | .await
|
815 - | };
|
816 - | use ::futures_util::future::TryFutureExt;
|
817 - | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
|
818 - | ::tracing::debug!(error = %e, "failed to deserialize request");
|
819 - | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
|
820 - | });
|
821 - | EmptyStructOperationInputFuture {
|
822 - | inner: Box::pin(fut),
|
823 - | }
|
824 - | }
|
825 - | }
|
826 - | impl
|
827 - | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
828 - | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
829 - | > for crate::output::EmptyStructOperationOutput
|
830 - | {
|
831 - | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
832 - | match crate::protocol_serde::shape_empty_struct_operation::ser_empty_struct_operation_http_response(self) {
|
833 - | Ok(response) => response,
|
834 - | Err(e) => {
|
835 - | ::tracing::error!(error = %e, "failed to serialize response");
|
836 - | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
837 - | }
|
838 - | }
|
839 - | }
|
840 - | }
|
841 - |
|
842 - | #[allow(unreachable_code, unused_variables)]
|
843 - | #[cfg(test)]
|
844 - | mod empty_struct_operation_test {
|
845 - |
|
846 - | /// When additional tokens are found past where we expect the end of the body,
|
847 - | /// the request should be rejected with a serialization exception.
|
848 - | /// Test ID: AdditionalTokensEmptyStruct
|
849 - | #[::tokio::test]
|
850 - | #[::tracing_test::traced_test]
|
851 - | #[should_panic]
|
852 - | async fn additional_tokens_empty_struct_malformed_request() {
|
853 - | {
|
854 - | #[allow(unused_mut)]
|
855 - | let mut http_request = ::http::Request::builder()
|
856 - | .uri("/service/RpcV2CborService/operation/EmptyStructOperation")
|
857 - | .method("POST")
|
858 - | .header("smithy-protocol", "rpc-v2-cbor")
|
859 - | .header("Accept", "application/cbor")
|
860 - | .header("Content-Type", "application/cbor")
|
861 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
862 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
863 - | "v/+//w==".as_bytes(),
|
864 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
865 - | )),
|
866 - | ))
|
867 - | .unwrap();
|
868 - | #[allow(unused_mut)]
|
869 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
870 - | let config = crate::service::RpcV2CborServiceConfig::builder().build();
|
871 - | let service = crate::service::RpcV2CborService::builder::<::hyper::body::Body, _, _, _>(config)
|
872 - | .empty_struct_operation(move |input: crate::input::EmptyStructOperationInput| {
|
873 - | let sender = sender.clone();
|
874 - | async move {
|
875 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::EmptyStructOperationOutput };
|
876 - | sender.send(()).await.expect("receiver dropped early");
|
877 - | result
|
878 - | }
|
879 - | })
|
880 - | .build_unchecked();
|
881 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
882 - | .await
|
883 - | .expect("unable to make an HTTP request");
|
884 - | ::pretty_assertions::assert_eq!(
|
885 - | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
886 - | http_response.status()
|
887 - | );
|
888 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
889 - | .await
|
890 - | .expect("unable to extract body to bytes");
|
891 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
892 - | &body,
|
893 - | "oA==",
|
894 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
895 - | ));
|
896 - | }
|
897 - | }
|
898 - | }
|
899 - |
|
900 - | ::pin_project_lite::pin_project! {
|
901 - | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
902 - | /// [`ComplexStructOperationInput`](crate::input::ComplexStructOperationInput) using modelled bindings.
|
903 - | pub struct ComplexStructOperationInputFuture {
|
904 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ComplexStructOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
905 - | }
|
906 - | }
|
907 - |
|
908 - | impl std::future::Future for ComplexStructOperationInputFuture {
|
909 - | type Output = Result<
|
910 - | crate::input::ComplexStructOperationInput,
|
911 - | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
912 - | >;
|
913 - |
|
914 - | fn poll(
|
915 - | self: std::pin::Pin<&mut Self>,
|
916 - | cx: &mut std::task::Context<'_>,
|
917 - | ) -> std::task::Poll<Self::Output> {
|
918 - | let this = self.project();
|
919 - | this.inner.as_mut().poll(cx)
|
920 - | }
|
921 - | }
|
922 - |
|
923 - | impl<B>
|
924 - | ::aws_smithy_legacy_http_server::request::FromRequest<
|
925 - | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
926 - | B,
|
927 - | > for crate::input::ComplexStructOperationInput
|
928 - | where
|
929 - | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
930 - | B: 'static,
|
931 - |
|
932 - | B::Data: Send,
|
933 - | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
934 - | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
935 - | {
|
936 - | type Rejection =
|
937 - | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
938 - | type Future = ComplexStructOperationInputFuture;
|
939 - |
|
940 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
941 - | let fut = async move {
|
942 - | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
1233 + | &crate::mimes::CONTENT_TYPE_APPLICATION_VND_AMAZON_EVENTSTREAM,
|
1234 + | ) && !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
943 1235 | request.headers(),
|
944 1236 | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
945 1237 | ) {
|
946 1238 | return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
947 1239 | }
|
948 - | crate::protocol_serde::shape_complex_struct_operation::de_complex_struct_operation_http_request(request)
|
1240 + | crate::protocol_serde::shape_streaming_operation_with_initial_data::de_streaming_operation_with_initial_data_http_request(request)
|
949 1241 | .await
|
950 1242 | };
|
951 1243 | use ::futures_util::future::TryFutureExt;
|
952 1244 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
|
953 1245 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
954 1246 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
|
955 1247 | });
|
956 - | ComplexStructOperationInputFuture {
|
1248 + | StreamingOperationWithInitialDataInputFuture {
|
957 1249 | inner: Box::pin(fut),
|
958 1250 | }
|
959 1251 | }
|
960 1252 | }
|
961 1253 | impl
|
962 1254 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
963 1255 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
964 - | > for crate::output::ComplexStructOperationOutput
|
1256 + | > for crate::output::StreamingOperationWithInitialDataOutput
|
965 1257 | {
|
966 1258 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
967 - | match crate::protocol_serde::shape_complex_struct_operation::ser_complex_struct_operation_http_response(self) {
|
1259 + | match crate::protocol_serde::shape_streaming_operation_with_initial_data::ser_streaming_operation_with_initial_data_http_response(self) {
|
968 1260 | Ok(response) => response,
|
969 1261 | Err(e) => {
|
970 1262 | ::tracing::error!(error = %e, "failed to serialize response");
|
971 1263 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
972 1264 | }
|
973 1265 | }
|
974 1266 | }
|
975 1267 | }
|
976 1268 | impl
|
977 1269 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
978 1270 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
979 - | > for crate::error::ComplexStructOperationError
|
1271 + | > for crate::error::StreamingOperationWithInitialDataError
|
980 1272 | {
|
981 1273 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
982 - | match crate::protocol_serde::shape_complex_struct_operation::ser_complex_struct_operation_http_error(&self) {
|
1274 + | match crate::protocol_serde::shape_streaming_operation_with_initial_data::ser_streaming_operation_with_initial_data_http_error(&self) {
|
983 1275 | Ok(mut response) => {
|
984 1276 | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
985 1277 | response
|
986 1278 | },
|
987 1279 | Err(e) => {
|
988 1280 | ::tracing::error!(error = %e, "failed to serialize response");
|
989 1281 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
990 1282 | }
|
991 1283 | }
|
992 1284 | }
|
993 1285 | }
|
994 1286 |
|
995 1287 | ::pin_project_lite::pin_project! {
|
996 1288 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
997 - | /// [`ErrorSerializationOperationInput`](crate::input::ErrorSerializationOperationInput) using modelled bindings.
|
998 - | pub struct ErrorSerializationOperationInputFuture {
|
999 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ErrorSerializationOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
1289 + | /// [`StreamingOperationWithInitialResponseInput`](crate::input::StreamingOperationWithInitialResponseInput) using modelled bindings.
|
1290 + | pub struct StreamingOperationWithInitialResponseInputFuture {
|
1291 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::StreamingOperationWithInitialResponseInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
1000 1292 | }
|
1001 1293 | }
|
1002 1294 |
|
1003 - | impl std::future::Future for ErrorSerializationOperationInputFuture {
|
1295 + | impl std::future::Future for StreamingOperationWithInitialResponseInputFuture {
|
1004 1296 | type Output = Result<
|
1005 - | crate::input::ErrorSerializationOperationInput,
|
1297 + | crate::input::StreamingOperationWithInitialResponseInput,
|
1006 1298 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
1007 1299 | >;
|
1008 1300 |
|
1009 1301 | fn poll(
|
1010 1302 | self: std::pin::Pin<&mut Self>,
|
1011 1303 | cx: &mut std::task::Context<'_>,
|
1012 1304 | ) -> std::task::Poll<Self::Output> {
|
1013 1305 | let this = self.project();
|
1014 1306 | this.inner.as_mut().poll(cx)
|
1015 1307 | }
|
1016 1308 | }
|
1017 1309 |
|
1018 1310 | impl<B>
|
1019 1311 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
1020 1312 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
1021 1313 | B,
|
1022 - | > for crate::input::ErrorSerializationOperationInput
|
1314 + | > for crate::input::StreamingOperationWithInitialResponseInput
|
1023 1315 | where
|
1024 1316 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
1025 1317 | B: 'static,
|
1026 1318 |
|
1319 + | B: Into<::aws_smithy_types::byte_stream::ByteStream>,
|
1027 1320 | B::Data: Send,
|
1028 1321 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
1029 1322 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
1030 1323 | {
|
1031 1324 | type Rejection =
|
1032 1325 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
1033 - | type Future = ErrorSerializationOperationInputFuture;
|
1326 + | type Future = StreamingOperationWithInitialResponseInputFuture;
|
1034 1327 |
|
1035 1328 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1036 1329 | let fut = async move {
|
1037 1330 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
1331 + | request.headers(),
|
1332 + | &crate::mimes::CONTENT_TYPE_APPLICATION_VND_AMAZON_EVENTSTREAM,
|
1333 + | ) && !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
1038 1334 | request.headers(),
|
1039 1335 | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
1040 1336 | ) {
|
1041 1337 | return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
1042 1338 | }
|
1043 - | crate::protocol_serde::shape_error_serialization_operation::de_error_serialization_operation_http_request(request)
|
1339 + | crate::protocol_serde::shape_streaming_operation_with_initial_response::de_streaming_operation_with_initial_response_http_request(request)
|
1044 1340 | .await
|
1045 1341 | };
|
1046 1342 | use ::futures_util::future::TryFutureExt;
|
1047 1343 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
|
1048 1344 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1049 1345 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
|
1050 1346 | });
|
1051 - | ErrorSerializationOperationInputFuture {
|
1347 + | StreamingOperationWithInitialResponseInputFuture {
|
1052 1348 | inner: Box::pin(fut),
|
1053 1349 | }
|
1054 1350 | }
|
1055 1351 | }
|
1056 1352 | impl
|
1057 1353 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1058 1354 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
1059 - | > for crate::output::ErrorSerializationOperationOutput
|
1355 + | > for crate::output::StreamingOperationWithInitialResponseOutput
|
1060 1356 | {
|
1061 1357 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1062 - | match crate::protocol_serde::shape_error_serialization_operation::ser_error_serialization_operation_http_response(self) {
|
1358 + | match crate::protocol_serde::shape_streaming_operation_with_initial_response::ser_streaming_operation_with_initial_response_http_response(self) {
|
1063 1359 | Ok(response) => response,
|
1064 1360 | Err(e) => {
|
1065 1361 | ::tracing::error!(error = %e, "failed to serialize response");
|
1066 1362 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
1067 1363 | }
|
1068 1364 | }
|
1069 1365 | }
|
1070 1366 | }
|
1071 1367 | impl
|
1072 1368 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1073 1369 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
1074 - | > for crate::error::ErrorSerializationOperationError
|
1370 + | > for crate::error::StreamingOperationWithInitialResponseError
|
1075 1371 | {
|
1076 1372 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1077 - | match crate::protocol_serde::shape_error_serialization_operation::ser_error_serialization_operation_http_error(&self) {
|
1373 + | match crate::protocol_serde::shape_streaming_operation_with_initial_response::ser_streaming_operation_with_initial_response_http_error(&self) {
|
1078 1374 | Ok(mut response) => {
|
1079 1375 | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
1080 1376 | response
|
1081 1377 | },
|
1082 1378 | Err(e) => {
|
1083 1379 | ::tracing::error!(error = %e, "failed to serialize response");
|
1084 1380 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
1085 1381 | }
|
1086 1382 | }
|
1087 1383 | }
|
1088 1384 | }
|
1089 1385 |
|
1090 - | #[allow(unreachable_code, unused_variables)]
|
1091 - | #[cfg(test)]
|
1092 - | mod error_serialization_operation_test {
|
1093 - |
|
1094 - | /// Despite the operation output being a structure shape with the `@error` trait,
|
1095 - | /// `__type` field should, in a strict interpretation of the spec, not be included,
|
1096 - | /// because we're not serializing a server error response. However, we do, because
|
1097 - | /// there shouldn't™️ be any harm in doing so, and it greatly simplifies the
|
1098 - | /// code generator. This test just pins this behavior in case we ever modify it.
|
1099 - | /// Test ID: OperationOutputSerializationQuestionablyIncludesTypeField
|
1100 - | #[::tokio::test]
|
1101 - | #[::tracing_test::traced_test]
|
1102 - | async fn operation_output_serialization_questionably_includes_type_field_response() {
|
1103 - | let output = crate::output::ErrorSerializationOperationOutput {
|
1104 - | error_shape: ::std::option::Option::Some(crate::error::ValidationException {
|
1105 - | message: "ValidationException message field".to_owned(),
|
1106 - | field_list: ::std::option::Option::None,
|
1107 - | }),
|
1108 - | };
|
1109 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1110 - | let http_response = output.into_response();
|
1111 - | ::pretty_assertions::assert_eq!(
|
1112 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1113 - | http_response.status()
|
1114 - | );
|
1115 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1116 - | .await
|
1117 - | .expect("unable to extract body to bytes");
|
1118 - | ::aws_smithy_protocol_test::assert_ok(
|
1119 - | ::aws_smithy_protocol_test::validate_body(&body, "v2plcnJvclNoYXBlv2ZfX3R5cGV4JHNtaXRoeS5mcmFtZXdvcmsjVmFsaWRhdGlvbkV4Y2VwdGlvbmdtZXNzYWdleCFWYWxpZGF0aW9uRXhjZXB0aW9uIG1lc3NhZ2UgZmllbGT//w==", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
1120 - | );
|
1121 - | }
|
1122 - |
|
1123 - | /// When invalid input is provided the request should be rejected with
|
1124 - | /// a validation exception, and a `__type` field should be included
|
1125 - | /// Test ID: ErrorSerializationIncludesTypeField
|
1126 - | #[::tokio::test]
|
1127 - | #[::tracing_test::traced_test]
|
1128 - | async fn error_serialization_includes_type_field_malformed_request() {
|
1129 - | {
|
1130 - | #[allow(unused_mut)]
|
1131 - | let mut http_request = ::http::Request::builder()
|
1132 - | .uri("/service/RpcV2CborService/operation/ErrorSerializationOperation")
|
1133 - | .method("POST")
|
1134 - | .header("smithy-protocol", "rpc-v2-cbor")
|
1135 - | .header("Accept", "application/cbor")
|
1136 - | .header("Content-Type", "application/cbor")
|
1137 - | .body(::aws_smithy_legacy_http_server::body::Body::from(
|
1138 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1139 - | "oA==".as_bytes(),
|
1140 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
1141 - | )),
|
1142 - | ))
|
1143 - | .unwrap();
|
1144 - | #[allow(unused_mut)]
|
1145 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1146 - | let config = crate::service::RpcV2CborServiceConfig::builder().build();
|
1147 - | let service = crate::service::RpcV2CborService::builder::<::hyper::body::Body, _, _, _>(config)
|
1148 - | .error_serialization_operation(move |input: crate::input::ErrorSerializationOperationInput| {
|
1149 - | let sender = sender.clone();
|
1150 - | async move {
|
1151 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::ErrorSerializationOperationOutput, crate::error::ErrorSerializationOperationError> };
|
1152 - | sender.send(()).await.expect("receiver dropped early");
|
1153 - | result
|
1154 - | }
|
1155 - | })
|
1156 - | .build_unchecked();
|
1157 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1158 - | .await
|
1159 - | .expect("unable to make an HTTP request");
|
1160 - | ::pretty_assertions::assert_eq!(
|
1161 - | ::http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1162 - | http_response.status()
|
1163 - | );
|
1164 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1165 - | .await
|
1166 - | .expect("unable to extract body to bytes");
|
1167 - | ::aws_smithy_protocol_test::assert_ok(
|
1168 - | ::aws_smithy_protocol_test::validate_body(&body, "v2ZfX3R5cGV4JHNtaXRoeS5mcmFtZXdvcmsjVmFsaWRhdGlvbkV4Y2VwdGlvbmdtZXNzYWdleGsxIHZhbGlkYXRpb24gZXJyb3IgZGV0ZWN0ZWQuIFZhbHVlIGF0ICcvcmVxdWlyZWRCbG9iJyBmYWlsZWQgdG8gc2F0aXNmeSBjb25zdHJhaW50OiBNZW1iZXIgbXVzdCBub3QgYmUgbnVsbGlmaWVsZExpc3SBv2RwYXRobS9yZXF1aXJlZEJsb2JnbWVzc2FnZXhOVmFsdWUgYXQgJy9yZXF1aXJlZEJsb2InIGZhaWxlZCB0byBzYXRpc2Z5IGNvbnN0cmFpbnQ6IE1lbWJlciBtdXN0IG5vdCBiZSBudWxs//8=", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
1169 - | );
|
1170 - | }
|
1171 - | }
|
1172 - | }
|
1173 - |
|
1174 1386 | ::pin_project_lite::pin_project! {
|
1175 1387 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1176 - | /// [`SimpleStructOperationInput`](crate::input::SimpleStructOperationInput) using modelled bindings.
|
1177 - | pub struct SimpleStructOperationInputFuture {
|
1178 - | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SimpleStructOperationInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
1388 + | /// [`StreamingOperationWithOptionalDataInput`](crate::input::StreamingOperationWithOptionalDataInput) using modelled bindings.
|
1389 + | pub struct StreamingOperationWithOptionalDataInputFuture {
|
1390 + | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::StreamingOperationWithOptionalDataInput, ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
1179 1391 | }
|
1180 1392 | }
|
1181 1393 |
|
1182 - | impl std::future::Future for SimpleStructOperationInputFuture {
|
1394 + | impl std::future::Future for StreamingOperationWithOptionalDataInputFuture {
|
1183 1395 | type Output = Result<
|
1184 - | crate::input::SimpleStructOperationInput,
|
1396 + | crate::input::StreamingOperationWithOptionalDataInput,
|
1185 1397 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
1186 1398 | >;
|
1187 1399 |
|
1188 1400 | fn poll(
|
1189 1401 | self: std::pin::Pin<&mut Self>,
|
1190 1402 | cx: &mut std::task::Context<'_>,
|
1191 1403 | ) -> std::task::Poll<Self::Output> {
|
1192 1404 | let this = self.project();
|
1193 1405 | this.inner.as_mut().poll(cx)
|
1194 1406 | }
|
1195 1407 | }
|
1196 1408 |
|
1197 1409 | impl<B>
|
1198 1410 | ::aws_smithy_legacy_http_server::request::FromRequest<
|
1199 1411 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
1200 1412 | B,
|
1201 - | > for crate::input::SimpleStructOperationInput
|
1413 + | > for crate::input::StreamingOperationWithOptionalDataInput
|
1202 1414 | where
|
1203 1415 | B: ::aws_smithy_legacy_http_server::body::HttpBody + Send,
|
1204 1416 | B: 'static,
|
1205 1417 |
|
1418 + | B: Into<::aws_smithy_types::byte_stream::ByteStream>,
|
1206 1419 | B::Data: Send,
|
1207 1420 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
1208 1421 | From<<B as ::aws_smithy_legacy_http_server::body::HttpBody>::Error>,
|
1209 1422 | {
|
1210 1423 | type Rejection =
|
1211 1424 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
1212 - | type Future = SimpleStructOperationInputFuture;
|
1425 + | type Future = StreamingOperationWithOptionalDataInputFuture;
|
1213 1426 |
|
1214 1427 | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1215 1428 | let fut = async move {
|
1216 1429 | if !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
1430 + | request.headers(),
|
1431 + | &crate::mimes::CONTENT_TYPE_APPLICATION_VND_AMAZON_EVENTSTREAM,
|
1432 + | ) && !::aws_smithy_legacy_http_server::protocol::accept_header_classifier(
|
1217 1433 | request.headers(),
|
1218 1434 | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
1219 1435 | ) {
|
1220 1436 | return Err(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
1221 1437 | }
|
1222 - | crate::protocol_serde::shape_simple_struct_operation::de_simple_struct_operation_http_request(request)
|
1438 + | crate::protocol_serde::shape_streaming_operation_with_optional_data::de_streaming_operation_with_optional_data_http_request(request)
|
1223 1439 | .await
|
1224 1440 | };
|
1225 1441 | use ::futures_util::future::TryFutureExt;
|
1226 1442 | let fut = fut.map_err(|e: ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
|
1227 1443 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1228 1444 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e)
|
1229 1445 | });
|
1230 - | SimpleStructOperationInputFuture {
|
1446 + | StreamingOperationWithOptionalDataInputFuture {
|
1231 1447 | inner: Box::pin(fut),
|
1232 1448 | }
|
1233 1449 | }
|
1234 1450 | }
|
1235 1451 | impl
|
1236 1452 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1237 1453 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
1238 - | > for crate::output::SimpleStructOperationOutput
|
1454 + | > for crate::output::StreamingOperationWithOptionalDataOutput
|
1239 1455 | {
|
1240 1456 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1241 - | match crate::protocol_serde::shape_simple_struct_operation::ser_simple_struct_operation_http_response(self) {
|
1457 + | match crate::protocol_serde::shape_streaming_operation_with_optional_data::ser_streaming_operation_with_optional_data_http_response(self) {
|
1242 1458 | Ok(response) => response,
|
1243 1459 | Err(e) => {
|
1244 1460 | ::tracing::error!(error = %e, "failed to serialize response");
|
1245 1461 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
1246 1462 | }
|
1247 1463 | }
|
1248 1464 | }
|
1249 1465 | }
|
1250 1466 | impl
|
1251 1467 | ::aws_smithy_legacy_http_server::response::IntoResponse<
|
1252 1468 | ::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
1253 - | > for crate::error::SimpleStructOperationError
|
1469 + | > for crate::error::StreamingOperationWithOptionalDataError
|
1254 1470 | {
|
1255 1471 | fn into_response(self) -> ::aws_smithy_legacy_http_server::response::Response {
|
1256 - | match crate::protocol_serde::shape_simple_struct_operation::ser_simple_struct_operation_http_error(&self) {
|
1472 + | match crate::protocol_serde::shape_streaming_operation_with_optional_data::ser_streaming_operation_with_optional_data_http_error(&self) {
|
1257 1473 | Ok(mut response) => {
|
1258 1474 | response.extensions_mut().insert(::aws_smithy_legacy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
1259 1475 | response
|
1260 1476 | },
|
1261 1477 | Err(e) => {
|
1262 1478 | ::tracing::error!(error = %e, "failed to serialize response");
|
1263 1479 | ::aws_smithy_legacy_http_server::response::IntoResponse::<::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_legacy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
1264 1480 | }
|
1265 1481 | }
|
1266 1482 | }
|
1267 1483 | }
|
1268 - |
|
1269 - | #[allow(unreachable_code, unused_variables)]
|
1270 - | #[cfg(test)]
|
1271 - | mod simple_struct_operation_test {
|
1272 - |
|
1273 - | /// Test ID: SimpleStruct
|
1274 - | #[::tokio::test]
|
1275 - | #[::tracing_test::traced_test]
|
1276 - | async fn simple_struct_response() {
|
1277 - | let output =crate::output::SimpleStructOperationOutput {
|
1278 - | blob:
|
1279 - | ::std::option::Option::Some(
|
1280 - | ::aws_smithy_types::Blob::new("blobby blob")
|
1281 - | )
|
1282 - | ,
|
1283 - | boolean:
|
1284 - | ::std::option::Option::Some(
|
1285 - | false
|
1286 - | )
|
1287 - | ,
|
1288 - | string:
|
1289 - | ::std::option::Option::Some(
|
1290 - | "There are three things all wise men fear: the sea in storm, a night with no moon, and the anger of a gentle man.".to_owned()
|
1291 - | )
|
1292 - | ,
|
1293 - | byte:
|
1294 - | ::std::option::Option::Some(
|
1295 - | 69
|
1296 - | )
|
1297 - | ,
|
1298 - | short:
|
1299 - | ::std::option::Option::Some(
|
1300 - | 70
|
1301 - | )
|
1302 - | ,
|
1303 - | integer:
|
1304 - | ::std::option::Option::Some(
|
1305 - | 71
|
1306 - | )
|
1307 - | ,
|
1308 - | long:
|
1309 - | ::std::option::Option::Some(
|
1310 - | 72
|
1311 - | )
|
1312 - | ,
|
1313 - | float:
|
1314 - | ::std::option::Option::Some(
|
1315 - | 0.69_f32
|
1316 - | )
|
1317 - | ,
|
1318 - | double:
|
1319 - | ::std::option::Option::Some(
|
1320 - | 0.6969_f64
|
1321 - | )
|
1322 - | ,
|
1323 - | timestamp:
|
1324 - | ::std::option::Option::Some(
|
1325 - | ::aws_smithy_types::DateTime::from_fractional_secs(1546300800, 0_f64)
|
1326 - | )
|
1327 - | ,
|
1328 - | r#enum:
|
1329 - | ::std::option::Option::Some(
|
1330 - | "DIAMOND".parse::<crate::model::Suit>().expect("static value validated to member")
|
1331 - | )
|
1332 - | ,
|
1333 - | required_blob:
|
1334 - | ::aws_smithy_types::Blob::new("blobby blob")
|
1335 - | ,
|
1336 - | required_boolean:
|
1337 - | false
|
1338 - | ,
|
1339 - | required_string:
|
1340 - | "There are three things all wise men fear: the sea in storm, a night with no moon, and the anger of a gentle man.".to_owned()
|
1341 - | ,
|
1342 - | required_byte:
|
1343 - | 69
|
1344 - | ,
|
1345 - | required_short:
|
1346 - | 70
|
1347 - | ,
|
1348 - | required_integer:
|
1349 - | 71
|
1350 - | ,
|
1351 - | required_long:
|
1352 - | 72
|
1353 - | ,
|
1354 - | required_float:
|
1355 - | 0.69_f32
|
1356 - | ,
|
1357 - | required_double:
|
1358 - | 0.6969_f64
|
1359 - | ,
|
1360 - | required_timestamp:
|
1361 - | ::aws_smithy_types::DateTime::from_fractional_secs(1546300800, 0_f64)
|
1362 - | ,
|
1363 - | required_enum:
|
1364 - | "DIAMOND".parse::<crate::model::Suit>().expect("static value validated to member")
|
1365 - | ,
|
1366 - | }
|
1367 - | ;
|
1368 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1369 - | let http_response = output.into_response();
|
1370 - | ::pretty_assertions::assert_eq!(
|
1371 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1372 - | http_response.status()
|
1373 - | );
|
1374 - | let expected_headers = [
|
1375 - | ("Content-Type", "application/cbor"),
|
1376 - | ("smithy-protocol", "rpc-v2-cbor"),
|
1377 - | ];
|
1378 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1379 - | http_response.headers(),
|
1380 - | expected_headers,
|
1381 - | ));
|
1382 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1383 - | .await
|
1384 - | .expect("unable to extract body to bytes");
|
1385 - | ::aws_smithy_protocol_test::assert_ok(
|
1386 - | ::aws_smithy_protocol_test::validate_body(&body, "v2RibG9iS2Jsb2JieSBibG9iZ2Jvb2xlYW70ZnN0cmluZ3hwVGhlcmUgYXJlIHRocmVlIHRoaW5ncyBhbGwgd2lzZSBtZW4gZmVhcjogdGhlIHNlYSBpbiBzdG9ybSwgYSBuaWdodCB3aXRoIG5vIG1vb24sIGFuZCB0aGUgYW5nZXIgb2YgYSBnZW50bGUgbWFuLmRieXRlGEVlc2hvcnQYRmdpbnRlZ2VyGEdkbG9uZxhIZWZsb2F0+j8wo9dmZG91Ymxl+z/mTQE6kqMFaXRpbWVzdGFtcMH7QdcKq2AAAABkZW51bWdESUFNT05EbHJlcXVpcmVkQmxvYktibG9iYnkgYmxvYm9yZXF1aXJlZEJvb2xlYW70bnJlcXVpcmVkU3RyaW5neHBUaGVyZSBhcmUgdGhyZWUgdGhpbmdzIGFsbCB3aXNlIG1lbiBmZWFyOiB0aGUgc2VhIGluIHN0b3JtLCBhIG5pZ2h0IHdpdGggbm8gbW9vbiwgYW5kIHRoZSBhbmdlciBvZiBhIGdlbnRsZSBtYW4ubHJlcXVpcmVkQnl0ZRhFbXJlcXVpcmVkU2hvcnQYRm9yZXF1aXJlZEludGVnZXIYR2xyZXF1aXJlZExvbmcYSG1yZXF1aXJlZEZsb2F0+j8wo9ducmVxdWlyZWREb3VibGX7P+ZNATqSowVxcmVxdWlyZWRUaW1lc3RhbXDB+0HXCqtgAAAAbHJlcXVpcmVkRW51bWdESUFNT05E/w==", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
1387 - | );
|
1388 - | }
|
1389 - | /// Test ID: SimpleStructWithOptionsSetToNone
|
1390 - | #[::tokio::test]
|
1391 - | #[::tracing_test::traced_test]
|
1392 - | async fn simple_struct_with_options_set_to_none_response() {
|
1393 - | let output =crate::output::SimpleStructOperationOutput {
|
1394 - | required_blob:
|
1395 - | ::aws_smithy_types::Blob::new("blobby blob")
|
1396 - | ,
|
1397 - | required_boolean:
|
1398 - | false
|
1399 - | ,
|
1400 - | required_string:
|
1401 - | "There are three things all wise men fear: the sea in storm, a night with no moon, and the anger of a gentle man.".to_owned()
|
1402 - | ,
|
1403 - | required_byte:
|
1404 - | 69
|
1405 - | ,
|
1406 - | required_short:
|
1407 - | 70
|
1408 - | ,
|
1409 - | required_integer:
|
1410 - | 71
|
1411 - | ,
|
1412 - | required_long:
|
1413 - | 72
|
1414 - | ,
|
1415 - | required_float:
|
1416 - | 0.69_f32
|
1417 - | ,
|
1418 - | required_double:
|
1419 - | 0.6969_f64
|
1420 - | ,
|
1421 - | required_timestamp:
|
1422 - | ::aws_smithy_types::DateTime::from_fractional_secs(1546300800, 0_f64)
|
1423 - | ,
|
1424 - | required_enum:
|
1425 - | "DIAMOND".parse::<crate::model::Suit>().expect("static value validated to member")
|
1426 - | ,
|
1427 - | blob:
|
1428 - | ::std::option::Option::None
|
1429 - | ,
|
1430 - | boolean:
|
1431 - | ::std::option::Option::None
|
1432 - | ,
|
1433 - | string:
|
1434 - | ::std::option::Option::None
|
1435 - | ,
|
1436 - | byte:
|
1437 - | ::std::option::Option::None
|
1438 - | ,
|
1439 - | short:
|
1440 - | ::std::option::Option::None
|
1441 - | ,
|
1442 - | integer:
|
1443 - | ::std::option::Option::None
|
1444 - | ,
|
1445 - | long:
|
1446 - | ::std::option::Option::None
|
1447 - | ,
|
1448 - | float:
|
1449 - | ::std::option::Option::None
|
1450 - | ,
|
1451 - | double:
|
1452 - | ::std::option::Option::None
|
1453 - | ,
|
1454 - | timestamp:
|
1455 - | ::std::option::Option::None
|
1456 - | ,
|
1457 - | r#enum:
|
1458 - | ::std::option::Option::None
|
1459 - | ,
|
1460 - | }
|
1461 - | ;
|
1462 - | use ::aws_smithy_legacy_http_server::response::IntoResponse;
|
1463 - | let http_response = output.into_response();
|
1464 - | ::pretty_assertions::assert_eq!(
|
1465 - | ::http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1466 - | http_response.status()
|
1467 - | );
|
1468 - | let expected_headers = [
|
1469 - | ("Content-Type", "application/cbor"),
|
1470 - | ("smithy-protocol", "rpc-v2-cbor"),
|
1471 - | ];
|
1472 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1473 - | http_response.headers(),
|
1474 - | expected_headers,
|
1475 - | ));
|
1476 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1477 - | .await
|
1478 - | .expect("unable to extract body to bytes");
|
1479 - | ::aws_smithy_protocol_test::assert_ok(
|
1480 - | ::aws_smithy_protocol_test::validate_body(&body, "v2xyZXF1aXJlZEJsb2JLYmxvYmJ5IGJsb2JvcmVxdWlyZWRCb29sZWFu9G5yZXF1aXJlZFN0cmluZ3hwVGhlcmUgYXJlIHRocmVlIHRoaW5ncyBhbGwgd2lzZSBtZW4gZmVhcjogdGhlIHNlYSBpbiBzdG9ybSwgYSBuaWdodCB3aXRoIG5vIG1vb24sIGFuZCB0aGUgYW5nZXIgb2YgYSBnZW50bGUgbWFuLmxyZXF1aXJlZEJ5dGUYRW1yZXF1aXJlZFNob3J0GEZvcmVxdWlyZWRJbnRlZ2VyGEdscmVxdWlyZWRMb25nGEhtcmVxdWlyZWRGbG9hdPo/MKPXbnJlcXVpcmVkRG91Ymxl+z/mTQE6kqMFcXJlcXVpcmVkVGltZXN0YW1wwftB1wqrYAAAAGxyZXF1aXJlZEVudW1nRElBTU9ORP8=", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
1481 - | );
|
1482 - | }
|
1483 - | }
|