110 110 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
111 111 | B: 'static,
|
112 112 |
|
113 113 | B::Data: Send,
|
114 114 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
115 115 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
116 116 | {
|
117 117 | type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
118 118 | type Future = SparseNullsOperationInputFuture;
|
119 119 |
|
120 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
120 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
121 121 | let fut = async move {
|
122 122 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
123 123 | request.headers(),
|
124 124 | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
125 125 | ) {
|
126 126 | return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
127 127 | }
|
128 128 | crate::protocol_serde::shape_sparse_nulls_operation::de_sparse_nulls_operation_http_request(request)
|
129 129 | .await
|
130 130 | };
|
131 131 | use ::futures_util::future::TryFutureExt;
|
132 132 | let fut = fut.map_err(
|
133 133 | |e: ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
|
134 134 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
135 135 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(
|
136 136 | e,
|
137 137 | )
|
138 138 | },
|
139 139 | );
|
140 140 | SparseNullsOperationInputFuture {
|
141 141 | inner: Box::pin(fut),
|
142 142 | }
|
143 143 | }
|
144 144 | }
|
145 145 | impl
|
146 146 | ::aws_smithy_http_server::response::IntoResponse<
|
147 147 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
148 148 | > for crate::output::SparseNullsOperationOutput
|
149 149 | {
|
150 150 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
151 151 | match crate::protocol_serde::shape_sparse_nulls_operation::ser_sparse_nulls_operation_http_response(self) {
|
152 152 | Ok(response) => response,
|
153 153 | Err(e) => {
|
154 154 | ::tracing::error!(error = %e, "failed to serialize response");
|
155 155 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
156 156 | }
|
157 157 | }
|
158 158 | }
|
159 159 | }
|
160 160 |
|
161 161 | #[allow(unreachable_code, unused_variables)]
|
162 162 | #[cfg(test)]
|
163 163 | mod sparse_nulls_operation_test {
|
164 164 |
|
165 165 | /// Serializes null values in maps
|
166 166 | /// Test ID: RpcV2CborSparseMapsSerializeNullValues
|
167 167 | #[::tokio::test]
|
168 168 | #[::tracing_test::traced_test]
|
169 169 | async fn rpc_v2_cbor_sparse_maps_serialize_null_values_request() {
|
170 170 | #[allow(unused_mut)]
|
171 - | let mut http_request = http::Request::builder()
|
171 + | let mut http_request = ::http_1x::Request::builder()
|
172 172 | .uri("/service/RpcV2Protocol/operation/SparseNullsOperation")
|
173 173 | .method("POST")
|
174 174 | .header("Accept", "application/cbor")
|
175 175 | .header("Content-Type", "application/cbor")
|
176 176 | .header("smithy-protocol", "rpc-v2-cbor")
|
177 - | .body(::aws_smithy_http_server::body::Body::from(
|
178 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
179 - | "v29zcGFyc2VTdHJpbmdNYXC/Y2Zvb/b//w==".as_bytes(),
|
180 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
177 + | .body(::aws_smithy_http_server::body::boxed(
|
178 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
179 + | &::aws_smithy_protocol_test::decode_body_data(
|
180 + | "v29zcGFyc2VTdHJpbmdNYXC/Y2Zvb/b//w==".as_bytes(),
|
181 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
182 + | ),
|
181 183 | )),
|
182 184 | ))
|
183 185 | .unwrap();
|
184 186 | #[allow(unused_mut)]
|
185 187 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
186 188 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
187 - | let service =
|
188 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
189 - | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
190 - | let sender = sender.clone();
|
191 - | async move {
|
192 - | let result = {
|
193 - | let expected = crate::input::SparseNullsOperationInput {
|
194 - | sparse_string_map: ::std::option::Option::Some({
|
195 - | let mut ret = ::std::collections::HashMap::new();
|
196 - | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
197 - | ret
|
198 - | }),
|
199 - | sparse_string_list: ::std::option::Option::None,
|
200 - | };
|
201 - | ::pretty_assertions::assert_eq!(input, expected);
|
202 - | let output = crate::output::SparseNullsOperationOutput {
|
203 - | sparse_string_list: ::std::option::Option::None,
|
204 - | sparse_string_map: ::std::option::Option::None,
|
205 - | };
|
206 - | output
|
207 - | };
|
208 - | sender.send(()).await.expect("receiver dropped early");
|
209 - | result
|
210 - | }
|
211 - | })
|
212 - | .build_unchecked();
|
189 + | let service = crate::service::RpcV2Protocol::builder::<
|
190 + | ::aws_smithy_http_server::body::BoxBody,
|
191 + | _,
|
192 + | _,
|
193 + | _,
|
194 + | >(config)
|
195 + | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
196 + | let sender = sender.clone();
|
197 + | async move {
|
198 + | let result = {
|
199 + | let expected = crate::input::SparseNullsOperationInput {
|
200 + | sparse_string_map: ::std::option::Option::Some({
|
201 + | let mut ret = ::std::collections::HashMap::new();
|
202 + | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
203 + | ret
|
204 + | }),
|
205 + | sparse_string_list: ::std::option::Option::None,
|
206 + | };
|
207 + | ::pretty_assertions::assert_eq!(input, expected);
|
208 + | let output = crate::output::SparseNullsOperationOutput {
|
209 + | sparse_string_list: ::std::option::Option::None,
|
210 + | sparse_string_map: ::std::option::Option::None,
|
211 + | };
|
212 + | output
|
213 + | };
|
214 + | sender.send(()).await.expect("receiver dropped early");
|
215 + | result
|
216 + | }
|
217 + | })
|
218 + | .build_unchecked();
|
213 219 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
214 220 | .await
|
215 221 | .expect("unable to make an HTTP request");
|
216 222 | assert!(
|
217 223 | receiver.recv().await.is_some(),
|
218 224 | "we expected operation handler to be invoked but it was not entered"
|
219 225 | );
|
220 226 | }
|
221 227 |
|
222 228 | /// Serializes null values in lists
|
223 229 | /// Test ID: RpcV2CborSparseListsSerializeNull
|
224 230 | #[::tokio::test]
|
225 231 | #[::tracing_test::traced_test]
|
226 232 | async fn rpc_v2_cbor_sparse_lists_serialize_null_request() {
|
227 233 | #[allow(unused_mut)]
|
228 - | let mut http_request = http::Request::builder()
|
234 + | let mut http_request = ::http_1x::Request::builder()
|
229 235 | .uri("/service/RpcV2Protocol/operation/SparseNullsOperation")
|
230 236 | .method("POST")
|
231 237 | .header("Accept", "application/cbor")
|
232 238 | .header("Content-Type", "application/cbor")
|
233 239 | .header("smithy-protocol", "rpc-v2-cbor")
|
234 - | .body(::aws_smithy_http_server::body::Body::from(
|
235 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
236 - | "v3BzcGFyc2VTdHJpbmdMaXN0n/b//w==".as_bytes(),
|
237 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
240 + | .body(::aws_smithy_http_server::body::boxed(
|
241 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
242 + | &::aws_smithy_protocol_test::decode_body_data(
|
243 + | "v3BzcGFyc2VTdHJpbmdMaXN0n/b//w==".as_bytes(),
|
244 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
245 + | ),
|
238 246 | )),
|
239 247 | ))
|
240 248 | .unwrap();
|
241 249 | #[allow(unused_mut)]
|
242 250 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
243 251 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
244 - | let service =
|
245 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
246 - | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
247 - | let sender = sender.clone();
|
248 - | async move {
|
249 - | let result = {
|
250 - | let expected = crate::input::SparseNullsOperationInput {
|
251 - | sparse_string_list: ::std::option::Option::Some(vec![
|
252 - | ::std::option::Option::None,
|
253 - | ]),
|
254 - | sparse_string_map: ::std::option::Option::None,
|
255 - | };
|
256 - | ::pretty_assertions::assert_eq!(input, expected);
|
257 - | let output = crate::output::SparseNullsOperationOutput {
|
258 - | sparse_string_list: ::std::option::Option::None,
|
259 - | sparse_string_map: ::std::option::Option::None,
|
260 - | };
|
261 - | output
|
262 - | };
|
263 - | sender.send(()).await.expect("receiver dropped early");
|
264 - | result
|
265 - | }
|
266 - | })
|
267 - | .build_unchecked();
|
252 + | let service = crate::service::RpcV2Protocol::builder::<
|
253 + | ::aws_smithy_http_server::body::BoxBody,
|
254 + | _,
|
255 + | _,
|
256 + | _,
|
257 + | >(config)
|
258 + | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
259 + | let sender = sender.clone();
|
260 + | async move {
|
261 + | let result = {
|
262 + | let expected = crate::input::SparseNullsOperationInput {
|
263 + | sparse_string_list: ::std::option::Option::Some(vec![
|
264 + | ::std::option::Option::None,
|
265 + | ]),
|
266 + | sparse_string_map: ::std::option::Option::None,
|
267 + | };
|
268 + | ::pretty_assertions::assert_eq!(input, expected);
|
269 + | let output = crate::output::SparseNullsOperationOutput {
|
270 + | sparse_string_list: ::std::option::Option::None,
|
271 + | sparse_string_map: ::std::option::Option::None,
|
272 + | };
|
273 + | output
|
274 + | };
|
275 + | sender.send(()).await.expect("receiver dropped early");
|
276 + | result
|
277 + | }
|
278 + | })
|
279 + | .build_unchecked();
|
268 280 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
269 281 | .await
|
270 282 | .expect("unable to make an HTTP request");
|
271 283 | assert!(
|
272 284 | receiver.recv().await.is_some(),
|
273 285 | "we expected operation handler to be invoked but it was not entered"
|
274 286 | );
|
275 287 | }
|
276 288 |
|
277 289 | /// Deserializes null values in maps
|
278 290 | /// Test ID: RpcV2CborSparseMapsDeserializeNullValues
|
279 291 | #[::tokio::test]
|
280 292 | #[::tracing_test::traced_test]
|
281 293 | async fn rpc_v2_cbor_sparse_maps_deserialize_null_values_response() {
|
282 294 | let output = crate::output::SparseNullsOperationOutput {
|
283 295 | sparse_string_map: ::std::option::Option::Some({
|
284 296 | let mut ret = ::std::collections::HashMap::new();
|
285 297 | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
286 298 | ret
|
287 299 | }),
|
288 300 | sparse_string_list: ::std::option::Option::None,
|
289 301 | };
|
290 302 | use ::aws_smithy_http_server::response::IntoResponse;
|
291 303 | let http_response = output.into_response();
|
292 304 | ::pretty_assertions::assert_eq!(
|
293 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
305 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
294 306 | http_response.status()
|
295 307 | );
|
296 308 | let expected_headers = [
|
297 309 | ("Content-Type", "application/cbor"),
|
298 310 | ("smithy-protocol", "rpc-v2-cbor"),
|
299 311 | ];
|
300 312 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
301 313 | http_response.headers(),
|
302 314 | expected_headers,
|
303 315 | ));
|
304 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
316 + | use ::http_body_util::BodyExt;
|
317 + | let body = http_response
|
318 + | .into_body()
|
319 + | .collect()
|
305 320 | .await
|
306 - | .expect("unable to extract body to bytes");
|
321 + | .expect("unable to collect body")
|
322 + | .to_bytes();
|
307 323 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
308 324 | &body,
|
309 325 | "v29zcGFyc2VTdHJpbmdNYXC/Y2Zvb/b//w==",
|
310 326 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
311 327 | ));
|
312 328 | }
|
313 329 |
|
314 330 | /// Deserializes null values in lists
|
315 331 | /// Test ID: RpcV2CborSparseListsDeserializeNull
|
316 332 | #[::tokio::test]
|
317 333 | #[::tracing_test::traced_test]
|
318 334 | async fn rpc_v2_cbor_sparse_lists_deserialize_null_response() {
|
319 335 | let output = crate::output::SparseNullsOperationOutput {
|
320 336 | sparse_string_list: ::std::option::Option::Some(vec![::std::option::Option::None]),
|
321 337 | sparse_string_map: ::std::option::Option::None,
|
322 338 | };
|
323 339 | use ::aws_smithy_http_server::response::IntoResponse;
|
324 340 | let http_response = output.into_response();
|
325 341 | ::pretty_assertions::assert_eq!(
|
326 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
342 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
327 343 | http_response.status()
|
328 344 | );
|
329 345 | let expected_headers = [
|
330 346 | ("Content-Type", "application/cbor"),
|
331 347 | ("smithy-protocol", "rpc-v2-cbor"),
|
332 348 | ];
|
333 349 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
334 350 | http_response.headers(),
|
335 351 | expected_headers,
|
336 352 | ));
|
337 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
353 + | use ::http_body_util::BodyExt;
|
354 + | let body = http_response
|
355 + | .into_body()
|
356 + | .collect()
|
338 357 | .await
|
339 - | .expect("unable to extract body to bytes");
|
358 + | .expect("unable to collect body")
|
359 + | .to_bytes();
|
340 360 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
341 361 | &body,
|
342 362 | "v3BzcGFyc2VTdHJpbmdMaXN0n/b//w==",
|
343 363 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
344 364 | ));
|
345 365 | }
|
346 366 | }
|
347 367 |
|
348 368 | ::pin_project_lite::pin_project! {
|
349 369 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
350 370 | /// [`OperationWithDefaultsInput`](crate::input::OperationWithDefaultsInput) using modelled bindings.
|
351 371 | pub struct OperationWithDefaultsInputFuture {
|
352 372 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::OperationWithDefaultsInput, ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
353 373 | }
|
354 374 | }
|
355 375 |
|
356 376 | impl std::future::Future for OperationWithDefaultsInputFuture {
|
357 377 | type Output = Result<
|
358 378 | crate::input::OperationWithDefaultsInput,
|
359 379 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
360 380 | >;
|
361 381 |
|
362 382 | fn poll(
|
363 383 | self: std::pin::Pin<&mut Self>,
|
364 384 | cx: &mut std::task::Context<'_>,
|
365 385 | ) -> std::task::Poll<Self::Output> {
|
366 386 | let this = self.project();
|
367 387 | this.inner.as_mut().poll(cx)
|
368 388 | }
|
369 389 | }
|
370 390 |
|
371 391 | impl<B>
|
372 392 | ::aws_smithy_http_server::request::FromRequest<
|
373 393 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
374 394 | B,
|
375 395 | > for crate::input::OperationWithDefaultsInput
|
376 396 | where
|
377 397 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
378 398 | B: 'static,
|
379 399 |
|
380 400 | B::Data: Send,
|
381 401 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
382 402 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
383 403 | {
|
384 404 | type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
385 405 | type Future = OperationWithDefaultsInputFuture;
|
386 406 |
|
387 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
407 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
388 408 | let fut = async move {
|
389 409 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
390 410 | request.headers(),
|
391 411 | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
392 412 | ) {
|
393 413 | return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
394 414 | }
|
395 415 | crate::protocol_serde::shape_operation_with_defaults::de_operation_with_defaults_http_request(request)
|
396 416 | .await
|
397 417 | };
|
1241 1286 | #[allow(unreachable_code, unused_variables)]
|
1242 1287 | #[cfg(test)]
|
1243 1288 | mod rpc_v2_cbor_sparse_maps_test {
|
1244 1289 |
|
1245 1290 | /// Serializes sparse maps
|
1246 1291 | /// Test ID: RpcV2CborSparseMaps
|
1247 1292 | #[::tokio::test]
|
1248 1293 | #[::tracing_test::traced_test]
|
1249 1294 | async fn rpc_v2_cbor_sparse_maps_request() {
|
1250 1295 | #[allow(unused_mut)]
|
1251 - | let mut http_request = http::Request::builder()
|
1296 + | let mut http_request = ::http_1x::Request::builder()
|
1252 1297 | .uri("/service/RpcV2Protocol/operation/RpcV2CborSparseMaps")
|
1253 1298 | .method("POST")
|
1254 1299 | .header("Accept", "application/cbor")
|
1255 1300 | .header("Content-Type", "application/cbor")
|
1256 1301 | .header("smithy-protocol", "rpc-v2-cbor")
|
1257 - | .body(::aws_smithy_http_server::body::Body::from(
|
1258 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1259 - | "v29zcGFyc2VTdHJ1Y3RNYXC/Y2Zvb79iaGlldGhlcmX/Y2Jher9iaGljYnll////".as_bytes(),
|
1260 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
1302 + | .body(::aws_smithy_http_server::body::boxed(
|
1303 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1304 + | &::aws_smithy_protocol_test::decode_body_data(
|
1305 + | "v29zcGFyc2VTdHJ1Y3RNYXC/Y2Zvb79iaGlldGhlcmX/Y2Jher9iaGljYnll////"
|
1306 + | .as_bytes(),
|
1307 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
1308 + | ),
|
1261 1309 | )),
|
1262 1310 | ))
|
1263 1311 | .unwrap();
|
1264 1312 | #[allow(unused_mut)]
|
1265 1313 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1266 1314 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
1267 - | let service =
|
1268 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1269 - | .rpc_v2_cbor_sparse_maps(move |input: crate::input::RpcV2CborSparseMapsInput| {
|
1270 - | let sender = sender.clone();
|
1271 - | async move {
|
1272 - | let result = {
|
1273 - | let expected = crate::input::RpcV2CborSparseMapsInput {
|
1274 - | sparse_struct_map: ::std::option::Option::Some({
|
1275 - | let mut ret = ::std::collections::HashMap::new();
|
1276 - | ret.insert(
|
1277 - | "foo".to_owned(),
|
1278 - | ::std::option::Option::Some(crate::model::GreetingStruct {
|
1279 - | hi: ::std::option::Option::Some("there".to_owned()),
|
1280 - | }),
|
1281 - | );
|
1282 - | ret.insert(
|
1283 - | "baz".to_owned(),
|
1284 - | ::std::option::Option::Some(crate::model::GreetingStruct {
|
1285 - | hi: ::std::option::Option::Some("bye".to_owned()),
|
1286 - | }),
|
1287 - | );
|
1288 - | ret
|
1315 + | let service = crate::service::RpcV2Protocol::builder::<
|
1316 + | ::aws_smithy_http_server::body::BoxBody,
|
1317 + | _,
|
1318 + | _,
|
1319 + | _,
|
1320 + | >(config)
|
1321 + | .rpc_v2_cbor_sparse_maps(move |input: crate::input::RpcV2CborSparseMapsInput| {
|
1322 + | let sender = sender.clone();
|
1323 + | async move {
|
1324 + | let result = {
|
1325 + | let expected = crate::input::RpcV2CborSparseMapsInput {
|
1326 + | sparse_struct_map: ::std::option::Option::Some({
|
1327 + | let mut ret = ::std::collections::HashMap::new();
|
1328 + | ret.insert(
|
1329 + | "foo".to_owned(),
|
1330 + | ::std::option::Option::Some(crate::model::GreetingStruct {
|
1331 + | hi: ::std::option::Option::Some("there".to_owned()),
|
1289 1332 | }),
|
1290 - | sparse_number_map: ::std::option::Option::None,
|
1291 - | sparse_boolean_map: ::std::option::Option::None,
|
1292 - | sparse_string_map: ::std::option::Option::None,
|
1293 - | sparse_set_map: ::std::option::Option::None,
|
1294 - | };
|
1295 - | ::pretty_assertions::assert_eq!(input, expected);
|
1296 - | let output = crate::output::RpcV2CborSparseMapsOutput {
|
1297 - | sparse_struct_map: ::std::option::Option::None,
|
1298 - | sparse_number_map: ::std::option::Option::None,
|
1299 - | sparse_boolean_map: ::std::option::Option::None,
|
1300 - | sparse_string_map: ::std::option::Option::None,
|
1301 - | sparse_set_map: ::std::option::Option::None,
|
1302 - | };
|
1303 - | Ok(output)
|
1304 - | };
|
1305 - | sender.send(()).await.expect("receiver dropped early");
|
1306 - | result
|
1307 - | }
|
1308 - | })
|
1309 - | .build_unchecked();
|
1333 + | );
|
1334 + | ret.insert(
|
1335 + | "baz".to_owned(),
|
1336 + | ::std::option::Option::Some(crate::model::GreetingStruct {
|
1337 + | hi: ::std::option::Option::Some("bye".to_owned()),
|
1338 + | }),
|
1339 + | );
|
1340 + | ret
|
1341 + | }),
|
1342 + | sparse_number_map: ::std::option::Option::None,
|
1343 + | sparse_boolean_map: ::std::option::Option::None,
|
1344 + | sparse_string_map: ::std::option::Option::None,
|
1345 + | sparse_set_map: ::std::option::Option::None,
|
1346 + | };
|
1347 + | ::pretty_assertions::assert_eq!(input, expected);
|
1348 + | let output = crate::output::RpcV2CborSparseMapsOutput {
|
1349 + | sparse_struct_map: ::std::option::Option::None,
|
1350 + | sparse_number_map: ::std::option::Option::None,
|
1351 + | sparse_boolean_map: ::std::option::Option::None,
|
1352 + | sparse_string_map: ::std::option::Option::None,
|
1353 + | sparse_set_map: ::std::option::Option::None,
|
1354 + | };
|
1355 + | Ok(output)
|
1356 + | };
|
1357 + | sender.send(()).await.expect("receiver dropped early");
|
1358 + | result
|
1359 + | }
|
1360 + | })
|
1361 + | .build_unchecked();
|
1310 1362 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1311 1363 | .await
|
1312 1364 | .expect("unable to make an HTTP request");
|
1313 1365 | assert!(
|
1314 1366 | receiver.recv().await.is_some(),
|
1315 1367 | "we expected operation handler to be invoked but it was not entered"
|
1316 1368 | );
|
1317 1369 | }
|
1318 1370 |
|
1319 1371 | /// Serializes null map values in sparse maps
|
1320 1372 | /// Test ID: RpcV2CborSerializesNullMapValues
|
1321 1373 | #[::tokio::test]
|
1322 1374 | #[::tracing_test::traced_test]
|
1323 1375 | async fn rpc_v2_cbor_serializes_null_map_values_request() {
|
1324 1376 | #[allow(unused_mut)]
|
1325 - | let mut http_request = http::Request::builder()
|
1377 + | let mut http_request = ::http_1x::Request::builder()
|
1326 1378 | .uri("/service/RpcV2Protocol/operation/RpcV2CborSparseMaps")
|
1327 1379 | .method("POST")
|
1328 1380 | .header("Accept", "application/cbor")
|
1329 1381 | .header("Content-Type", "application/cbor")
|
1330 1382 | .header("smithy-protocol", "rpc-v2-cbor")
|
1331 - | .body(::aws_smithy_http_server::body::Body::from(
|
1332 - | ::bytes::Bytes::copy_from_slice(
|
1333 - | &::aws_smithy_protocol_test::decode_body_data("v3BzcGFyc2VCb29sZWFuTWFwv2F49v9vc3BhcnNlTnVtYmVyTWFwv2F49v9vc3BhcnNlU3RyaW5nTWFwv2F49v9vc3BhcnNlU3RydWN0TWFwv2F49v//".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
1334 - | )
|
1335 - | )).unwrap();
|
1383 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
1384 + | ::bytes::Bytes::copy_from_slice(
|
1385 + | &::aws_smithy_protocol_test::decode_body_data("v3BzcGFyc2VCb29sZWFuTWFwv2F49v9vc3BhcnNlTnVtYmVyTWFwv2F49v9vc3BhcnNlU3RyaW5nTWFwv2F49v9vc3BhcnNlU3RydWN0TWFwv2F49v//".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
1386 + | )
|
1387 + | ))).unwrap();
|
1336 1388 | #[allow(unused_mut)]
|
1337 1389 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1338 1390 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
1339 - | let service =
|
1340 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1341 - | .rpc_v2_cbor_sparse_maps(move |input: crate::input::RpcV2CborSparseMapsInput| {
|
1342 - | let sender = sender.clone();
|
1343 - | async move {
|
1344 - | let result = {
|
1345 - | let expected = crate::input::RpcV2CborSparseMapsInput {
|
1346 - | sparse_boolean_map: ::std::option::Option::Some({
|
1347 - | let mut ret = ::std::collections::HashMap::new();
|
1348 - | ret.insert("x".to_owned(), ::std::option::Option::None);
|
1349 - | ret
|
1350 - | }),
|
1351 - | sparse_number_map: ::std::option::Option::Some({
|
1352 - | let mut ret = ::std::collections::HashMap::new();
|
1353 - | ret.insert("x".to_owned(), ::std::option::Option::None);
|
1354 - | ret
|
1355 - | }),
|
1356 - | sparse_string_map: ::std::option::Option::Some({
|
1357 - | let mut ret = ::std::collections::HashMap::new();
|
1358 - | ret.insert("x".to_owned(), ::std::option::Option::None);
|
1359 - | ret
|
1360 - | }),
|
1361 - | sparse_struct_map: ::std::option::Option::Some({
|
1362 - | let mut ret = ::std::collections::HashMap::new();
|
1363 - | ret.insert("x".to_owned(), ::std::option::Option::None);
|
1364 - | ret
|
1365 - | }),
|
1366 - | sparse_set_map: ::std::option::Option::None,
|
1367 - | };
|
1368 - | ::pretty_assertions::assert_eq!(input, expected);
|
1369 - | let output = crate::output::RpcV2CborSparseMapsOutput {
|
1370 - | sparse_struct_map: ::std::option::Option::None,
|
1371 - | sparse_number_map: ::std::option::Option::None,
|
1372 - | sparse_boolean_map: ::std::option::Option::None,
|
1373 - | sparse_string_map: ::std::option::Option::None,
|
1374 - | sparse_set_map: ::std::option::Option::None,
|
1375 - | };
|
1376 - | Ok(output)
|
1377 - | };
|
1378 - | sender.send(()).await.expect("receiver dropped early");
|
1379 - | result
|
1380 - | }
|
1381 - | })
|
1382 - | .build_unchecked();
|
1391 + | let service = crate::service::RpcV2Protocol::builder::<
|
1392 + | ::aws_smithy_http_server::body::BoxBody,
|
1393 + | _,
|
1394 + | _,
|
1395 + | _,
|
1396 + | >(config)
|
1397 + | .rpc_v2_cbor_sparse_maps(move |input: crate::input::RpcV2CborSparseMapsInput| {
|
1398 + | let sender = sender.clone();
|
1399 + | async move {
|
1400 + | let result = {
|
1401 + | let expected = crate::input::RpcV2CborSparseMapsInput {
|
1402 + | sparse_boolean_map: ::std::option::Option::Some({
|
1403 + | let mut ret = ::std::collections::HashMap::new();
|
1404 + | ret.insert("x".to_owned(), ::std::option::Option::None);
|
1405 + | ret
|
1406 + | }),
|
1407 + | sparse_number_map: ::std::option::Option::Some({
|
1408 + | let mut ret = ::std::collections::HashMap::new();
|
1409 + | ret.insert("x".to_owned(), ::std::option::Option::None);
|
1410 + | ret
|
1411 + | }),
|
1412 + | sparse_string_map: ::std::option::Option::Some({
|
1413 + | let mut ret = ::std::collections::HashMap::new();
|
1414 + | ret.insert("x".to_owned(), ::std::option::Option::None);
|
1415 + | ret
|
1416 + | }),
|
1417 + | sparse_struct_map: ::std::option::Option::Some({
|
1418 + | let mut ret = ::std::collections::HashMap::new();
|
1419 + | ret.insert("x".to_owned(), ::std::option::Option::None);
|
1420 + | ret
|
1421 + | }),
|
1422 + | sparse_set_map: ::std::option::Option::None,
|
1423 + | };
|
1424 + | ::pretty_assertions::assert_eq!(input, expected);
|
1425 + | let output = crate::output::RpcV2CborSparseMapsOutput {
|
1426 + | sparse_struct_map: ::std::option::Option::None,
|
1427 + | sparse_number_map: ::std::option::Option::None,
|
1428 + | sparse_boolean_map: ::std::option::Option::None,
|
1429 + | sparse_string_map: ::std::option::Option::None,
|
1430 + | sparse_set_map: ::std::option::Option::None,
|
1431 + | };
|
1432 + | Ok(output)
|
1433 + | };
|
1434 + | sender.send(()).await.expect("receiver dropped early");
|
1435 + | result
|
1436 + | }
|
1437 + | })
|
1438 + | .build_unchecked();
|
1383 1439 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1384 1440 | .await
|
1385 1441 | .expect("unable to make an HTTP request");
|
1386 1442 | assert!(
|
1387 1443 | receiver.recv().await.is_some(),
|
1388 1444 | "we expected operation handler to be invoked but it was not entered"
|
1389 1445 | );
|
1390 1446 | }
|
1391 1447 |
|
1392 1448 | /// A request that contains a sparse map of sets
|
1393 1449 | /// Test ID: RpcV2CborSerializesSparseSetMap
|
1394 1450 | #[::tokio::test]
|
1395 1451 | #[::tracing_test::traced_test]
|
1396 1452 | async fn rpc_v2_cbor_serializes_sparse_set_map_request() {
|
1397 1453 | #[allow(unused_mut)]
|
1398 - | let mut http_request = http::Request::builder()
|
1454 + | let mut http_request = ::http_1x::Request::builder()
|
1399 1455 | .uri("/service/RpcV2Protocol/operation/RpcV2CborSparseMaps")
|
1400 1456 | .method("POST")
|
1401 1457 | .header("Accept", "application/cbor")
|
1402 1458 | .header("Content-Type", "application/cbor")
|
1403 1459 | .header("smithy-protocol", "rpc-v2-cbor")
|
1404 - | .body(::aws_smithy_http_server::body::Body::from(
|
1405 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1406 - | "v2xzcGFyc2VTZXRNYXC/YXif/2F5n2FhYWL///8=".as_bytes(),
|
1407 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
1460 + | .body(::aws_smithy_http_server::body::boxed(
|
1461 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1462 + | &::aws_smithy_protocol_test::decode_body_data(
|
1463 + | "v2xzcGFyc2VTZXRNYXC/YXif/2F5n2FhYWL///8=".as_bytes(),
|
1464 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
1465 + | ),
|
1408 1466 | )),
|
1409 1467 | ))
|
1410 1468 | .unwrap();
|
1411 1469 | #[allow(unused_mut)]
|
1412 1470 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1413 1471 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
1414 - | let service =
|
1415 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1416 - | .rpc_v2_cbor_sparse_maps(move |input: crate::input::RpcV2CborSparseMapsInput| {
|
1417 - | let sender = sender.clone();
|
1418 - | async move {
|
1419 - | let result = {
|
1420 - | let expected = crate::input::RpcV2CborSparseMapsInput {
|
1421 - | sparse_set_map: ::std::option::Option::Some({
|
1422 - | let mut ret = ::std::collections::HashMap::new();
|
1423 - | ret.insert(
|
1424 - | "x".to_owned(),
|
1425 - | ::std::option::Option::Some(
|
1426 - | vec![].try_into().expect("this is only used in tests"),
|
1427 - | ),
|
1428 - | );
|
1429 - | ret.insert(
|
1430 - | "y".to_owned(),
|
1431 - | ::std::option::Option::Some(
|
1432 - | vec!["a".to_owned(), "b".to_owned()]
|
1433 - | .try_into()
|
1434 - | .expect("this is only used in tests"),
|
1435 - | ),
|
1436 - | );
|
1437 - | ret
|
1438 - | }),
|
1439 - | sparse_struct_map: ::std::option::Option::None,
|
1440 - | sparse_number_map: ::std::option::Option::None,
|
1441 - | sparse_boolean_map: ::std::option::Option::None,
|
1442 - | sparse_string_map: ::std::option::Option::None,
|
1443 - | };
|
1444 - | ::pretty_assertions::assert_eq!(input, expected);
|
1445 - | let output = crate::output::RpcV2CborSparseMapsOutput {
|
1446 - | sparse_struct_map: ::std::option::Option::None,
|
1447 - | sparse_number_map: ::std::option::Option::None,
|
1448 - | sparse_boolean_map: ::std::option::Option::None,
|
1449 - | sparse_string_map: ::std::option::Option::None,
|
1450 - | sparse_set_map: ::std::option::Option::None,
|
1451 - | };
|
1452 - | Ok(output)
|
1453 - | };
|
1454 - | sender.send(()).await.expect("receiver dropped early");
|
1455 - | result
|
1456 - | }
|
1457 - | })
|
1458 - | .build_unchecked();
|
1472 + | let service = crate::service::RpcV2Protocol::builder::<
|
1473 + | ::aws_smithy_http_server::body::BoxBody,
|
1474 + | _,
|
1475 + | _,
|
1476 + | _,
|
1477 + | >(config)
|
1478 + | .rpc_v2_cbor_sparse_maps(move |input: crate::input::RpcV2CborSparseMapsInput| {
|
1479 + | let sender = sender.clone();
|
1480 + | async move {
|
1481 + | let result = {
|
1482 + | let expected = crate::input::RpcV2CborSparseMapsInput {
|
1483 + | sparse_set_map: ::std::option::Option::Some({
|
1484 + | let mut ret = ::std::collections::HashMap::new();
|
1485 + | ret.insert(
|
1486 + | "x".to_owned(),
|
1487 + | ::std::option::Option::Some(
|
1488 + | vec![].try_into().expect("this is only used in tests"),
|
1489 + | ),
|
1490 + | );
|
1491 + | ret.insert(
|
1492 + | "y".to_owned(),
|
1493 + | ::std::option::Option::Some(
|
1494 + | vec!["a".to_owned(), "b".to_owned()]
|
1495 + | .try_into()
|
1496 + | .expect("this is only used in tests"),
|
1497 + | ),
|
1498 + | );
|
1499 + | ret
|
1500 + | }),
|
1501 + | sparse_struct_map: ::std::option::Option::None,
|
1502 + | sparse_number_map: ::std::option::Option::None,
|
1503 + | sparse_boolean_map: ::std::option::Option::None,
|
1504 + | sparse_string_map: ::std::option::Option::None,
|
1505 + | };
|
1506 + | ::pretty_assertions::assert_eq!(input, expected);
|
1507 + | let output = crate::output::RpcV2CborSparseMapsOutput {
|
1508 + | sparse_struct_map: ::std::option::Option::None,
|
1509 + | sparse_number_map: ::std::option::Option::None,
|
1510 + | sparse_boolean_map: ::std::option::Option::None,
|
1511 + | sparse_string_map: ::std::option::Option::None,
|
1512 + | sparse_set_map: ::std::option::Option::None,
|
1513 + | };
|
1514 + | Ok(output)
|
1515 + | };
|
1516 + | sender.send(()).await.expect("receiver dropped early");
|
1517 + | result
|
1518 + | }
|
1519 + | })
|
1520 + | .build_unchecked();
|
1459 1521 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1460 1522 | .await
|
1461 1523 | .expect("unable to make an HTTP request");
|
1462 1524 | assert!(
|
1463 1525 | receiver.recv().await.is_some(),
|
1464 1526 | "we expected operation handler to be invoked but it was not entered"
|
1465 1527 | );
|
1466 1528 | }
|
1467 1529 |
|
1468 1530 | /// A request that contains a sparse map of sets.
|
1469 1531 | /// Test ID: RpcV2CborSerializesSparseSetMapAndRetainsNull
|
1470 1532 | #[::tokio::test]
|
1471 1533 | #[::tracing_test::traced_test]
|
1472 1534 | async fn rpc_v2_cbor_serializes_sparse_set_map_and_retains_null_request() {
|
1473 1535 | #[allow(unused_mut)]
|
1474 - | let mut http_request = http::Request::builder()
|
1536 + | let mut http_request = ::http_1x::Request::builder()
|
1475 1537 | .uri("/service/RpcV2Protocol/operation/RpcV2CborSparseMaps")
|
1476 1538 | .method("POST")
|
1477 1539 | .header("Accept", "application/cbor")
|
1478 1540 | .header("Content-Type", "application/cbor")
|
1479 1541 | .header("smithy-protocol", "rpc-v2-cbor")
|
1480 - | .body(::aws_smithy_http_server::body::Body::from(
|
1481 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1482 - | "v2xzcGFyc2VTZXRNYXC/YXif/2F5n2FhYWL/YXr2//8=".as_bytes(),
|
1483 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
1542 + | .body(::aws_smithy_http_server::body::boxed(
|
1543 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1544 + | &::aws_smithy_protocol_test::decode_body_data(
|
1545 + | "v2xzcGFyc2VTZXRNYXC/YXif/2F5n2FhYWL/YXr2//8=".as_bytes(),
|
1546 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
1547 + | ),
|
1484 1548 | )),
|
1485 1549 | ))
|
1486 1550 | .unwrap();
|
1487 1551 | #[allow(unused_mut)]
|
1488 1552 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1489 1553 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
1490 - | let service =
|
1491 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1492 - | .rpc_v2_cbor_sparse_maps(move |input: crate::input::RpcV2CborSparseMapsInput| {
|
1493 - | let sender = sender.clone();
|
1494 - | async move {
|
1495 - | let result = {
|
1496 - | let expected = crate::input::RpcV2CborSparseMapsInput {
|
1497 - | sparse_set_map: ::std::option::Option::Some({
|
1498 - | let mut ret = ::std::collections::HashMap::new();
|
1499 - | ret.insert(
|
1500 - | "x".to_owned(),
|
1501 - | ::std::option::Option::Some(
|
1502 - | vec![].try_into().expect("this is only used in tests"),
|
1503 - | ),
|
1504 - | );
|
1505 - | ret.insert(
|
1506 - | "y".to_owned(),
|
1507 - | ::std::option::Option::Some(
|
1508 - | vec!["a".to_owned(), "b".to_owned()]
|
1509 - | .try_into()
|
1510 - | .expect("this is only used in tests"),
|
1511 - | ),
|
1512 - | );
|
1513 - | ret.insert("z".to_owned(), ::std::option::Option::None);
|
1514 - | ret
|
1515 - | }),
|
1516 - | sparse_struct_map: ::std::option::Option::None,
|
1517 - | sparse_number_map: ::std::option::Option::None,
|
1518 - | sparse_boolean_map: ::std::option::Option::None,
|
1519 - | sparse_string_map: ::std::option::Option::None,
|
1520 - | };
|
1521 - | ::pretty_assertions::assert_eq!(input, expected);
|
1522 - | let output = crate::output::RpcV2CborSparseMapsOutput {
|
1523 - | sparse_struct_map: ::std::option::Option::None,
|
1524 - | sparse_number_map: ::std::option::Option::None,
|
1525 - | sparse_boolean_map: ::std::option::Option::None,
|
1526 - | sparse_string_map: ::std::option::Option::None,
|
1527 - | sparse_set_map: ::std::option::Option::None,
|
1528 - | };
|
1529 - | Ok(output)
|
1530 - | };
|
1531 - | sender.send(()).await.expect("receiver dropped early");
|
1532 - | result
|
1533 - | }
|
1534 - | })
|
1535 - | .build_unchecked();
|
1554 + | let service = crate::service::RpcV2Protocol::builder::<
|
1555 + | ::aws_smithy_http_server::body::BoxBody,
|
1556 + | _,
|
1557 + | _,
|
1558 + | _,
|
1559 + | >(config)
|
1560 + | .rpc_v2_cbor_sparse_maps(move |input: crate::input::RpcV2CborSparseMapsInput| {
|
1561 + | let sender = sender.clone();
|
1562 + | async move {
|
1563 + | let result = {
|
1564 + | let expected = crate::input::RpcV2CborSparseMapsInput {
|
1565 + | sparse_set_map: ::std::option::Option::Some({
|
1566 + | let mut ret = ::std::collections::HashMap::new();
|
1567 + | ret.insert(
|
1568 + | "x".to_owned(),
|
1569 + | ::std::option::Option::Some(
|
1570 + | vec![].try_into().expect("this is only used in tests"),
|
1571 + | ),
|
1572 + | );
|
1573 + | ret.insert(
|
1574 + | "y".to_owned(),
|
1575 + | ::std::option::Option::Some(
|
1576 + | vec!["a".to_owned(), "b".to_owned()]
|
1577 + | .try_into()
|
1578 + | .expect("this is only used in tests"),
|
1579 + | ),
|
1580 + | );
|
1581 + | ret.insert("z".to_owned(), ::std::option::Option::None);
|
1582 + | ret
|
1583 + | }),
|
1584 + | sparse_struct_map: ::std::option::Option::None,
|
1585 + | sparse_number_map: ::std::option::Option::None,
|
1586 + | sparse_boolean_map: ::std::option::Option::None,
|
1587 + | sparse_string_map: ::std::option::Option::None,
|
1588 + | };
|
1589 + | ::pretty_assertions::assert_eq!(input, expected);
|
1590 + | let output = crate::output::RpcV2CborSparseMapsOutput {
|
1591 + | sparse_struct_map: ::std::option::Option::None,
|
1592 + | sparse_number_map: ::std::option::Option::None,
|
1593 + | sparse_boolean_map: ::std::option::Option::None,
|
1594 + | sparse_string_map: ::std::option::Option::None,
|
1595 + | sparse_set_map: ::std::option::Option::None,
|
1596 + | };
|
1597 + | Ok(output)
|
1598 + | };
|
1599 + | sender.send(()).await.expect("receiver dropped early");
|
1600 + | result
|
1601 + | }
|
1602 + | })
|
1603 + | .build_unchecked();
|
1536 1604 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1537 1605 | .await
|
1538 1606 | .expect("unable to make an HTTP request");
|
1539 1607 | assert!(
|
1540 1608 | receiver.recv().await.is_some(),
|
1541 1609 | "we expected operation handler to be invoked but it was not entered"
|
1542 1610 | );
|
1543 1611 | }
|
1544 1612 |
|
1545 1613 | /// Ensure that 0 and false are sent over the wire in all maps and lists
|
1546 1614 | /// Test ID: RpcV2CborSerializesZeroValuesInSparseMaps
|
1547 1615 | #[::tokio::test]
|
1548 1616 | #[::tracing_test::traced_test]
|
1549 1617 | async fn rpc_v2_cbor_serializes_zero_values_in_sparse_maps_request() {
|
1550 1618 | #[allow(unused_mut)]
|
1551 - | let mut http_request = http::Request::builder()
|
1619 + | let mut http_request = ::http_1x::Request::builder()
|
1552 1620 | .uri("/service/RpcV2Protocol/operation/RpcV2CborSparseMaps")
|
1553 1621 | .method("POST")
|
1554 1622 | .header("Accept", "application/cbor")
|
1555 1623 | .header("Content-Type", "application/cbor")
|
1556 1624 | .header("smithy-protocol", "rpc-v2-cbor")
|
1557 - | .body(::aws_smithy_http_server::body::Body::from(
|
1558 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1559 - | "v29zcGFyc2VOdW1iZXJNYXC/YXgA/3BzcGFyc2VCb29sZWFuTWFwv2F49P//".as_bytes(),
|
1560 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
1625 + | .body(::aws_smithy_http_server::body::boxed(
|
1626 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1627 + | &::aws_smithy_protocol_test::decode_body_data(
|
1628 + | "v29zcGFyc2VOdW1iZXJNYXC/YXgA/3BzcGFyc2VCb29sZWFuTWFwv2F49P//".as_bytes(),
|
1629 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
1630 + | ),
|
1561 1631 | )),
|
1562 1632 | ))
|
1563 1633 | .unwrap();
|
1564 1634 | #[allow(unused_mut)]
|
1565 1635 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1566 1636 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
1567 - | let service =
|
1568 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1569 - | .rpc_v2_cbor_sparse_maps(move |input: crate::input::RpcV2CborSparseMapsInput| {
|
1570 - | let sender = sender.clone();
|
1571 - | async move {
|
1572 - | let result = {
|
1573 - | let expected = crate::input::RpcV2CborSparseMapsInput {
|
1574 - | sparse_number_map: ::std::option::Option::Some({
|
1575 - | let mut ret = ::std::collections::HashMap::new();
|
1576 - | ret.insert("x".to_owned(), ::std::option::Option::Some(0));
|
1577 - | ret
|
1578 - | }),
|
1579 - | sparse_boolean_map: ::std::option::Option::Some({
|
1580 - | let mut ret = ::std::collections::HashMap::new();
|
1581 - | ret.insert("x".to_owned(), ::std::option::Option::Some(false));
|
1582 - | ret
|
1583 - | }),
|
1584 - | sparse_struct_map: ::std::option::Option::None,
|
1585 - | sparse_string_map: ::std::option::Option::None,
|
1586 - | sparse_set_map: ::std::option::Option::None,
|
1587 - | };
|
1588 - | ::pretty_assertions::assert_eq!(input, expected);
|
1589 - | let output = crate::output::RpcV2CborSparseMapsOutput {
|
1590 - | sparse_struct_map: ::std::option::Option::None,
|
1591 - | sparse_number_map: ::std::option::Option::None,
|
1592 - | sparse_boolean_map: ::std::option::Option::None,
|
1593 - | sparse_string_map: ::std::option::Option::None,
|
1594 - | sparse_set_map: ::std::option::Option::None,
|
1595 - | };
|
1596 - | Ok(output)
|
1597 - | };
|
1598 - | sender.send(()).await.expect("receiver dropped early");
|
1599 - | result
|
1600 - | }
|
1601 - | })
|
1602 - | .build_unchecked();
|
1637 + | let service = crate::service::RpcV2Protocol::builder::<
|
1638 + | ::aws_smithy_http_server::body::BoxBody,
|
1639 + | _,
|
1640 + | _,
|
1641 + | _,
|
1642 + | >(config)
|
1643 + | .rpc_v2_cbor_sparse_maps(move |input: crate::input::RpcV2CborSparseMapsInput| {
|
1644 + | let sender = sender.clone();
|
1645 + | async move {
|
1646 + | let result = {
|
1647 + | let expected = crate::input::RpcV2CborSparseMapsInput {
|
1648 + | sparse_number_map: ::std::option::Option::Some({
|
1649 + | let mut ret = ::std::collections::HashMap::new();
|
1650 + | ret.insert("x".to_owned(), ::std::option::Option::Some(0));
|
1651 + | ret
|
1652 + | }),
|
1653 + | sparse_boolean_map: ::std::option::Option::Some({
|
1654 + | let mut ret = ::std::collections::HashMap::new();
|
1655 + | ret.insert("x".to_owned(), ::std::option::Option::Some(false));
|
1656 + | ret
|
1657 + | }),
|
1658 + | sparse_struct_map: ::std::option::Option::None,
|
1659 + | sparse_string_map: ::std::option::Option::None,
|
1660 + | sparse_set_map: ::std::option::Option::None,
|
1661 + | };
|
1662 + | ::pretty_assertions::assert_eq!(input, expected);
|
1663 + | let output = crate::output::RpcV2CborSparseMapsOutput {
|
1664 + | sparse_struct_map: ::std::option::Option::None,
|
1665 + | sparse_number_map: ::std::option::Option::None,
|
1666 + | sparse_boolean_map: ::std::option::Option::None,
|
1667 + | sparse_string_map: ::std::option::Option::None,
|
1668 + | sparse_set_map: ::std::option::Option::None,
|
1669 + | };
|
1670 + | Ok(output)
|
1671 + | };
|
1672 + | sender.send(()).await.expect("receiver dropped early");
|
1673 + | result
|
1674 + | }
|
1675 + | })
|
1676 + | .build_unchecked();
|
1603 1677 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1604 1678 | .await
|
1605 1679 | .expect("unable to make an HTTP request");
|
1606 1680 | assert!(
|
1607 1681 | receiver.recv().await.is_some(),
|
1608 1682 | "we expected operation handler to be invoked but it was not entered"
|
1609 1683 | );
|
1610 1684 | }
|
1611 1685 |
|
1612 1686 | /// Deserializes sparse maps
|
1613 1687 | /// Test ID: RpcV2CborSparseJsonMaps
|
1614 1688 | #[::tokio::test]
|
1615 1689 | #[::tracing_test::traced_test]
|
1616 1690 | async fn rpc_v2_cbor_sparse_json_maps_response() {
|
1617 1691 | let output = crate::output::RpcV2CborSparseMapsOutput {
|
1618 1692 | sparse_struct_map: ::std::option::Option::Some({
|
1619 1693 | let mut ret = ::std::collections::HashMap::new();
|
1620 1694 | ret.insert(
|
1621 1695 | "foo".to_owned(),
|
1622 1696 | ::std::option::Option::Some(crate::model::GreetingStruct {
|
1623 1697 | hi: ::std::option::Option::Some("there".to_owned()),
|
1624 1698 | }),
|
1625 1699 | );
|
1626 1700 | ret.insert(
|
1627 1701 | "baz".to_owned(),
|
1628 1702 | ::std::option::Option::Some(crate::model::GreetingStruct {
|
1629 1703 | hi: ::std::option::Option::Some("bye".to_owned()),
|
1630 1704 | }),
|
1631 1705 | );
|
1632 1706 | ret
|
1633 1707 | }),
|
1634 1708 | sparse_number_map: ::std::option::Option::None,
|
1635 1709 | sparse_boolean_map: ::std::option::Option::None,
|
1636 1710 | sparse_string_map: ::std::option::Option::None,
|
1637 1711 | sparse_set_map: ::std::option::Option::None,
|
1638 1712 | };
|
1639 1713 | use ::aws_smithy_http_server::response::IntoResponse;
|
1640 1714 | let http_response = output.into_response();
|
1641 1715 | ::pretty_assertions::assert_eq!(
|
1642 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1716 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1643 1717 | http_response.status()
|
1644 1718 | );
|
1645 1719 | let expected_headers = [
|
1646 1720 | ("Content-Type", "application/cbor"),
|
1647 1721 | ("smithy-protocol", "rpc-v2-cbor"),
|
1648 1722 | ];
|
1649 1723 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1650 1724 | http_response.headers(),
|
1651 1725 | expected_headers,
|
1652 1726 | ));
|
1653 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1727 + | use ::http_body_util::BodyExt;
|
1728 + | let body = http_response
|
1729 + | .into_body()
|
1730 + | .collect()
|
1654 1731 | .await
|
1655 - | .expect("unable to extract body to bytes");
|
1732 + | .expect("unable to collect body")
|
1733 + | .to_bytes();
|
1656 1734 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1657 1735 | &body,
|
1658 1736 | "v29zcGFyc2VTdHJ1Y3RNYXC/Y2Zvb79iaGlldGhlcmX/Y2Jher9iaGljYnll////",
|
1659 1737 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
1660 1738 | ));
|
1661 1739 | }
|
1662 1740 |
|
1663 1741 | /// Deserializes null map values
|
1664 1742 | /// Test ID: RpcV2CborDeserializesNullMapValues
|
1665 1743 | #[::tokio::test]
|
1666 1744 | #[::tracing_test::traced_test]
|
1667 1745 | async fn rpc_v2_cbor_deserializes_null_map_values_response() {
|
1668 1746 | let output = crate::output::RpcV2CborSparseMapsOutput {
|
1669 1747 | sparse_boolean_map: ::std::option::Option::Some({
|
1670 1748 | let mut ret = ::std::collections::HashMap::new();
|
1671 1749 | ret.insert("x".to_owned(), ::std::option::Option::None);
|
1672 1750 | ret
|
1673 1751 | }),
|
1674 1752 | sparse_number_map: ::std::option::Option::Some({
|
1675 1753 | let mut ret = ::std::collections::HashMap::new();
|
1676 1754 | ret.insert("x".to_owned(), ::std::option::Option::None);
|
1677 1755 | ret
|
1678 1756 | }),
|
1679 1757 | sparse_string_map: ::std::option::Option::Some({
|
1680 1758 | let mut ret = ::std::collections::HashMap::new();
|
1681 1759 | ret.insert("x".to_owned(), ::std::option::Option::None);
|
1682 1760 | ret
|
1683 1761 | }),
|
1684 1762 | sparse_struct_map: ::std::option::Option::Some({
|
1685 1763 | let mut ret = ::std::collections::HashMap::new();
|
1686 1764 | ret.insert("x".to_owned(), ::std::option::Option::None);
|
1687 1765 | ret
|
1688 1766 | }),
|
1689 1767 | sparse_set_map: ::std::option::Option::None,
|
1690 1768 | };
|
1691 1769 | use ::aws_smithy_http_server::response::IntoResponse;
|
1692 1770 | let http_response = output.into_response();
|
1693 1771 | ::pretty_assertions::assert_eq!(
|
1694 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1772 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1695 1773 | http_response.status()
|
1696 1774 | );
|
1697 1775 | let expected_headers = [
|
1698 1776 | ("Content-Type", "application/cbor"),
|
1699 1777 | ("smithy-protocol", "rpc-v2-cbor"),
|
1700 1778 | ];
|
1701 1779 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1702 1780 | http_response.headers(),
|
1703 1781 | expected_headers,
|
1704 1782 | ));
|
1705 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1783 + | use ::http_body_util::BodyExt;
|
1784 + | let body = http_response
|
1785 + | .into_body()
|
1786 + | .collect()
|
1706 1787 | .await
|
1707 - | .expect("unable to extract body to bytes");
|
1788 + | .expect("unable to collect body")
|
1789 + | .to_bytes();
|
1708 1790 | ::aws_smithy_protocol_test::assert_ok(
|
1709 1791 | ::aws_smithy_protocol_test::validate_body(&body, "v3BzcGFyc2VCb29sZWFuTWFwv2F49v9vc3BhcnNlTnVtYmVyTWFwv2F49v9vc3BhcnNlU3RyaW5nTWFwv2F49v9vc3BhcnNlU3RydWN0TWFwv2F49v//", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
1710 1792 | );
|
1711 1793 | }
|
1712 1794 |
|
1713 1795 | /// A response that contains a sparse map of sets
|
1714 1796 | /// Test ID: RpcV2CborDeserializesSparseSetMap
|
1715 1797 | #[::tokio::test]
|
1716 1798 | #[::tracing_test::traced_test]
|
1717 1799 | async fn rpc_v2_cbor_deserializes_sparse_set_map_response() {
|
1718 1800 | let output = crate::output::RpcV2CborSparseMapsOutput {
|
1719 1801 | sparse_set_map: ::std::option::Option::Some({
|
1720 1802 | let mut ret = ::std::collections::HashMap::new();
|
1721 1803 | ret.insert(
|
1722 1804 | "x".to_owned(),
|
1723 1805 | ::std::option::Option::Some(
|
1724 1806 | vec![].try_into().expect("this is only used in tests"),
|
1725 1807 | ),
|
1726 1808 | );
|
1727 1809 | ret.insert(
|
1728 1810 | "y".to_owned(),
|
1729 1811 | ::std::option::Option::Some(
|
1730 1812 | vec!["a".to_owned(), "b".to_owned()]
|
1731 1813 | .try_into()
|
1732 1814 | .expect("this is only used in tests"),
|
1733 1815 | ),
|
1734 1816 | );
|
1735 1817 | ret
|
1736 1818 | }),
|
1737 1819 | sparse_struct_map: ::std::option::Option::None,
|
1738 1820 | sparse_number_map: ::std::option::Option::None,
|
1739 1821 | sparse_boolean_map: ::std::option::Option::None,
|
1740 1822 | sparse_string_map: ::std::option::Option::None,
|
1741 1823 | };
|
1742 1824 | use ::aws_smithy_http_server::response::IntoResponse;
|
1743 1825 | let http_response = output.into_response();
|
1744 1826 | ::pretty_assertions::assert_eq!(
|
1745 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1827 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1746 1828 | http_response.status()
|
1747 1829 | );
|
1748 1830 | let expected_headers = [
|
1749 1831 | ("Content-Type", "application/cbor"),
|
1750 1832 | ("smithy-protocol", "rpc-v2-cbor"),
|
1751 1833 | ];
|
1752 1834 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1753 1835 | http_response.headers(),
|
1754 1836 | expected_headers,
|
1755 1837 | ));
|
1756 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1838 + | use ::http_body_util::BodyExt;
|
1839 + | let body = http_response
|
1840 + | .into_body()
|
1841 + | .collect()
|
1757 1842 | .await
|
1758 - | .expect("unable to extract body to bytes");
|
1843 + | .expect("unable to collect body")
|
1844 + | .to_bytes();
|
1759 1845 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1760 1846 | &body,
|
1761 1847 | "v2xzcGFyc2VTZXRNYXC/YXmfYWFhYv9heJ////8=",
|
1762 1848 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
1763 1849 | ));
|
1764 1850 | }
|
1765 1851 |
|
1766 1852 | /// A response that contains a sparse map of sets with a null
|
1767 1853 | /// Test ID: RpcV2CborDeserializesSparseSetMapAndRetainsNull
|
1768 1854 | #[::tokio::test]
|
1769 1855 | #[::tracing_test::traced_test]
|
1770 1856 | async fn rpc_v2_cbor_deserializes_sparse_set_map_and_retains_null_response() {
|
1771 1857 | let output = crate::output::RpcV2CborSparseMapsOutput {
|
1772 1858 | sparse_set_map: ::std::option::Option::Some({
|
1773 1859 | let mut ret = ::std::collections::HashMap::new();
|
1774 1860 | ret.insert(
|
1775 1861 | "x".to_owned(),
|
1776 1862 | ::std::option::Option::Some(
|
1777 1863 | vec![].try_into().expect("this is only used in tests"),
|
1778 1864 | ),
|
1779 1865 | );
|
1780 1866 | ret.insert(
|
1781 1867 | "y".to_owned(),
|
1782 1868 | ::std::option::Option::Some(
|
1783 1869 | vec!["a".to_owned(), "b".to_owned()]
|
1784 1870 | .try_into()
|
1785 1871 | .expect("this is only used in tests"),
|
1786 1872 | ),
|
1787 1873 | );
|
1788 1874 | ret.insert("z".to_owned(), ::std::option::Option::None);
|
1789 1875 | ret
|
1790 1876 | }),
|
1791 1877 | sparse_struct_map: ::std::option::Option::None,
|
1792 1878 | sparse_number_map: ::std::option::Option::None,
|
1793 1879 | sparse_boolean_map: ::std::option::Option::None,
|
1794 1880 | sparse_string_map: ::std::option::Option::None,
|
1795 1881 | };
|
1796 1882 | use ::aws_smithy_http_server::response::IntoResponse;
|
1797 1883 | let http_response = output.into_response();
|
1798 1884 | ::pretty_assertions::assert_eq!(
|
1799 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1885 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1800 1886 | http_response.status()
|
1801 1887 | );
|
1802 1888 | let expected_headers = [
|
1803 1889 | ("Content-Type", "application/cbor"),
|
1804 1890 | ("smithy-protocol", "rpc-v2-cbor"),
|
1805 1891 | ];
|
1806 1892 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1807 1893 | http_response.headers(),
|
1808 1894 | expected_headers,
|
1809 1895 | ));
|
1810 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1896 + | use ::http_body_util::BodyExt;
|
1897 + | let body = http_response
|
1898 + | .into_body()
|
1899 + | .collect()
|
1811 1900 | .await
|
1812 - | .expect("unable to extract body to bytes");
|
1901 + | .expect("unable to collect body")
|
1902 + | .to_bytes();
|
1813 1903 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1814 1904 | &body,
|
1815 1905 | "v2xzcGFyc2VTZXRNYXC/YXif/2F5n2FhYWL/YXr2//8=",
|
1816 1906 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
1817 1907 | ));
|
1818 1908 | }
|
1819 1909 |
|
1820 1910 | /// Ensure that 0 and false are sent over the wire in all maps and lists
|
1821 1911 | /// Test ID: RpcV2CborDeserializesZeroValuesInSparseMaps
|
1822 1912 | #[::tokio::test]
|
1823 1913 | #[::tracing_test::traced_test]
|
1824 1914 | async fn rpc_v2_cbor_deserializes_zero_values_in_sparse_maps_response() {
|
1825 1915 | let output = crate::output::RpcV2CborSparseMapsOutput {
|
1826 1916 | sparse_number_map: ::std::option::Option::Some({
|
1827 1917 | let mut ret = ::std::collections::HashMap::new();
|
1828 1918 | ret.insert("x".to_owned(), ::std::option::Option::Some(0));
|
1829 1919 | ret
|
1830 1920 | }),
|
1831 1921 | sparse_boolean_map: ::std::option::Option::Some({
|
1832 1922 | let mut ret = ::std::collections::HashMap::new();
|
1833 1923 | ret.insert("x".to_owned(), ::std::option::Option::Some(false));
|
1834 1924 | ret
|
1835 1925 | }),
|
1836 1926 | sparse_struct_map: ::std::option::Option::None,
|
1837 1927 | sparse_string_map: ::std::option::Option::None,
|
1838 1928 | sparse_set_map: ::std::option::Option::None,
|
1839 1929 | };
|
1840 1930 | use ::aws_smithy_http_server::response::IntoResponse;
|
1841 1931 | let http_response = output.into_response();
|
1842 1932 | ::pretty_assertions::assert_eq!(
|
1843 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1933 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1844 1934 | http_response.status()
|
1845 1935 | );
|
1846 1936 | let expected_headers = [
|
1847 1937 | ("Content-Type", "application/cbor"),
|
1848 1938 | ("smithy-protocol", "rpc-v2-cbor"),
|
1849 1939 | ];
|
1850 1940 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1851 1941 | http_response.headers(),
|
1852 1942 | expected_headers,
|
1853 1943 | ));
|
1854 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1944 + | use ::http_body_util::BodyExt;
|
1945 + | let body = http_response
|
1946 + | .into_body()
|
1947 + | .collect()
|
1855 1948 | .await
|
1856 - | .expect("unable to extract body to bytes");
|
1949 + | .expect("unable to collect body")
|
1950 + | .to_bytes();
|
1857 1951 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1858 1952 | &body,
|
1859 1953 | "v29zcGFyc2VOdW1iZXJNYXC/YXgA/3BzcGFyc2VCb29sZWFuTWFwv2F49P//",
|
1860 1954 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
1861 1955 | ));
|
1862 1956 | }
|
1863 1957 | }
|
1864 1958 |
|
1865 1959 | ::pin_project_lite::pin_project! {
|
1866 1960 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1867 1961 | /// [`RpcV2CborDenseMapsInput`](crate::input::RpcV2CborDenseMapsInput) using modelled bindings.
|
1868 1962 | pub struct RpcV2CborDenseMapsInputFuture {
|
1869 1963 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::RpcV2CborDenseMapsInput, ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
1870 1964 | }
|
1871 1965 | }
|
1872 1966 |
|
1873 1967 | impl std::future::Future for RpcV2CborDenseMapsInputFuture {
|
1874 1968 | type Output = Result<
|
1875 1969 | crate::input::RpcV2CborDenseMapsInput,
|
1876 1970 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
1877 1971 | >;
|
1878 1972 |
|
1879 1973 | fn poll(
|
1880 1974 | self: std::pin::Pin<&mut Self>,
|
1881 1975 | cx: &mut std::task::Context<'_>,
|
1882 1976 | ) -> std::task::Poll<Self::Output> {
|
1883 1977 | let this = self.project();
|
1884 1978 | this.inner.as_mut().poll(cx)
|
1885 1979 | }
|
1886 1980 | }
|
1887 1981 |
|
1888 1982 | impl<B>
|
1889 1983 | ::aws_smithy_http_server::request::FromRequest<
|
1890 1984 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
1891 1985 | B,
|
1892 1986 | > for crate::input::RpcV2CborDenseMapsInput
|
1893 1987 | where
|
1894 1988 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1895 1989 | B: 'static,
|
1896 1990 |
|
1897 1991 | B::Data: Send,
|
1898 1992 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
1899 1993 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1900 1994 | {
|
1901 1995 | type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
1902 1996 | type Future = RpcV2CborDenseMapsInputFuture;
|
1903 1997 |
|
1904 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1998 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
1905 1999 | let fut = async move {
|
1906 2000 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
1907 2001 | request.headers(),
|
1908 2002 | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
1909 2003 | ) {
|
1910 2004 | return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
1911 2005 | }
|
1912 2006 | crate::protocol_serde::shape_rpc_v2_cbor_dense_maps::de_rpc_v2_cbor_dense_maps_http_request(request)
|
1913 2007 | .await
|
1914 2008 | };
|
1963 2057 | #[allow(unreachable_code, unused_variables)]
|
1964 2058 | #[cfg(test)]
|
1965 2059 | mod rpc_v2_cbor_dense_maps_test {
|
1966 2060 |
|
1967 2061 | /// Serializes maps
|
1968 2062 | /// Test ID: RpcV2CborMaps
|
1969 2063 | #[::tokio::test]
|
1970 2064 | #[::tracing_test::traced_test]
|
1971 2065 | async fn rpc_v2_cbor_maps_request() {
|
1972 2066 | #[allow(unused_mut)]
|
1973 - | let mut http_request = http::Request::builder()
|
2067 + | let mut http_request = ::http_1x::Request::builder()
|
1974 2068 | .uri("/service/RpcV2Protocol/operation/RpcV2CborDenseMaps")
|
1975 2069 | .method("POST")
|
1976 2070 | .header("Accept", "application/cbor")
|
1977 2071 | .header("Content-Type", "application/cbor")
|
1978 2072 | .header("smithy-protocol", "rpc-v2-cbor")
|
1979 - | .body(::aws_smithy_http_server::body::Body::from(
|
1980 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1981 - | "oW5kZW5zZVN0cnVjdE1hcKJjZm9voWJoaWV0aGVyZWNiYXqhYmhpY2J5ZQ==".as_bytes(),
|
1982 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
2073 + | .body(::aws_smithy_http_server::body::boxed(
|
2074 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2075 + | &::aws_smithy_protocol_test::decode_body_data(
|
2076 + | "oW5kZW5zZVN0cnVjdE1hcKJjZm9voWJoaWV0aGVyZWNiYXqhYmhpY2J5ZQ==".as_bytes(),
|
2077 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
2078 + | ),
|
1983 2079 | )),
|
1984 2080 | ))
|
1985 2081 | .unwrap();
|
1986 2082 | #[allow(unused_mut)]
|
1987 2083 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1988 2084 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
1989 - | let service =
|
1990 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1991 - | .rpc_v2_cbor_dense_maps(move |input: crate::input::RpcV2CborDenseMapsInput| {
|
1992 - | let sender = sender.clone();
|
1993 - | async move {
|
1994 - | let result = {
|
1995 - | let expected = crate::input::RpcV2CborDenseMapsInput {
|
1996 - | dense_struct_map: ::std::option::Option::Some({
|
1997 - | let mut ret = ::std::collections::HashMap::new();
|
1998 - | ret.insert(
|
1999 - | "foo".to_owned(),
|
2000 - | crate::model::GreetingStruct {
|
2001 - | hi: ::std::option::Option::Some("there".to_owned()),
|
2002 - | },
|
2003 - | );
|
2004 - | ret.insert(
|
2005 - | "baz".to_owned(),
|
2006 - | crate::model::GreetingStruct {
|
2007 - | hi: ::std::option::Option::Some("bye".to_owned()),
|
2008 - | },
|
2009 - | );
|
2010 - | ret
|
2011 - | }),
|
2012 - | dense_number_map: ::std::option::Option::None,
|
2013 - | dense_boolean_map: ::std::option::Option::None,
|
2014 - | dense_string_map: ::std::option::Option::None,
|
2015 - | dense_set_map: ::std::option::Option::None,
|
2016 - | };
|
2017 - | ::pretty_assertions::assert_eq!(input, expected);
|
2018 - | let output = crate::output::RpcV2CborDenseMapsOutput {
|
2019 - | dense_struct_map: ::std::option::Option::None,
|
2020 - | dense_number_map: ::std::option::Option::None,
|
2021 - | dense_boolean_map: ::std::option::Option::None,
|
2022 - | dense_string_map: ::std::option::Option::None,
|
2023 - | dense_set_map: ::std::option::Option::None,
|
2024 - | };
|
2025 - | Ok(output)
|
2026 - | };
|
2027 - | sender.send(()).await.expect("receiver dropped early");
|
2028 - | result
|
2029 - | }
|
2030 - | })
|
2031 - | .build_unchecked();
|
2085 + | let service = crate::service::RpcV2Protocol::builder::<
|
2086 + | ::aws_smithy_http_server::body::BoxBody,
|
2087 + | _,
|
2088 + | _,
|
2089 + | _,
|
2090 + | >(config)
|
2091 + | .rpc_v2_cbor_dense_maps(move |input: crate::input::RpcV2CborDenseMapsInput| {
|
2092 + | let sender = sender.clone();
|
2093 + | async move {
|
2094 + | let result = {
|
2095 + | let expected = crate::input::RpcV2CborDenseMapsInput {
|
2096 + | dense_struct_map: ::std::option::Option::Some({
|
2097 + | let mut ret = ::std::collections::HashMap::new();
|
2098 + | ret.insert(
|
2099 + | "foo".to_owned(),
|
2100 + | crate::model::GreetingStruct {
|
2101 + | hi: ::std::option::Option::Some("there".to_owned()),
|
2102 + | },
|
2103 + | );
|
2104 + | ret.insert(
|
2105 + | "baz".to_owned(),
|
2106 + | crate::model::GreetingStruct {
|
2107 + | hi: ::std::option::Option::Some("bye".to_owned()),
|
2108 + | },
|
2109 + | );
|
2110 + | ret
|
2111 + | }),
|
2112 + | dense_number_map: ::std::option::Option::None,
|
2113 + | dense_boolean_map: ::std::option::Option::None,
|
2114 + | dense_string_map: ::std::option::Option::None,
|
2115 + | dense_set_map: ::std::option::Option::None,
|
2116 + | };
|
2117 + | ::pretty_assertions::assert_eq!(input, expected);
|
2118 + | let output = crate::output::RpcV2CborDenseMapsOutput {
|
2119 + | dense_struct_map: ::std::option::Option::None,
|
2120 + | dense_number_map: ::std::option::Option::None,
|
2121 + | dense_boolean_map: ::std::option::Option::None,
|
2122 + | dense_string_map: ::std::option::Option::None,
|
2123 + | dense_set_map: ::std::option::Option::None,
|
2124 + | };
|
2125 + | Ok(output)
|
2126 + | };
|
2127 + | sender.send(()).await.expect("receiver dropped early");
|
2128 + | result
|
2129 + | }
|
2130 + | })
|
2131 + | .build_unchecked();
|
2032 2132 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2033 2133 | .await
|
2034 2134 | .expect("unable to make an HTTP request");
|
2035 2135 | assert!(
|
2036 2136 | receiver.recv().await.is_some(),
|
2037 2137 | "we expected operation handler to be invoked but it was not entered"
|
2038 2138 | );
|
2039 2139 | }
|
2040 2140 |
|
2041 2141 | /// Ensure that 0 and false are sent over the wire in all maps and lists
|
2042 2142 | /// Test ID: RpcV2CborSerializesZeroValuesInMaps
|
2043 2143 | #[::tokio::test]
|
2044 2144 | #[::tracing_test::traced_test]
|
2045 2145 | async fn rpc_v2_cbor_serializes_zero_values_in_maps_request() {
|
2046 2146 | #[allow(unused_mut)]
|
2047 - | let mut http_request = http::Request::builder()
|
2147 + | let mut http_request = ::http_1x::Request::builder()
|
2048 2148 | .uri("/service/RpcV2Protocol/operation/RpcV2CborDenseMaps")
|
2049 2149 | .method("POST")
|
2050 2150 | .header("Accept", "application/cbor")
|
2051 2151 | .header("Content-Type", "application/cbor")
|
2052 2152 | .header("smithy-protocol", "rpc-v2-cbor")
|
2053 - | .body(::aws_smithy_http_server::body::Body::from(
|
2054 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2055 - | "om5kZW5zZU51bWJlck1hcKFheABvZGVuc2VCb29sZWFuTWFwoWF49A==".as_bytes(),
|
2056 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
2153 + | .body(::aws_smithy_http_server::body::boxed(
|
2154 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2155 + | &::aws_smithy_protocol_test::decode_body_data(
|
2156 + | "om5kZW5zZU51bWJlck1hcKFheABvZGVuc2VCb29sZWFuTWFwoWF49A==".as_bytes(),
|
2157 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
2158 + | ),
|
2057 2159 | )),
|
2058 2160 | ))
|
2059 2161 | .unwrap();
|
2060 2162 | #[allow(unused_mut)]
|
2061 2163 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2062 2164 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
2063 - | let service =
|
2064 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2065 - | .rpc_v2_cbor_dense_maps(move |input: crate::input::RpcV2CborDenseMapsInput| {
|
2066 - | let sender = sender.clone();
|
2067 - | async move {
|
2068 - | let result = {
|
2069 - | let expected = crate::input::RpcV2CborDenseMapsInput {
|
2070 - | dense_number_map: ::std::option::Option::Some({
|
2071 - | let mut ret = ::std::collections::HashMap::new();
|
2072 - | ret.insert("x".to_owned(), 0);
|
2073 - | ret
|
2074 - | }),
|
2075 - | dense_boolean_map: ::std::option::Option::Some({
|
2076 - | let mut ret = ::std::collections::HashMap::new();
|
2077 - | ret.insert("x".to_owned(), false);
|
2078 - | ret
|
2079 - | }),
|
2080 - | dense_struct_map: ::std::option::Option::None,
|
2081 - | dense_string_map: ::std::option::Option::None,
|
2082 - | dense_set_map: ::std::option::Option::None,
|
2083 - | };
|
2084 - | ::pretty_assertions::assert_eq!(input, expected);
|
2085 - | let output = crate::output::RpcV2CborDenseMapsOutput {
|
2086 - | dense_struct_map: ::std::option::Option::None,
|
2087 - | dense_number_map: ::std::option::Option::None,
|
2088 - | dense_boolean_map: ::std::option::Option::None,
|
2089 - | dense_string_map: ::std::option::Option::None,
|
2090 - | dense_set_map: ::std::option::Option::None,
|
2091 - | };
|
2092 - | Ok(output)
|
2093 - | };
|
2094 - | sender.send(()).await.expect("receiver dropped early");
|
2095 - | result
|
2096 - | }
|
2097 - | })
|
2098 - | .build_unchecked();
|
2165 + | let service = crate::service::RpcV2Protocol::builder::<
|
2166 + | ::aws_smithy_http_server::body::BoxBody,
|
2167 + | _,
|
2168 + | _,
|
2169 + | _,
|
2170 + | >(config)
|
2171 + | .rpc_v2_cbor_dense_maps(move |input: crate::input::RpcV2CborDenseMapsInput| {
|
2172 + | let sender = sender.clone();
|
2173 + | async move {
|
2174 + | let result = {
|
2175 + | let expected = crate::input::RpcV2CborDenseMapsInput {
|
2176 + | dense_number_map: ::std::option::Option::Some({
|
2177 + | let mut ret = ::std::collections::HashMap::new();
|
2178 + | ret.insert("x".to_owned(), 0);
|
2179 + | ret
|
2180 + | }),
|
2181 + | dense_boolean_map: ::std::option::Option::Some({
|
2182 + | let mut ret = ::std::collections::HashMap::new();
|
2183 + | ret.insert("x".to_owned(), false);
|
2184 + | ret
|
2185 + | }),
|
2186 + | dense_struct_map: ::std::option::Option::None,
|
2187 + | dense_string_map: ::std::option::Option::None,
|
2188 + | dense_set_map: ::std::option::Option::None,
|
2189 + | };
|
2190 + | ::pretty_assertions::assert_eq!(input, expected);
|
2191 + | let output = crate::output::RpcV2CborDenseMapsOutput {
|
2192 + | dense_struct_map: ::std::option::Option::None,
|
2193 + | dense_number_map: ::std::option::Option::None,
|
2194 + | dense_boolean_map: ::std::option::Option::None,
|
2195 + | dense_string_map: ::std::option::Option::None,
|
2196 + | dense_set_map: ::std::option::Option::None,
|
2197 + | };
|
2198 + | Ok(output)
|
2199 + | };
|
2200 + | sender.send(()).await.expect("receiver dropped early");
|
2201 + | result
|
2202 + | }
|
2203 + | })
|
2204 + | .build_unchecked();
|
2099 2205 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2100 2206 | .await
|
2101 2207 | .expect("unable to make an HTTP request");
|
2102 2208 | assert!(
|
2103 2209 | receiver.recv().await.is_some(),
|
2104 2210 | "we expected operation handler to be invoked but it was not entered"
|
2105 2211 | );
|
2106 2212 | }
|
2107 2213 |
|
2108 2214 | /// A request that contains a dense map of sets.
|
2109 2215 | /// Test ID: RpcV2CborSerializesDenseSetMap
|
2110 2216 | #[::tokio::test]
|
2111 2217 | #[::tracing_test::traced_test]
|
2112 2218 | async fn rpc_v2_cbor_serializes_dense_set_map_request() {
|
2113 2219 | #[allow(unused_mut)]
|
2114 - | let mut http_request = http::Request::builder()
|
2220 + | let mut http_request = ::http_1x::Request::builder()
|
2115 2221 | .uri("/service/RpcV2Protocol/operation/RpcV2CborDenseMaps")
|
2116 2222 | .method("POST")
|
2117 2223 | .header("Accept", "application/cbor")
|
2118 2224 | .header("Content-Type", "application/cbor")
|
2119 2225 | .header("smithy-protocol", "rpc-v2-cbor")
|
2120 - | .body(::aws_smithy_http_server::body::Body::from(
|
2121 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2122 - | "oWtkZW5zZVNldE1hcKJheIBheYJhYWFi".as_bytes(),
|
2123 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
2226 + | .body(::aws_smithy_http_server::body::boxed(
|
2227 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2228 + | &::aws_smithy_protocol_test::decode_body_data(
|
2229 + | "oWtkZW5zZVNldE1hcKJheIBheYJhYWFi".as_bytes(),
|
2230 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
2231 + | ),
|
2124 2232 | )),
|
2125 2233 | ))
|
2126 2234 | .unwrap();
|
2127 2235 | #[allow(unused_mut)]
|
2128 2236 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2129 2237 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
2130 - | let service =
|
2131 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2132 - | .rpc_v2_cbor_dense_maps(move |input: crate::input::RpcV2CborDenseMapsInput| {
|
2133 - | let sender = sender.clone();
|
2134 - | async move {
|
2135 - | let result = {
|
2136 - | let expected = crate::input::RpcV2CborDenseMapsInput {
|
2137 - | dense_set_map: ::std::option::Option::Some({
|
2138 - | let mut ret = ::std::collections::HashMap::new();
|
2139 - | ret.insert(
|
2140 - | "x".to_owned(),
|
2141 - | vec![].try_into().expect("this is only used in tests"),
|
2142 - | );
|
2143 - | ret.insert(
|
2144 - | "y".to_owned(),
|
2145 - | vec!["a".to_owned(), "b".to_owned()]
|
2146 - | .try_into()
|
2147 - | .expect("this is only used in tests"),
|
2148 - | );
|
2149 - | ret
|
2150 - | }),
|
2151 - | dense_struct_map: ::std::option::Option::None,
|
2152 - | dense_number_map: ::std::option::Option::None,
|
2153 - | dense_boolean_map: ::std::option::Option::None,
|
2154 - | dense_string_map: ::std::option::Option::None,
|
2155 - | };
|
2156 - | ::pretty_assertions::assert_eq!(input, expected);
|
2157 - | let output = crate::output::RpcV2CborDenseMapsOutput {
|
2158 - | dense_struct_map: ::std::option::Option::None,
|
2159 - | dense_number_map: ::std::option::Option::None,
|
2160 - | dense_boolean_map: ::std::option::Option::None,
|
2161 - | dense_string_map: ::std::option::Option::None,
|
2162 - | dense_set_map: ::std::option::Option::None,
|
2163 - | };
|
2164 - | Ok(output)
|
2165 - | };
|
2166 - | sender.send(()).await.expect("receiver dropped early");
|
2167 - | result
|
2168 - | }
|
2169 - | })
|
2170 - | .build_unchecked();
|
2238 + | let service = crate::service::RpcV2Protocol::builder::<
|
2239 + | ::aws_smithy_http_server::body::BoxBody,
|
2240 + | _,
|
2241 + | _,
|
2242 + | _,
|
2243 + | >(config)
|
2244 + | .rpc_v2_cbor_dense_maps(move |input: crate::input::RpcV2CborDenseMapsInput| {
|
2245 + | let sender = sender.clone();
|
2246 + | async move {
|
2247 + | let result = {
|
2248 + | let expected = crate::input::RpcV2CborDenseMapsInput {
|
2249 + | dense_set_map: ::std::option::Option::Some({
|
2250 + | let mut ret = ::std::collections::HashMap::new();
|
2251 + | ret.insert(
|
2252 + | "x".to_owned(),
|
2253 + | vec![].try_into().expect("this is only used in tests"),
|
2254 + | );
|
2255 + | ret.insert(
|
2256 + | "y".to_owned(),
|
2257 + | vec!["a".to_owned(), "b".to_owned()]
|
2258 + | .try_into()
|
2259 + | .expect("this is only used in tests"),
|
2260 + | );
|
2261 + | ret
|
2262 + | }),
|
2263 + | dense_struct_map: ::std::option::Option::None,
|
2264 + | dense_number_map: ::std::option::Option::None,
|
2265 + | dense_boolean_map: ::std::option::Option::None,
|
2266 + | dense_string_map: ::std::option::Option::None,
|
2267 + | };
|
2268 + | ::pretty_assertions::assert_eq!(input, expected);
|
2269 + | let output = crate::output::RpcV2CborDenseMapsOutput {
|
2270 + | dense_struct_map: ::std::option::Option::None,
|
2271 + | dense_number_map: ::std::option::Option::None,
|
2272 + | dense_boolean_map: ::std::option::Option::None,
|
2273 + | dense_string_map: ::std::option::Option::None,
|
2274 + | dense_set_map: ::std::option::Option::None,
|
2275 + | };
|
2276 + | Ok(output)
|
2277 + | };
|
2278 + | sender.send(()).await.expect("receiver dropped early");
|
2279 + | result
|
2280 + | }
|
2281 + | })
|
2282 + | .build_unchecked();
|
2171 2283 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2172 2284 | .await
|
2173 2285 | .expect("unable to make an HTTP request");
|
2174 2286 | assert!(
|
2175 2287 | receiver.recv().await.is_some(),
|
2176 2288 | "we expected operation handler to be invoked but it was not entered"
|
2177 2289 | );
|
2178 2290 | }
|
2179 2291 |
|
2180 2292 | /// Deserializes maps
|
2181 2293 | /// Test ID: RpcV2CborMaps
|
2182 2294 | #[::tokio::test]
|
2183 2295 | #[::tracing_test::traced_test]
|
2184 2296 | async fn rpc_v2_cbor_maps_response() {
|
2185 2297 | let output = crate::output::RpcV2CborDenseMapsOutput {
|
2186 2298 | dense_struct_map: ::std::option::Option::Some({
|
2187 2299 | let mut ret = ::std::collections::HashMap::new();
|
2188 2300 | ret.insert(
|
2189 2301 | "foo".to_owned(),
|
2190 2302 | crate::model::GreetingStruct {
|
2191 2303 | hi: ::std::option::Option::Some("there".to_owned()),
|
2192 2304 | },
|
2193 2305 | );
|
2194 2306 | ret.insert(
|
2195 2307 | "baz".to_owned(),
|
2196 2308 | crate::model::GreetingStruct {
|
2197 2309 | hi: ::std::option::Option::Some("bye".to_owned()),
|
2198 2310 | },
|
2199 2311 | );
|
2200 2312 | ret
|
2201 2313 | }),
|
2202 2314 | dense_number_map: ::std::option::Option::None,
|
2203 2315 | dense_boolean_map: ::std::option::Option::None,
|
2204 2316 | dense_string_map: ::std::option::Option::None,
|
2205 2317 | dense_set_map: ::std::option::Option::None,
|
2206 2318 | };
|
2207 2319 | use ::aws_smithy_http_server::response::IntoResponse;
|
2208 2320 | let http_response = output.into_response();
|
2209 2321 | ::pretty_assertions::assert_eq!(
|
2210 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2322 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2211 2323 | http_response.status()
|
2212 2324 | );
|
2213 2325 | let expected_headers = [
|
2214 2326 | ("Content-Type", "application/cbor"),
|
2215 2327 | ("smithy-protocol", "rpc-v2-cbor"),
|
2216 2328 | ];
|
2217 2329 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2218 2330 | http_response.headers(),
|
2219 2331 | expected_headers,
|
2220 2332 | ));
|
2221 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2333 + | use ::http_body_util::BodyExt;
|
2334 + | let body = http_response
|
2335 + | .into_body()
|
2336 + | .collect()
|
2222 2337 | .await
|
2223 - | .expect("unable to extract body to bytes");
|
2338 + | .expect("unable to collect body")
|
2339 + | .to_bytes();
|
2224 2340 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2225 2341 | &body,
|
2226 2342 | "oW5kZW5zZVN0cnVjdE1hcKJjZm9voWJoaWV0aGVyZWNiYXqhYmhpY2J5ZQ==",
|
2227 2343 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
2228 2344 | ));
|
2229 2345 | }
|
2230 2346 |
|
2231 2347 | /// Ensure that 0 and false are sent over the wire in all maps and lists
|
2232 2348 | /// Test ID: RpcV2CborDeserializesZeroValuesInMaps
|
2233 2349 | #[::tokio::test]
|
2234 2350 | #[::tracing_test::traced_test]
|
2235 2351 | async fn rpc_v2_cbor_deserializes_zero_values_in_maps_response() {
|
2236 2352 | let output = crate::output::RpcV2CborDenseMapsOutput {
|
2237 2353 | dense_number_map: ::std::option::Option::Some({
|
2238 2354 | let mut ret = ::std::collections::HashMap::new();
|
2239 2355 | ret.insert("x".to_owned(), 0);
|
2240 2356 | ret
|
2241 2357 | }),
|
2242 2358 | dense_boolean_map: ::std::option::Option::Some({
|
2243 2359 | let mut ret = ::std::collections::HashMap::new();
|
2244 2360 | ret.insert("x".to_owned(), false);
|
2245 2361 | ret
|
2246 2362 | }),
|
2247 2363 | dense_struct_map: ::std::option::Option::None,
|
2248 2364 | dense_string_map: ::std::option::Option::None,
|
2249 2365 | dense_set_map: ::std::option::Option::None,
|
2250 2366 | };
|
2251 2367 | use ::aws_smithy_http_server::response::IntoResponse;
|
2252 2368 | let http_response = output.into_response();
|
2253 2369 | ::pretty_assertions::assert_eq!(
|
2254 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2370 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2255 2371 | http_response.status()
|
2256 2372 | );
|
2257 2373 | let expected_headers = [
|
2258 2374 | ("Content-Type", "application/cbor"),
|
2259 2375 | ("smithy-protocol", "rpc-v2-cbor"),
|
2260 2376 | ];
|
2261 2377 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2262 2378 | http_response.headers(),
|
2263 2379 | expected_headers,
|
2264 2380 | ));
|
2265 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2381 + | use ::http_body_util::BodyExt;
|
2382 + | let body = http_response
|
2383 + | .into_body()
|
2384 + | .collect()
|
2266 2385 | .await
|
2267 - | .expect("unable to extract body to bytes");
|
2386 + | .expect("unable to collect body")
|
2387 + | .to_bytes();
|
2268 2388 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2269 2389 | &body,
|
2270 2390 | "om5kZW5zZU51bWJlck1hcKFheABvZGVuc2VCb29sZWFuTWFwoWF49A==",
|
2271 2391 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
2272 2392 | ));
|
2273 2393 | }
|
2274 2394 |
|
2275 2395 | /// A response that contains a dense map of sets
|
2276 2396 | /// Test ID: RpcV2CborDeserializesDenseSetMap
|
2277 2397 | #[::tokio::test]
|
2278 2398 | #[::tracing_test::traced_test]
|
2279 2399 | async fn rpc_v2_cbor_deserializes_dense_set_map_response() {
|
2280 2400 | let output = crate::output::RpcV2CborDenseMapsOutput {
|
2281 2401 | dense_set_map: ::std::option::Option::Some({
|
2282 2402 | let mut ret = ::std::collections::HashMap::new();
|
2283 2403 | ret.insert(
|
2284 2404 | "x".to_owned(),
|
2285 2405 | vec![].try_into().expect("this is only used in tests"),
|
2286 2406 | );
|
2287 2407 | ret.insert(
|
2288 2408 | "y".to_owned(),
|
2289 2409 | vec!["a".to_owned(), "b".to_owned()]
|
2290 2410 | .try_into()
|
2291 2411 | .expect("this is only used in tests"),
|
2292 2412 | );
|
2293 2413 | ret
|
2294 2414 | }),
|
2295 2415 | dense_struct_map: ::std::option::Option::None,
|
2296 2416 | dense_number_map: ::std::option::Option::None,
|
2297 2417 | dense_boolean_map: ::std::option::Option::None,
|
2298 2418 | dense_string_map: ::std::option::Option::None,
|
2299 2419 | };
|
2300 2420 | use ::aws_smithy_http_server::response::IntoResponse;
|
2301 2421 | let http_response = output.into_response();
|
2302 2422 | ::pretty_assertions::assert_eq!(
|
2303 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2423 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2304 2424 | http_response.status()
|
2305 2425 | );
|
2306 2426 | let expected_headers = [
|
2307 2427 | ("Content-Type", "application/cbor"),
|
2308 2428 | ("smithy-protocol", "rpc-v2-cbor"),
|
2309 2429 | ];
|
2310 2430 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2311 2431 | http_response.headers(),
|
2312 2432 | expected_headers,
|
2313 2433 | ));
|
2314 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2434 + | use ::http_body_util::BodyExt;
|
2435 + | let body = http_response
|
2436 + | .into_body()
|
2437 + | .collect()
|
2315 2438 | .await
|
2316 - | .expect("unable to extract body to bytes");
|
2439 + | .expect("unable to collect body")
|
2440 + | .to_bytes();
|
2317 2441 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2318 2442 | &body,
|
2319 2443 | "oWtkZW5zZVNldE1hcKJheIBheYJhYWFi",
|
2320 2444 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
2321 2445 | ));
|
2322 2446 | }
|
2323 2447 | }
|
2324 2448 |
|
2325 2449 | ::pin_project_lite::pin_project! {
|
2326 2450 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2327 2451 | /// [`RpcV2CborListsInput`](crate::input::RpcV2CborListsInput) using modelled bindings.
|
2328 2452 | pub struct RpcV2CborListsInputFuture {
|
2329 2453 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::RpcV2CborListsInput, ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
2330 2454 | }
|
2331 2455 | }
|
2332 2456 |
|
2333 2457 | impl std::future::Future for RpcV2CborListsInputFuture {
|
2334 2458 | type Output = Result<
|
2335 2459 | crate::input::RpcV2CborListsInput,
|
2336 2460 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
2337 2461 | >;
|
2338 2462 |
|
2339 2463 | fn poll(
|
2340 2464 | self: std::pin::Pin<&mut Self>,
|
2341 2465 | cx: &mut std::task::Context<'_>,
|
2342 2466 | ) -> std::task::Poll<Self::Output> {
|
2343 2467 | let this = self.project();
|
2344 2468 | this.inner.as_mut().poll(cx)
|
2345 2469 | }
|
2346 2470 | }
|
2347 2471 |
|
2348 2472 | impl<B>
|
2349 2473 | ::aws_smithy_http_server::request::FromRequest<
|
2350 2474 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
2351 2475 | B,
|
2352 2476 | > for crate::input::RpcV2CborListsInput
|
2353 2477 | where
|
2354 2478 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2355 2479 | B: 'static,
|
2356 2480 |
|
2357 2481 | B::Data: Send,
|
2358 2482 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
2359 2483 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2360 2484 | {
|
2361 2485 | type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
2362 2486 | type Future = RpcV2CborListsInputFuture;
|
2363 2487 |
|
2364 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2488 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2365 2489 | let fut = async move {
|
2366 2490 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2367 2491 | request.headers(),
|
2368 2492 | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
2369 2493 | ) {
|
2370 2494 | return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
2371 2495 | }
|
2372 2496 | crate::protocol_serde::shape_rpc_v2_cbor_lists::de_rpc_v2_cbor_lists_http_request(
|
2373 2497 | request,
|
2374 2498 | )
|
2431 2555 | #[allow(unreachable_code, unused_variables)]
|
2432 2556 | #[cfg(test)]
|
2433 2557 | mod rpc_v2_cbor_lists_test {
|
2434 2558 |
|
2435 2559 | /// Serializes RpcV2 Cbor lists
|
2436 2560 | /// Test ID: RpcV2CborLists
|
2437 2561 | #[::tokio::test]
|
2438 2562 | #[::tracing_test::traced_test]
|
2439 2563 | async fn rpc_v2_cbor_lists_request() {
|
2440 2564 | #[allow(unused_mut)]
|
2441 - | let mut http_request = http::Request::builder()
|
2565 + | let mut http_request = ::http_1x::Request::builder()
|
2442 2566 | .uri("/service/RpcV2Protocol/operation/RpcV2CborLists")
|
2443 2567 | .method("POST")
|
2444 2568 | .header("Accept", "application/cbor")
|
2445 2569 | .header("Content-Type", "application/cbor")
|
2446 2570 | .header("smithy-protocol", "rpc-v2-cbor")
|
2447 - | .body(::aws_smithy_http_server::body::Body::from(
|
2448 - | ::bytes::Bytes::copy_from_slice(
|
2449 - | &::aws_smithy_protocol_test::decode_body_data("v2pzdHJpbmdMaXN0gmNmb29jYmFyaXN0cmluZ1NldIJjZm9vY2JhcmtpbnRlZ2VyTGlzdIIBAmtib29sZWFuTGlzdIL19G10aW1lc3RhbXBMaXN0gsH7QdTX+/OAAADB+0HU1/vzgAAAaGVudW1MaXN0gmNGb29hMGtpbnRFbnVtTGlzdIIBAnBuZXN0ZWRTdHJpbmdMaXN0goJjZm9vY2JhcoJjYmF6Y3F1eG1zdHJ1Y3R1cmVMaXN0gqJhYWExYWJhMqJhYWEzYWJhNGhibG9iTGlzdIJDZm9vQ2Jhcv8=".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
2450 - | )
|
2451 - | )).unwrap();
|
2571 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
2572 + | ::bytes::Bytes::copy_from_slice(
|
2573 + | &::aws_smithy_protocol_test::decode_body_data("v2pzdHJpbmdMaXN0gmNmb29jYmFyaXN0cmluZ1NldIJjZm9vY2JhcmtpbnRlZ2VyTGlzdIIBAmtib29sZWFuTGlzdIL19G10aW1lc3RhbXBMaXN0gsH7QdTX+/OAAADB+0HU1/vzgAAAaGVudW1MaXN0gmNGb29hMGtpbnRFbnVtTGlzdIIBAnBuZXN0ZWRTdHJpbmdMaXN0goJjZm9vY2JhcoJjYmF6Y3F1eG1zdHJ1Y3R1cmVMaXN0gqJhYWExYWJhMqJhYWEzYWJhNGhibG9iTGlzdIJDZm9vQ2Jhcv8=".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
2574 + | )
|
2575 + | ))).unwrap();
|
2452 2576 | #[allow(unused_mut)]
|
2453 2577 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2454 2578 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
2455 - | let service =
|
2456 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2457 - | .rpc_v2_cbor_lists(move |input: crate::input::RpcV2CborListsInput| {
|
2458 - | let sender = sender.clone();
|
2459 - | async move {
|
2460 - | let result = {
|
2461 - | let expected = crate::input::RpcV2CborListsInput {
|
2462 - | string_list: ::std::option::Option::Some(vec![
|
2463 - | "foo".to_owned(),
|
2464 - | "bar".to_owned(),
|
2465 - | ]),
|
2466 - | string_set: ::std::option::Option::Some(
|
2467 - | vec!["foo".to_owned(), "bar".to_owned()]
|
2468 - | .try_into()
|
2469 - | .expect("this is only used in tests"),
|
2470 - | ),
|
2471 - | integer_list: ::std::option::Option::Some(vec![1, 2]),
|
2472 - | boolean_list: ::std::option::Option::Some(vec![true, false]),
|
2473 - | timestamp_list: ::std::option::Option::Some(vec![
|
2474 - | ::aws_smithy_types::DateTime::from_fractional_secs(
|
2475 - | 1398796238, 0_f64,
|
2476 - | ),
|
2477 - | ::aws_smithy_types::DateTime::from_fractional_secs(
|
2478 - | 1398796238, 0_f64,
|
2479 - | ),
|
2480 - | ]),
|
2481 - | enum_list: ::std::option::Option::Some(vec![
|
2482 - | "Foo"
|
2483 - | .parse::<crate::model::FooEnum>()
|
2484 - | .expect("static value validated to member"),
|
2485 - | "0".parse::<crate::model::FooEnum>()
|
2486 - | .expect("static value validated to member"),
|
2487 - | ]),
|
2488 - | int_enum_list: ::std::option::Option::Some(vec![1, 2]),
|
2489 - | nested_string_list: ::std::option::Option::Some(vec![
|
2490 - | vec!["foo".to_owned(), "bar".to_owned()],
|
2491 - | vec!["baz".to_owned(), "qux".to_owned()],
|
2492 - | ]),
|
2493 - | structure_list: ::std::option::Option::Some(vec![
|
2494 - | crate::model::StructureListMember {
|
2495 - | a: ::std::option::Option::Some("1".to_owned()),
|
2496 - | b: ::std::option::Option::Some("2".to_owned()),
|
2497 - | },
|
2498 - | crate::model::StructureListMember {
|
2499 - | a: ::std::option::Option::Some("3".to_owned()),
|
2500 - | b: ::std::option::Option::Some("4".to_owned()),
|
2501 - | },
|
2502 - | ]),
|
2503 - | blob_list: ::std::option::Option::Some(vec![
|
2504 - | ::aws_smithy_types::Blob::new("foo"),
|
2505 - | ::aws_smithy_types::Blob::new("bar"),
|
2506 - | ]),
|
2507 - | };
|
2508 - | ::pretty_assertions::assert_eq!(input, expected);
|
2509 - | let output = crate::output::RpcV2CborListsOutput {
|
2510 - | string_list: ::std::option::Option::None,
|
2511 - | string_set: ::std::option::Option::None,
|
2512 - | integer_list: ::std::option::Option::None,
|
2513 - | boolean_list: ::std::option::Option::None,
|
2514 - | timestamp_list: ::std::option::Option::None,
|
2515 - | enum_list: ::std::option::Option::None,
|
2516 - | int_enum_list: ::std::option::Option::None,
|
2517 - | nested_string_list: ::std::option::Option::None,
|
2518 - | structure_list: ::std::option::Option::None,
|
2519 - | blob_list: ::std::option::Option::None,
|
2520 - | };
|
2521 - | Ok(output)
|
2522 - | };
|
2523 - | sender.send(()).await.expect("receiver dropped early");
|
2524 - | result
|
2525 - | }
|
2526 - | })
|
2527 - | .build_unchecked();
|
2579 + | let service = crate::service::RpcV2Protocol::builder::<
|
2580 + | ::aws_smithy_http_server::body::BoxBody,
|
2581 + | _,
|
2582 + | _,
|
2583 + | _,
|
2584 + | >(config)
|
2585 + | .rpc_v2_cbor_lists(move |input: crate::input::RpcV2CborListsInput| {
|
2586 + | let sender = sender.clone();
|
2587 + | async move {
|
2588 + | let result = {
|
2589 + | let expected = crate::input::RpcV2CborListsInput {
|
2590 + | string_list: ::std::option::Option::Some(vec![
|
2591 + | "foo".to_owned(),
|
2592 + | "bar".to_owned(),
|
2593 + | ]),
|
2594 + | string_set: ::std::option::Option::Some(
|
2595 + | vec!["foo".to_owned(), "bar".to_owned()]
|
2596 + | .try_into()
|
2597 + | .expect("this is only used in tests"),
|
2598 + | ),
|
2599 + | integer_list: ::std::option::Option::Some(vec![1, 2]),
|
2600 + | boolean_list: ::std::option::Option::Some(vec![true, false]),
|
2601 + | timestamp_list: ::std::option::Option::Some(vec![
|
2602 + | ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
|
2603 + | ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
|
2604 + | ]),
|
2605 + | enum_list: ::std::option::Option::Some(vec![
|
2606 + | "Foo"
|
2607 + | .parse::<crate::model::FooEnum>()
|
2608 + | .expect("static value validated to member"),
|
2609 + | "0".parse::<crate::model::FooEnum>()
|
2610 + | .expect("static value validated to member"),
|
2611 + | ]),
|
2612 + | int_enum_list: ::std::option::Option::Some(vec![1, 2]),
|
2613 + | nested_string_list: ::std::option::Option::Some(vec![
|
2614 + | vec!["foo".to_owned(), "bar".to_owned()],
|
2615 + | vec!["baz".to_owned(), "qux".to_owned()],
|
2616 + | ]),
|
2617 + | structure_list: ::std::option::Option::Some(vec![
|
2618 + | crate::model::StructureListMember {
|
2619 + | a: ::std::option::Option::Some("1".to_owned()),
|
2620 + | b: ::std::option::Option::Some("2".to_owned()),
|
2621 + | },
|
2622 + | crate::model::StructureListMember {
|
2623 + | a: ::std::option::Option::Some("3".to_owned()),
|
2624 + | b: ::std::option::Option::Some("4".to_owned()),
|
2625 + | },
|
2626 + | ]),
|
2627 + | blob_list: ::std::option::Option::Some(vec![
|
2628 + | ::aws_smithy_types::Blob::new("foo"),
|
2629 + | ::aws_smithy_types::Blob::new("bar"),
|
2630 + | ]),
|
2631 + | };
|
2632 + | ::pretty_assertions::assert_eq!(input, expected);
|
2633 + | let output = crate::output::RpcV2CborListsOutput {
|
2634 + | string_list: ::std::option::Option::None,
|
2635 + | string_set: ::std::option::Option::None,
|
2636 + | integer_list: ::std::option::Option::None,
|
2637 + | boolean_list: ::std::option::Option::None,
|
2638 + | timestamp_list: ::std::option::Option::None,
|
2639 + | enum_list: ::std::option::Option::None,
|
2640 + | int_enum_list: ::std::option::Option::None,
|
2641 + | nested_string_list: ::std::option::Option::None,
|
2642 + | structure_list: ::std::option::Option::None,
|
2643 + | blob_list: ::std::option::Option::None,
|
2644 + | };
|
2645 + | Ok(output)
|
2646 + | };
|
2647 + | sender.send(()).await.expect("receiver dropped early");
|
2648 + | result
|
2649 + | }
|
2650 + | })
|
2651 + | .build_unchecked();
|
2528 2652 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2529 2653 | .await
|
2530 2654 | .expect("unable to make an HTTP request");
|
2531 2655 | assert!(
|
2532 2656 | receiver.recv().await.is_some(),
|
2533 2657 | "we expected operation handler to be invoked but it was not entered"
|
2534 2658 | );
|
2535 2659 | }
|
2536 2660 |
|
2537 2661 | /// Serializes empty JSON lists
|
2538 2662 | /// Test ID: RpcV2CborListsEmpty
|
2539 2663 | #[::tokio::test]
|
2540 2664 | #[::tracing_test::traced_test]
|
2541 2665 | async fn rpc_v2_cbor_lists_empty_request() {
|
2542 2666 | #[allow(unused_mut)]
|
2543 - | let mut http_request = http::Request::builder()
|
2667 + | let mut http_request = ::http_1x::Request::builder()
|
2544 2668 | .uri("/service/RpcV2Protocol/operation/RpcV2CborLists")
|
2545 2669 | .method("POST")
|
2546 2670 | .header("Accept", "application/cbor")
|
2547 2671 | .header("Content-Type", "application/cbor")
|
2548 2672 | .header("smithy-protocol", "rpc-v2-cbor")
|
2549 - | .body(::aws_smithy_http_server::body::Body::from(
|
2550 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2551 - | "v2pzdHJpbmdMaXN0n///".as_bytes(),
|
2552 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
2673 + | .body(::aws_smithy_http_server::body::boxed(
|
2674 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2675 + | &::aws_smithy_protocol_test::decode_body_data(
|
2676 + | "v2pzdHJpbmdMaXN0n///".as_bytes(),
|
2677 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
2678 + | ),
|
2553 2679 | )),
|
2554 2680 | ))
|
2555 2681 | .unwrap();
|
2556 2682 | #[allow(unused_mut)]
|
2557 2683 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2558 2684 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
2559 - | let service =
|
2560 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2561 - | .rpc_v2_cbor_lists(move |input: crate::input::RpcV2CborListsInput| {
|
2562 - | let sender = sender.clone();
|
2563 - | async move {
|
2564 - | let result = {
|
2565 - | let expected = crate::input::RpcV2CborListsInput {
|
2566 - | string_list: ::std::option::Option::Some(vec![]),
|
2567 - | string_set: ::std::option::Option::None,
|
2568 - | integer_list: ::std::option::Option::None,
|
2569 - | boolean_list: ::std::option::Option::None,
|
2570 - | timestamp_list: ::std::option::Option::None,
|
2571 - | enum_list: ::std::option::Option::None,
|
2572 - | int_enum_list: ::std::option::Option::None,
|
2573 - | nested_string_list: ::std::option::Option::None,
|
2574 - | structure_list: ::std::option::Option::None,
|
2575 - | blob_list: ::std::option::Option::None,
|
2576 - | };
|
2577 - | ::pretty_assertions::assert_eq!(input, expected);
|
2578 - | let output = crate::output::RpcV2CborListsOutput {
|
2579 - | string_list: ::std::option::Option::None,
|
2580 - | string_set: ::std::option::Option::None,
|
2581 - | integer_list: ::std::option::Option::None,
|
2582 - | boolean_list: ::std::option::Option::None,
|
2583 - | timestamp_list: ::std::option::Option::None,
|
2584 - | enum_list: ::std::option::Option::None,
|
2585 - | int_enum_list: ::std::option::Option::None,
|
2586 - | nested_string_list: ::std::option::Option::None,
|
2587 - | structure_list: ::std::option::Option::None,
|
2588 - | blob_list: ::std::option::Option::None,
|
2589 - | };
|
2590 - | Ok(output)
|
2591 - | };
|
2592 - | sender.send(()).await.expect("receiver dropped early");
|
2593 - | result
|
2594 - | }
|
2595 - | })
|
2596 - | .build_unchecked();
|
2597 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2598 - | .await
|
2599 - | .expect("unable to make an HTTP request");
|
2600 - | assert!(
|
2601 - | receiver.recv().await.is_some(),
|
2602 - | "we expected operation handler to be invoked but it was not entered"
|
2603 - | );
|
2604 - | }
|
2605 - |
|
2606 - | /// Serializes empty JSON definite length lists
|
2607 - | /// Test ID: RpcV2CborListsEmptyUsingDefiniteLength
|
2608 - | #[::tokio::test]
|
2609 - | #[::tracing_test::traced_test]
|
2610 - | async fn rpc_v2_cbor_lists_empty_using_definite_length_request() {
|
2611 - | #[allow(unused_mut)]
|
2612 - | let mut http_request = http::Request::builder()
|
2613 - | .uri("/service/RpcV2Protocol/operation/RpcV2CborLists")
|
2685 + | let service = crate::service::RpcV2Protocol::builder::<
|
2686 + | ::aws_smithy_http_server::body::BoxBody,
|
2687 + | _,
|
2688 + | _,
|
2689 + | _,
|
2690 + | >(config)
|
2691 + | .rpc_v2_cbor_lists(move |input: crate::input::RpcV2CborListsInput| {
|
2692 + | let sender = sender.clone();
|
2693 + | async move {
|
2694 + | let result = {
|
2695 + | let expected = crate::input::RpcV2CborListsInput {
|
2696 + | string_list: ::std::option::Option::Some(vec![]),
|
2697 + | string_set: ::std::option::Option::None,
|
2698 + | integer_list: ::std::option::Option::None,
|
2699 + | boolean_list: ::std::option::Option::None,
|
2700 + | timestamp_list: ::std::option::Option::None,
|
2701 + | enum_list: ::std::option::Option::None,
|
2702 + | int_enum_list: ::std::option::Option::None,
|
2703 + | nested_string_list: ::std::option::Option::None,
|
2704 + | structure_list: ::std::option::Option::None,
|
2705 + | blob_list: ::std::option::Option::None,
|
2706 + | };
|
2707 + | ::pretty_assertions::assert_eq!(input, expected);
|
2708 + | let output = crate::output::RpcV2CborListsOutput {
|
2709 + | string_list: ::std::option::Option::None,
|
2710 + | string_set: ::std::option::Option::None,
|
2711 + | integer_list: ::std::option::Option::None,
|
2712 + | boolean_list: ::std::option::Option::None,
|
2713 + | timestamp_list: ::std::option::Option::None,
|
2714 + | enum_list: ::std::option::Option::None,
|
2715 + | int_enum_list: ::std::option::Option::None,
|
2716 + | nested_string_list: ::std::option::Option::None,
|
2717 + | structure_list: ::std::option::Option::None,
|
2718 + | blob_list: ::std::option::Option::None,
|
2719 + | };
|
2720 + | Ok(output)
|
2721 + | };
|
2722 + | sender.send(()).await.expect("receiver dropped early");
|
2723 + | result
|
2724 + | }
|
2725 + | })
|
2726 + | .build_unchecked();
|
2727 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2728 + | .await
|
2729 + | .expect("unable to make an HTTP request");
|
2730 + | assert!(
|
2731 + | receiver.recv().await.is_some(),
|
2732 + | "we expected operation handler to be invoked but it was not entered"
|
2733 + | );
|
2734 + | }
|
2735 + |
|
2736 + | /// Serializes empty JSON definite length lists
|
2737 + | /// Test ID: RpcV2CborListsEmptyUsingDefiniteLength
|
2738 + | #[::tokio::test]
|
2739 + | #[::tracing_test::traced_test]
|
2740 + | async fn rpc_v2_cbor_lists_empty_using_definite_length_request() {
|
2741 + | #[allow(unused_mut)]
|
2742 + | let mut http_request = ::http_1x::Request::builder()
|
2743 + | .uri("/service/RpcV2Protocol/operation/RpcV2CborLists")
|
2614 2744 | .method("POST")
|
2615 2745 | .header("Accept", "application/cbor")
|
2616 2746 | .header("Content-Type", "application/cbor")
|
2617 2747 | .header("smithy-protocol", "rpc-v2-cbor")
|
2618 - | .body(::aws_smithy_http_server::body::Body::from(
|
2619 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2620 - | "oWpzdHJpbmdMaXN0gA==".as_bytes(),
|
2621 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
2748 + | .body(::aws_smithy_http_server::body::boxed(
|
2749 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2750 + | &::aws_smithy_protocol_test::decode_body_data(
|
2751 + | "oWpzdHJpbmdMaXN0gA==".as_bytes(),
|
2752 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
2753 + | ),
|
2622 2754 | )),
|
2623 2755 | ))
|
2624 2756 | .unwrap();
|
2625 2757 | #[allow(unused_mut)]
|
2626 2758 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2627 2759 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
2628 - | let service =
|
2629 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2630 - | .rpc_v2_cbor_lists(move |input: crate::input::RpcV2CborListsInput| {
|
2631 - | let sender = sender.clone();
|
2632 - | async move {
|
2633 - | let result = {
|
2634 - | let expected = crate::input::RpcV2CborListsInput {
|
2635 - | string_list: ::std::option::Option::Some(vec![]),
|
2636 - | string_set: ::std::option::Option::None,
|
2637 - | integer_list: ::std::option::Option::None,
|
2638 - | boolean_list: ::std::option::Option::None,
|
2639 - | timestamp_list: ::std::option::Option::None,
|
2640 - | enum_list: ::std::option::Option::None,
|
2641 - | int_enum_list: ::std::option::Option::None,
|
2642 - | nested_string_list: ::std::option::Option::None,
|
2643 - | structure_list: ::std::option::Option::None,
|
2644 - | blob_list: ::std::option::Option::None,
|
2645 - | };
|
2646 - | ::pretty_assertions::assert_eq!(input, expected);
|
2647 - | let output = crate::output::RpcV2CborListsOutput {
|
2648 - | string_list: ::std::option::Option::None,
|
2649 - | string_set: ::std::option::Option::None,
|
2650 - | integer_list: ::std::option::Option::None,
|
2651 - | boolean_list: ::std::option::Option::None,
|
2652 - | timestamp_list: ::std::option::Option::None,
|
2653 - | enum_list: ::std::option::Option::None,
|
2654 - | int_enum_list: ::std::option::Option::None,
|
2655 - | nested_string_list: ::std::option::Option::None,
|
2656 - | structure_list: ::std::option::Option::None,
|
2657 - | blob_list: ::std::option::Option::None,
|
2658 - | };
|
2659 - | Ok(output)
|
2660 - | };
|
2661 - | sender.send(()).await.expect("receiver dropped early");
|
2662 - | result
|
2663 - | }
|
2664 - | })
|
2665 - | .build_unchecked();
|
2760 + | let service = crate::service::RpcV2Protocol::builder::<
|
2761 + | ::aws_smithy_http_server::body::BoxBody,
|
2762 + | _,
|
2763 + | _,
|
2764 + | _,
|
2765 + | >(config)
|
2766 + | .rpc_v2_cbor_lists(move |input: crate::input::RpcV2CborListsInput| {
|
2767 + | let sender = sender.clone();
|
2768 + | async move {
|
2769 + | let result = {
|
2770 + | let expected = crate::input::RpcV2CborListsInput {
|
2771 + | string_list: ::std::option::Option::Some(vec![]),
|
2772 + | string_set: ::std::option::Option::None,
|
2773 + | integer_list: ::std::option::Option::None,
|
2774 + | boolean_list: ::std::option::Option::None,
|
2775 + | timestamp_list: ::std::option::Option::None,
|
2776 + | enum_list: ::std::option::Option::None,
|
2777 + | int_enum_list: ::std::option::Option::None,
|
2778 + | nested_string_list: ::std::option::Option::None,
|
2779 + | structure_list: ::std::option::Option::None,
|
2780 + | blob_list: ::std::option::Option::None,
|
2781 + | };
|
2782 + | ::pretty_assertions::assert_eq!(input, expected);
|
2783 + | let output = crate::output::RpcV2CborListsOutput {
|
2784 + | string_list: ::std::option::Option::None,
|
2785 + | string_set: ::std::option::Option::None,
|
2786 + | integer_list: ::std::option::Option::None,
|
2787 + | boolean_list: ::std::option::Option::None,
|
2788 + | timestamp_list: ::std::option::Option::None,
|
2789 + | enum_list: ::std::option::Option::None,
|
2790 + | int_enum_list: ::std::option::Option::None,
|
2791 + | nested_string_list: ::std::option::Option::None,
|
2792 + | structure_list: ::std::option::Option::None,
|
2793 + | blob_list: ::std::option::Option::None,
|
2794 + | };
|
2795 + | Ok(output)
|
2796 + | };
|
2797 + | sender.send(()).await.expect("receiver dropped early");
|
2798 + | result
|
2799 + | }
|
2800 + | })
|
2801 + | .build_unchecked();
|
2666 2802 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2667 2803 | .await
|
2668 2804 | .expect("unable to make an HTTP request");
|
2669 2805 | assert!(
|
2670 2806 | receiver.recv().await.is_some(),
|
2671 2807 | "we expected operation handler to be invoked but it was not entered"
|
2672 2808 | );
|
2673 2809 | }
|
2674 2810 |
|
2675 2811 | /// Can deserialize indefinite length text strings inside an indefinite length list
|
2676 2812 | /// Test ID: RpcV2CborIndefiniteStringInsideIndefiniteList
|
2677 2813 | #[::tokio::test]
|
2678 2814 | #[::tracing_test::traced_test]
|
2679 2815 | async fn rpc_v2_cbor_indefinite_string_inside_indefinite_list_request() {
|
2680 2816 | #[allow(unused_mut)]
|
2681 - | let mut http_request = http::Request::builder()
|
2817 + | let mut http_request = ::http_1x::Request::builder()
|
2682 2818 | .uri("/service/RpcV2Protocol/operation/RpcV2CborLists")
|
2683 2819 | .method("POST")
|
2684 2820 | .header("Accept", "application/cbor")
|
2685 2821 | .header("Content-Type", "application/cbor")
|
2686 2822 | .header("smithy-protocol", "rpc-v2-cbor")
|
2687 - | .body(::aws_smithy_http_server::body::Body::from(
|
2688 - | ::bytes::Bytes::copy_from_slice(
|
2689 - | &::aws_smithy_protocol_test::decode_body_data("v2pzdHJpbmdMaXN0n394HUFuIGV4YW1wbGUgaW5kZWZpbml0ZSBzdHJpbmcsdyB3aGljaCB3aWxsIGJlIGNodW5rZWQsbiBvbiBlYWNoIGNvbW1h/394NUFub3RoZXIgZXhhbXBsZSBpbmRlZmluaXRlIHN0cmluZyB3aXRoIG9ubHkgb25lIGNodW5r/3ZUaGlzIGlzIGEgcGxhaW4gc3RyaW5n//8=".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
2690 - | )
|
2691 - | )).unwrap();
|
2823 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
2824 + | ::bytes::Bytes::copy_from_slice(
|
2825 + | &::aws_smithy_protocol_test::decode_body_data("v2pzdHJpbmdMaXN0n394HUFuIGV4YW1wbGUgaW5kZWZpbml0ZSBzdHJpbmcsdyB3aGljaCB3aWxsIGJlIGNodW5rZWQsbiBvbiBlYWNoIGNvbW1h/394NUFub3RoZXIgZXhhbXBsZSBpbmRlZmluaXRlIHN0cmluZyB3aXRoIG9ubHkgb25lIGNodW5r/3ZUaGlzIGlzIGEgcGxhaW4gc3RyaW5n//8=".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
2826 + | )
|
2827 + | ))).unwrap();
|
2692 2828 | #[allow(unused_mut)]
|
2693 2829 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2694 2830 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
2695 - | let service = crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(
|
2696 - | config,
|
2697 - | )
|
2831 + | let service = crate::service::RpcV2Protocol::builder::<
|
2832 + | ::aws_smithy_http_server::body::BoxBody,
|
2833 + | _,
|
2834 + | _,
|
2835 + | _,
|
2836 + | >(config)
|
2698 2837 | .rpc_v2_cbor_lists(move |input: crate::input::RpcV2CborListsInput| {
|
2699 2838 | let sender = sender.clone();
|
2700 2839 | async move {
|
2701 2840 | let result = {
|
2702 2841 | let expected = crate::input::RpcV2CborListsInput {
|
2703 2842 | string_list: ::std::option::Option::Some(vec![
|
2704 2843 | "An example indefinite string, which will be chunked, on each comma"
|
2705 2844 | .to_owned(),
|
2706 2845 | "Another example indefinite string with only one chunk".to_owned(),
|
2707 2846 | "This is a plain string".to_owned(),
|
2708 2847 | ]),
|
2709 2848 | string_set: ::std::option::Option::None,
|
2710 2849 | integer_list: ::std::option::Option::None,
|
2711 2850 | boolean_list: ::std::option::Option::None,
|
2712 2851 | timestamp_list: ::std::option::Option::None,
|
2713 2852 | enum_list: ::std::option::Option::None,
|
2714 2853 | int_enum_list: ::std::option::Option::None,
|
2715 2854 | nested_string_list: ::std::option::Option::None,
|
2716 2855 | structure_list: ::std::option::Option::None,
|
2717 2856 | blob_list: ::std::option::Option::None,
|
2718 2857 | };
|
2719 2858 | ::pretty_assertions::assert_eq!(input, expected);
|
2720 2859 | let output = crate::output::RpcV2CborListsOutput {
|
2721 2860 | string_list: ::std::option::Option::None,
|
2722 2861 | string_set: ::std::option::Option::None,
|
2723 2862 | integer_list: ::std::option::Option::None,
|
2724 2863 | boolean_list: ::std::option::Option::None,
|
2725 2864 | timestamp_list: ::std::option::Option::None,
|
2726 2865 | enum_list: ::std::option::Option::None,
|
2727 2866 | int_enum_list: ::std::option::Option::None,
|
2728 2867 | nested_string_list: ::std::option::Option::None,
|
2729 2868 | structure_list: ::std::option::Option::None,
|
2730 2869 | blob_list: ::std::option::Option::None,
|
2731 2870 | };
|
2732 2871 | Ok(output)
|
2733 2872 | };
|
2734 2873 | sender.send(()).await.expect("receiver dropped early");
|
2735 2874 | result
|
2736 2875 | }
|
2737 2876 | })
|
2738 2877 | .build_unchecked();
|
2739 2878 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2740 2879 | .await
|
2741 2880 | .expect("unable to make an HTTP request");
|
2742 2881 | assert!(
|
2743 2882 | receiver.recv().await.is_some(),
|
2744 2883 | "we expected operation handler to be invoked but it was not entered"
|
2745 2884 | );
|
2746 2885 | }
|
2747 2886 |
|
2748 2887 | /// Can deserialize indefinite length text strings inside a definite length list
|
2749 2888 | /// Test ID: RpcV2CborIndefiniteStringInsideDefiniteList
|
2750 2889 | #[::tokio::test]
|
2751 2890 | #[::tracing_test::traced_test]
|
2752 2891 | async fn rpc_v2_cbor_indefinite_string_inside_definite_list_request() {
|
2753 2892 | #[allow(unused_mut)]
|
2754 - | let mut http_request = http::Request::builder()
|
2893 + | let mut http_request = ::http_1x::Request::builder()
|
2755 2894 | .uri("/service/RpcV2Protocol/operation/RpcV2CborLists")
|
2756 2895 | .method("POST")
|
2757 2896 | .header("Accept", "application/cbor")
|
2758 2897 | .header("Content-Type", "application/cbor")
|
2759 2898 | .header("smithy-protocol", "rpc-v2-cbor")
|
2760 - | .body(::aws_smithy_http_server::body::Body::from(
|
2761 - | ::bytes::Bytes::copy_from_slice(
|
2762 - | &::aws_smithy_protocol_test::decode_body_data("oWpzdHJpbmdMaXN0g394HUFuIGV4YW1wbGUgaW5kZWZpbml0ZSBzdHJpbmcsdyB3aGljaCB3aWxsIGJlIGNodW5rZWQsbiBvbiBlYWNoIGNvbW1h/394NUFub3RoZXIgZXhhbXBsZSBpbmRlZmluaXRlIHN0cmluZyB3aXRoIG9ubHkgb25lIGNodW5r/3ZUaGlzIGlzIGEgcGxhaW4gc3RyaW5n".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
2763 - | )
|
2764 - | )).unwrap();
|
2899 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
2900 + | ::bytes::Bytes::copy_from_slice(
|
2901 + | &::aws_smithy_protocol_test::decode_body_data("oWpzdHJpbmdMaXN0g394HUFuIGV4YW1wbGUgaW5kZWZpbml0ZSBzdHJpbmcsdyB3aGljaCB3aWxsIGJlIGNodW5rZWQsbiBvbiBlYWNoIGNvbW1h/394NUFub3RoZXIgZXhhbXBsZSBpbmRlZmluaXRlIHN0cmluZyB3aXRoIG9ubHkgb25lIGNodW5r/3ZUaGlzIGlzIGEgcGxhaW4gc3RyaW5n".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
2902 + | )
|
2903 + | ))).unwrap();
|
2765 2904 | #[allow(unused_mut)]
|
2766 2905 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2767 2906 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
2768 - | let service = crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(
|
2769 - | config,
|
2770 - | )
|
2907 + | let service = crate::service::RpcV2Protocol::builder::<
|
2908 + | ::aws_smithy_http_server::body::BoxBody,
|
2909 + | _,
|
2910 + | _,
|
2911 + | _,
|
2912 + | >(config)
|
2771 2913 | .rpc_v2_cbor_lists(move |input: crate::input::RpcV2CborListsInput| {
|
2772 2914 | let sender = sender.clone();
|
2773 2915 | async move {
|
2774 2916 | let result = {
|
2775 2917 | let expected = crate::input::RpcV2CborListsInput {
|
2776 2918 | string_list: ::std::option::Option::Some(vec![
|
2777 2919 | "An example indefinite string, which will be chunked, on each comma"
|
2778 2920 | .to_owned(),
|
2779 2921 | "Another example indefinite string with only one chunk".to_owned(),
|
2780 2922 | "This is a plain string".to_owned(),
|
2859 3001 | },
|
2860 3002 | ]),
|
2861 3003 | blob_list: ::std::option::Option::Some(vec![
|
2862 3004 | ::aws_smithy_types::Blob::new("foo"),
|
2863 3005 | ::aws_smithy_types::Blob::new("bar"),
|
2864 3006 | ]),
|
2865 3007 | };
|
2866 3008 | use ::aws_smithy_http_server::response::IntoResponse;
|
2867 3009 | let http_response = output.into_response();
|
2868 3010 | ::pretty_assertions::assert_eq!(
|
2869 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3011 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2870 3012 | http_response.status()
|
2871 3013 | );
|
2872 3014 | let expected_headers = [
|
2873 3015 | ("Content-Type", "application/cbor"),
|
2874 3016 | ("smithy-protocol", "rpc-v2-cbor"),
|
2875 3017 | ];
|
2876 3018 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2877 3019 | http_response.headers(),
|
2878 3020 | expected_headers,
|
2879 3021 | ));
|
2880 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3022 + | use ::http_body_util::BodyExt;
|
3023 + | let body = http_response
|
3024 + | .into_body()
|
3025 + | .collect()
|
2881 3026 | .await
|
2882 - | .expect("unable to extract body to bytes");
|
3027 + | .expect("unable to collect body")
|
3028 + | .to_bytes();
|
2883 3029 | ::aws_smithy_protocol_test::assert_ok(
|
2884 3030 | ::aws_smithy_protocol_test::validate_body(&body, "v2pzdHJpbmdMaXN0n2Nmb29jYmFy/2lzdHJpbmdTZXSfY2Zvb2NiYXL/a2ludGVnZXJMaXN0nwEC/2tib29sZWFuTGlzdJ/19P9tdGltZXN0YW1wTGlzdJ/B+0HU1/vzgAAAwftB1Nf784AAAP9oZW51bUxpc3SfY0Zvb2Ew/2tpbnRFbnVtTGlzdJ8BAv9wbmVzdGVkU3RyaW5nTGlzdJ+fY2Zvb2NiYXL/n2NiYXpjcXV4//9tc3RydWN0dXJlTGlzdJ+/YWFhMWFiYTL/v2FhYTNhYmE0//9oYmxvYkxpc3SfQ2Zvb0NiYXL//w==", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
2885 3031 | );
|
2886 3032 | }
|
2887 3033 |
|
2888 3034 | /// Serializes empty RpcV2 Cbor lists
|
2889 3035 | /// Test ID: RpcV2CborListsEmpty
|
2890 3036 | #[::tokio::test]
|
2891 3037 | #[::tracing_test::traced_test]
|
2892 3038 | async fn rpc_v2_cbor_lists_empty_response() {
|
2893 3039 | let output = crate::output::RpcV2CborListsOutput {
|
2894 3040 | string_list: ::std::option::Option::Some(vec![]),
|
2895 3041 | string_set: ::std::option::Option::None,
|
2896 3042 | integer_list: ::std::option::Option::None,
|
2897 3043 | boolean_list: ::std::option::Option::None,
|
2898 3044 | timestamp_list: ::std::option::Option::None,
|
2899 3045 | enum_list: ::std::option::Option::None,
|
2900 3046 | int_enum_list: ::std::option::Option::None,
|
2901 3047 | nested_string_list: ::std::option::Option::None,
|
2902 3048 | structure_list: ::std::option::Option::None,
|
2903 3049 | blob_list: ::std::option::Option::None,
|
2904 3050 | };
|
2905 3051 | use ::aws_smithy_http_server::response::IntoResponse;
|
2906 3052 | let http_response = output.into_response();
|
2907 3053 | ::pretty_assertions::assert_eq!(
|
2908 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3054 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2909 3055 | http_response.status()
|
2910 3056 | );
|
2911 3057 | let expected_headers = [
|
2912 3058 | ("Content-Type", "application/cbor"),
|
2913 3059 | ("smithy-protocol", "rpc-v2-cbor"),
|
2914 3060 | ];
|
2915 3061 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2916 3062 | http_response.headers(),
|
2917 3063 | expected_headers,
|
2918 3064 | ));
|
2919 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3065 + | use ::http_body_util::BodyExt;
|
3066 + | let body = http_response
|
3067 + | .into_body()
|
3068 + | .collect()
|
2920 3069 | .await
|
2921 - | .expect("unable to extract body to bytes");
|
3070 + | .expect("unable to collect body")
|
3071 + | .to_bytes();
|
2922 3072 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2923 3073 | &body,
|
2924 3074 | "v2pzdHJpbmdMaXN0n///",
|
2925 3075 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
2926 3076 | ));
|
2927 3077 | }
|
2928 3078 | }
|
2929 3079 |
|
2930 3080 | ::pin_project_lite::pin_project! {
|
2931 3081 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2932 3082 | /// [`SimpleScalarPropertiesInput`](crate::input::SimpleScalarPropertiesInput) using modelled bindings.
|
2933 3083 | pub struct SimpleScalarPropertiesInputFuture {
|
2934 3084 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SimpleScalarPropertiesInput, ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
2935 3085 | }
|
2936 3086 | }
|
2937 3087 |
|
2938 3088 | impl std::future::Future for SimpleScalarPropertiesInputFuture {
|
2939 3089 | type Output = Result<
|
2940 3090 | crate::input::SimpleScalarPropertiesInput,
|
2941 3091 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
2942 3092 | >;
|
2943 3093 |
|
2944 3094 | fn poll(
|
2945 3095 | self: std::pin::Pin<&mut Self>,
|
2946 3096 | cx: &mut std::task::Context<'_>,
|
2947 3097 | ) -> std::task::Poll<Self::Output> {
|
2948 3098 | let this = self.project();
|
2949 3099 | this.inner.as_mut().poll(cx)
|
2950 3100 | }
|
2951 3101 | }
|
2952 3102 |
|
2953 3103 | impl<B>
|
2954 3104 | ::aws_smithy_http_server::request::FromRequest<
|
2955 3105 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
2956 3106 | B,
|
2957 3107 | > for crate::input::SimpleScalarPropertiesInput
|
2958 3108 | where
|
2959 3109 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2960 3110 | B: 'static,
|
2961 3111 |
|
2962 3112 | B::Data: Send,
|
2963 3113 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
2964 3114 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2965 3115 | {
|
2966 3116 | type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
2967 3117 | type Future = SimpleScalarPropertiesInputFuture;
|
2968 3118 |
|
2969 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3119 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2970 3120 | let fut = async move {
|
2971 3121 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2972 3122 | request.headers(),
|
2973 3123 | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
2974 3124 | ) {
|
2975 3125 | return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
2976 3126 | }
|
2977 3127 | crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties_http_request(request)
|
2978 3128 | .await
|
2979 3129 | };
|
2980 3130 | use ::futures_util::future::TryFutureExt;
|
2981 3131 | let fut = fut.map_err(
|
2982 3132 | |e: ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
|
2983 3133 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2984 3134 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(
|
2985 3135 | e,
|
2986 3136 | )
|
2987 3137 | },
|
2988 3138 | );
|
2989 3139 | SimpleScalarPropertiesInputFuture {
|
2990 3140 | inner: Box::pin(fut),
|
2991 3141 | }
|
2992 3142 | }
|
2993 3143 | }
|
2994 3144 | impl
|
2995 3145 | ::aws_smithy_http_server::response::IntoResponse<
|
2996 3146 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
2997 3147 | > for crate::output::SimpleScalarPropertiesOutput
|
2998 3148 | {
|
2999 3149 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3000 3150 | match crate::protocol_serde::shape_simple_scalar_properties::ser_simple_scalar_properties_http_response(self) {
|
3001 3151 | Ok(response) => response,
|
3002 3152 | Err(e) => {
|
3003 3153 | ::tracing::error!(error = %e, "failed to serialize response");
|
3004 3154 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
3005 3155 | }
|
3006 3156 | }
|
3007 3157 | }
|
3008 3158 | }
|
3009 3159 |
|
3010 3160 | #[allow(unreachable_code, unused_variables)]
|
3011 3161 | #[cfg(test)]
|
3012 3162 | mod simple_scalar_properties_test {
|
3013 3163 |
|
3014 3164 | /// Serializes simple scalar properties
|
3015 3165 | /// Test ID: RpcV2CborSimpleScalarProperties
|
3016 3166 | #[::tokio::test]
|
3017 3167 | #[::tracing_test::traced_test]
|
3018 3168 | async fn rpc_v2_cbor_simple_scalar_properties_request() {
|
3019 3169 | #[allow(unused_mut)]
|
3020 - | let mut http_request = http::Request::builder()
|
3021 - | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
3022 - | .method("POST")
|
3023 - | .header("Accept", "application/cbor")
|
3024 - | .header("Content-Type", "application/cbor")
|
3025 - | .header("smithy-protocol", "rpc-v2-cbor")
|
3026 - | .body(::aws_smithy_http_server::body::Body::from(
|
3027 - | ::bytes::Bytes::copy_from_slice(
|
3028 - | &::aws_smithy_protocol_test::decode_body_data("v2lieXRlVmFsdWUFa2RvdWJsZVZhbHVl+z/+OVgQYk3TcWZhbHNlQm9vbGVhblZhbHVl9GpmbG9hdFZhbHVl+kD0AABsaW50ZWdlclZhbHVlGQEAaWxvbmdWYWx1ZRkmkWpzaG9ydFZhbHVlGSaqa3N0cmluZ1ZhbHVlZnNpbXBsZXB0cnVlQm9vbGVhblZhbHVl9WlibG9iVmFsdWVDZm9v/w==".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
3029 - | )
|
3030 - | )).unwrap();
|
3031 - | #[allow(unused_mut)]
|
3032 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3033 - | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
3034 - | let service =
|
3035 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3036 - | .simple_scalar_properties(
|
3037 - | move |input: crate::input::SimpleScalarPropertiesInput| {
|
3038 - | let sender = sender.clone();
|
3039 - | async move {
|
3040 - | let result = {
|
3041 - | use ::aws_smithy_protocol_test::FloatEquals;
|
3042 - | let expected = crate::input::SimpleScalarPropertiesInput {
|
3043 - | byte_value: ::std::option::Option::Some(5),
|
3044 - | double_value: ::std::option::Option::Some(1.889_f64),
|
3045 - | false_boolean_value: ::std::option::Option::Some(false),
|
3046 - | float_value: ::std::option::Option::Some(7.625_f32),
|
3047 - | integer_value: ::std::option::Option::Some(256),
|
3048 - | long_value: ::std::option::Option::Some(9873),
|
3049 - | short_value: ::std::option::Option::Some(9898),
|
3050 - | string_value: ::std::option::Option::Some("simple".to_owned()),
|
3051 - | true_boolean_value: ::std::option::Option::Some(true),
|
3052 - | blob_value: ::std::option::Option::Some(
|
3053 - | ::aws_smithy_types::Blob::new("foo"),
|
3054 - | ),
|
3055 - | };
|
3056 - | ::pretty_assertions::assert_eq!(
|
3057 - | input.true_boolean_value,
|
3058 - | expected.true_boolean_value,
|
3059 - | "Unexpected value for `true_boolean_value`"
|
3060 - | );
|
3061 - | ::pretty_assertions::assert_eq!(
|
3062 - | input.false_boolean_value,
|
3063 - | expected.false_boolean_value,
|
3064 - | "Unexpected value for `false_boolean_value`"
|
3065 - | );
|
3066 - | ::pretty_assertions::assert_eq!(
|
3067 - | input.byte_value,
|
3068 - | expected.byte_value,
|
3069 - | "Unexpected value for `byte_value`"
|
3070 - | );
|
3071 - | assert!(
|
3072 - | input.double_value.float_equals(&expected.double_value),
|
3073 - | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3074 - | expected.double_value,
|
3075 - | input.double_value
|
3076 - | );
|
3077 - | assert!(
|
3078 - | input.float_value.float_equals(&expected.float_value),
|
3079 - | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3080 - | expected.float_value,
|
3081 - | input.float_value
|
3082 - | );
|
3083 - | ::pretty_assertions::assert_eq!(
|
3084 - | input.integer_value,
|
3085 - | expected.integer_value,
|
3086 - | "Unexpected value for `integer_value`"
|
3087 - | );
|
3088 - | ::pretty_assertions::assert_eq!(
|
3089 - | input.long_value,
|
3090 - | expected.long_value,
|
3091 - | "Unexpected value for `long_value`"
|
3092 - | );
|
3093 - | ::pretty_assertions::assert_eq!(
|
3094 - | input.short_value,
|
3095 - | expected.short_value,
|
3096 - | "Unexpected value for `short_value`"
|
3097 - | );
|
3098 - | ::pretty_assertions::assert_eq!(
|
3099 - | input.string_value,
|
3100 - | expected.string_value,
|
3101 - | "Unexpected value for `string_value`"
|
3102 - | );
|
3103 - | ::pretty_assertions::assert_eq!(
|
3104 - | input.blob_value,
|
3105 - | expected.blob_value,
|
3106 - | "Unexpected value for `blob_value`"
|
3107 - | );
|
3108 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
3109 - | true_boolean_value: ::std::option::Option::None,
|
3110 - | false_boolean_value: ::std::option::Option::None,
|
3111 - | byte_value: ::std::option::Option::None,
|
3112 - | double_value: ::std::option::Option::None,
|
3113 - | float_value: ::std::option::Option::None,
|
3114 - | integer_value: ::std::option::Option::None,
|
3115 - | long_value: ::std::option::Option::None,
|
3116 - | short_value: ::std::option::Option::None,
|
3117 - | string_value: ::std::option::Option::None,
|
3118 - | blob_value: ::std::option::Option::None,
|
3119 - | };
|
3120 - | output
|
3121 - | };
|
3122 - | sender.send(()).await.expect("receiver dropped early");
|
3123 - | result
|
3124 - | }
|
3125 - | },
|
3126 - | )
|
3127 - | .build_unchecked();
|
3128 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3129 - | .await
|
3130 - | .expect("unable to make an HTTP request");
|
3131 - | assert!(
|
3132 - | receiver.recv().await.is_some(),
|
3133 - | "we expected operation handler to be invoked but it was not entered"
|
3134 - | );
|
3135 - | }
|
3136 - |
|
3137 - | /// The server should be capable of deserializing simple scalar properties
|
3138 - | /// encoded using a map with a definite length. The server should also be able to parse
|
3139 - | /// a key encoded using an indefinite length string.
|
3140 - | /// Test ID: RpcV2CborSimpleScalarPropertiesUsingIndefiniteLength
|
3141 - | #[::tokio::test]
|
3142 - | #[::tracing_test::traced_test]
|
3143 - | async fn rpc_v2_cbor_simple_scalar_properties_using_indefinite_length_request() {
|
3144 - | #[allow(unused_mut)]
|
3145 - | let mut http_request = http::Request::builder()
|
3170 + | let mut http_request = ::http_1x::Request::builder()
|
3146 3171 | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
3147 3172 | .method("POST")
|
3148 3173 | .header("Accept", "application/cbor")
|
3149 3174 | .header("Content-Type", "application/cbor")
|
3150 3175 | .header("smithy-protocol", "rpc-v2-cbor")
|
3151 - | .body(::aws_smithy_http_server::body::Body::from(
|
3152 - | ::bytes::Bytes::copy_from_slice(
|
3153 - | &::aws_smithy_protocol_test::decode_body_data("qmlieXRlVmFsdWUFf2Zkb3VibGVlVmFsdWX/+z/+OVgQYk3Tf2VmYWxzZWdCb29sZWFuZVZhbHVl//RqZmxvYXRWYWx1ZfpA9AAAbGludGVnZXJWYWx1ZRkBAGlsb25nVmFsdWUZJpFqc2hvcnRWYWx1ZRkmqn9mc3RyaW5nZVZhbHVl/2ZzaW1wbGVwdHJ1ZUJvb2xlYW5WYWx1ZfVpYmxvYlZhbHVlQ2Zvbw==".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
3154 - | )
|
3155 - | )).unwrap();
|
3156 - | #[allow(unused_mut)]
|
3157 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3158 - | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
3159 - | let service =
|
3160 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3161 - | .simple_scalar_properties(
|
3162 - | move |input: crate::input::SimpleScalarPropertiesInput| {
|
3163 - | let sender = sender.clone();
|
3164 - | async move {
|
3165 - | let result = {
|
3166 - | use ::aws_smithy_protocol_test::FloatEquals;
|
3167 - | let expected = crate::input::SimpleScalarPropertiesInput {
|
3168 - | byte_value: ::std::option::Option::Some(5),
|
3169 - | double_value: ::std::option::Option::Some(1.889_f64),
|
3170 - | false_boolean_value: ::std::option::Option::Some(false),
|
3171 - | float_value: ::std::option::Option::Some(7.625_f32),
|
3172 - | integer_value: ::std::option::Option::Some(256),
|
3173 - | long_value: ::std::option::Option::Some(9873),
|
3174 - | short_value: ::std::option::Option::Some(9898),
|
3175 - | string_value: ::std::option::Option::Some("simple".to_owned()),
|
3176 - | true_boolean_value: ::std::option::Option::Some(true),
|
3177 - | blob_value: ::std::option::Option::Some(
|
3178 - | ::aws_smithy_types::Blob::new("foo"),
|
3179 - | ),
|
3180 - | };
|
3181 - | ::pretty_assertions::assert_eq!(
|
3182 - | input.true_boolean_value,
|
3183 - | expected.true_boolean_value,
|
3184 - | "Unexpected value for `true_boolean_value`"
|
3185 - | );
|
3186 - | ::pretty_assertions::assert_eq!(
|
3187 - | input.false_boolean_value,
|
3188 - | expected.false_boolean_value,
|
3189 - | "Unexpected value for `false_boolean_value`"
|
3190 - | );
|
3191 - | ::pretty_assertions::assert_eq!(
|
3192 - | input.byte_value,
|
3193 - | expected.byte_value,
|
3194 - | "Unexpected value for `byte_value`"
|
3195 - | );
|
3196 - | assert!(
|
3197 - | input.double_value.float_equals(&expected.double_value),
|
3198 - | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3199 - | expected.double_value,
|
3200 - | input.double_value
|
3201 - | );
|
3202 - | assert!(
|
3203 - | input.float_value.float_equals(&expected.float_value),
|
3204 - | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3205 - | expected.float_value,
|
3206 - | input.float_value
|
3207 - | );
|
3208 - | ::pretty_assertions::assert_eq!(
|
3209 - | input.integer_value,
|
3210 - | expected.integer_value,
|
3211 - | "Unexpected value for `integer_value`"
|
3212 - | );
|
3213 - | ::pretty_assertions::assert_eq!(
|
3214 - | input.long_value,
|
3215 - | expected.long_value,
|
3216 - | "Unexpected value for `long_value`"
|
3217 - | );
|
3218 - | ::pretty_assertions::assert_eq!(
|
3219 - | input.short_value,
|
3220 - | expected.short_value,
|
3221 - | "Unexpected value for `short_value`"
|
3222 - | );
|
3223 - | ::pretty_assertions::assert_eq!(
|
3224 - | input.string_value,
|
3225 - | expected.string_value,
|
3226 - | "Unexpected value for `string_value`"
|
3227 - | );
|
3228 - | ::pretty_assertions::assert_eq!(
|
3229 - | input.blob_value,
|
3230 - | expected.blob_value,
|
3231 - | "Unexpected value for `blob_value`"
|
3232 - | );
|
3233 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
3234 - | true_boolean_value: ::std::option::Option::None,
|
3235 - | false_boolean_value: ::std::option::Option::None,
|
3236 - | byte_value: ::std::option::Option::None,
|
3237 - | double_value: ::std::option::Option::None,
|
3238 - | float_value: ::std::option::Option::None,
|
3239 - | integer_value: ::std::option::Option::None,
|
3240 - | long_value: ::std::option::Option::None,
|
3241 - | short_value: ::std::option::Option::None,
|
3242 - | string_value: ::std::option::Option::None,
|
3243 - | blob_value: ::std::option::Option::None,
|
3244 - | };
|
3245 - | output
|
3246 - | };
|
3247 - | sender.send(()).await.expect("receiver dropped early");
|
3248 - | result
|
3249 - | }
|
3250 - | },
|
3251 - | )
|
3252 - | .build_unchecked();
|
3253 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3254 - | .await
|
3255 - | .expect("unable to make an HTTP request");
|
3256 - | assert!(
|
3257 - | receiver.recv().await.is_some(),
|
3258 - | "we expected operation handler to be invoked but it was not entered"
|
3259 - | );
|
3260 - | }
|
3261 - |
|
3262 - | /// RpcV2 Cbor should not deserialize null structure values
|
3263 - | /// Test ID: RpcV2CborServerDoesntDeSerializeNullStructureValues
|
3264 - | #[::tokio::test]
|
3265 - | #[::tracing_test::traced_test]
|
3266 - | async fn rpc_v2_cbor_server_doesnt_de_serialize_null_structure_values_request() {
|
3267 - | #[allow(unused_mut)]
|
3268 - | let mut http_request = http::Request::builder()
|
3269 - | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
3270 - | .method("POST")
|
3271 - | .header("Accept", "application/cbor")
|
3272 - | .header("Content-Type", "application/cbor")
|
3273 - | .header("smithy-protocol", "rpc-v2-cbor")
|
3274 - | .body(::aws_smithy_http_server::body::Body::from(
|
3275 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3276 - | "v2tzdHJpbmdWYWx1Zfb/".as_bytes(),
|
3277 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
3278 - | )),
|
3279 - | ))
|
3280 - | .unwrap();
|
3281 - | #[allow(unused_mut)]
|
3282 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3283 - | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
3284 - | let service =
|
3285 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3286 - | .simple_scalar_properties(
|
3287 - | move |input: crate::input::SimpleScalarPropertiesInput| {
|
3288 - | let sender = sender.clone();
|
3289 - | async move {
|
3290 - | let result = {
|
3291 - | use ::aws_smithy_protocol_test::FloatEquals;
|
3292 - | let expected = crate::input::SimpleScalarPropertiesInput {
|
3293 - | true_boolean_value: ::std::option::Option::None,
|
3294 - | false_boolean_value: ::std::option::Option::None,
|
3295 - | byte_value: ::std::option::Option::None,
|
3296 - | double_value: ::std::option::Option::None,
|
3297 - | float_value: ::std::option::Option::None,
|
3298 - | integer_value: ::std::option::Option::None,
|
3299 - | long_value: ::std::option::Option::None,
|
3300 - | short_value: ::std::option::Option::None,
|
3301 - | string_value: ::std::option::Option::None,
|
3302 - | blob_value: ::std::option::Option::None,
|
3303 - | };
|
3304 - | ::pretty_assertions::assert_eq!(
|
3305 - | input.true_boolean_value,
|
3306 - | expected.true_boolean_value,
|
3307 - | "Unexpected value for `true_boolean_value`"
|
3308 - | );
|
3309 - | ::pretty_assertions::assert_eq!(
|
3310 - | input.false_boolean_value,
|
3311 - | expected.false_boolean_value,
|
3312 - | "Unexpected value for `false_boolean_value`"
|
3313 - | );
|
3314 - | ::pretty_assertions::assert_eq!(
|
3315 - | input.byte_value,
|
3316 - | expected.byte_value,
|
3317 - | "Unexpected value for `byte_value`"
|
3318 - | );
|
3319 - | assert!(
|
3320 - | input.double_value.float_equals(&expected.double_value),
|
3321 - | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3322 - | expected.double_value,
|
3323 - | input.double_value
|
3324 - | );
|
3325 - | assert!(
|
3326 - | input.float_value.float_equals(&expected.float_value),
|
3327 - | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3328 - | expected.float_value,
|
3329 - | input.float_value
|
3330 - | );
|
3331 - | ::pretty_assertions::assert_eq!(
|
3332 - | input.integer_value,
|
3333 - | expected.integer_value,
|
3334 - | "Unexpected value for `integer_value`"
|
3335 - | );
|
3336 - | ::pretty_assertions::assert_eq!(
|
3337 - | input.long_value,
|
3338 - | expected.long_value,
|
3339 - | "Unexpected value for `long_value`"
|
3340 - | );
|
3341 - | ::pretty_assertions::assert_eq!(
|
3342 - | input.short_value,
|
3343 - | expected.short_value,
|
3344 - | "Unexpected value for `short_value`"
|
3345 - | );
|
3346 - | ::pretty_assertions::assert_eq!(
|
3347 - | input.string_value,
|
3348 - | expected.string_value,
|
3349 - | "Unexpected value for `string_value`"
|
3350 - | );
|
3351 - | ::pretty_assertions::assert_eq!(
|
3352 - | input.blob_value,
|
3353 - | expected.blob_value,
|
3354 - | "Unexpected value for `blob_value`"
|
3355 - | );
|
3356 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
3357 - | true_boolean_value: ::std::option::Option::None,
|
3358 - | false_boolean_value: ::std::option::Option::None,
|
3359 - | byte_value: ::std::option::Option::None,
|
3360 - | double_value: ::std::option::Option::None,
|
3361 - | float_value: ::std::option::Option::None,
|
3362 - | integer_value: ::std::option::Option::None,
|
3363 - | long_value: ::std::option::Option::None,
|
3364 - | short_value: ::std::option::Option::None,
|
3365 - | string_value: ::std::option::Option::None,
|
3366 - | blob_value: ::std::option::Option::None,
|
3367 - | };
|
3368 - | output
|
3369 - | };
|
3370 - | sender.send(()).await.expect("receiver dropped early");
|
3371 - | result
|
3372 - | }
|
3373 - | },
|
3374 - | )
|
3375 - | .build_unchecked();
|
3376 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3377 - | .await
|
3378 - | .expect("unable to make an HTTP request");
|
3379 - | assert!(
|
3380 - | receiver.recv().await.is_some(),
|
3381 - | "we expected operation handler to be invoked but it was not entered"
|
3382 - | );
|
3383 - | }
|
3384 - |
|
3385 - | /// Supports handling NaN float values.
|
3386 - | /// Test ID: RpcV2CborSupportsNaNFloatInputs
|
3387 - | #[::tokio::test]
|
3388 - | #[::tracing_test::traced_test]
|
3389 - | async fn rpc_v2_cbor_supports_na_n_float_inputs_request() {
|
3390 - | #[allow(unused_mut)]
|
3391 - | let mut http_request = http::Request::builder()
|
3392 - | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
3393 - | .method("POST")
|
3394 - | .header("Accept", "application/cbor")
|
3395 - | .header("Content-Type", "application/cbor")
|
3396 - | .header("smithy-protocol", "rpc-v2-cbor")
|
3397 - | .body(::aws_smithy_http_server::body::Body::from(
|
3398 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3399 - | "v2tkb3VibGVWYWx1Zft/+AAAAAAAAGpmbG9hdFZhbHVl+n/AAAD/".as_bytes(),
|
3400 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
3401 - | )),
|
3402 - | ))
|
3403 - | .unwrap();
|
3176 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
3177 + | ::bytes::Bytes::copy_from_slice(
|
3178 + | &::aws_smithy_protocol_test::decode_body_data("v2lieXRlVmFsdWUFa2RvdWJsZVZhbHVl+z/+OVgQYk3TcWZhbHNlQm9vbGVhblZhbHVl9GpmbG9hdFZhbHVl+kD0AABsaW50ZWdlclZhbHVlGQEAaWxvbmdWYWx1ZRkmkWpzaG9ydFZhbHVlGSaqa3N0cmluZ1ZhbHVlZnNpbXBsZXB0cnVlQm9vbGVhblZhbHVl9WlibG9iVmFsdWVDZm9v/w==".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
3179 + | )
|
3180 + | ))).unwrap();
|
3404 3181 | #[allow(unused_mut)]
|
3405 3182 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3406 3183 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
3407 - | let service = crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(
|
3408 - | config,
|
3409 - | )
|
3184 + | let service = crate::service::RpcV2Protocol::builder::<
|
3185 + | ::aws_smithy_http_server::body::BoxBody,
|
3186 + | _,
|
3187 + | _,
|
3188 + | _,
|
3189 + | >(config)
|
3410 3190 | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3411 3191 | let sender = sender.clone();
|
3412 3192 | async move {
|
3413 3193 | let result = {
|
3414 3194 | use ::aws_smithy_protocol_test::FloatEquals;
|
3415 3195 | let expected = crate::input::SimpleScalarPropertiesInput {
|
3416 - | double_value: ::std::option::Option::Some(
|
3417 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3418 - | "NaN",
|
3419 - | )
|
3420 - | .expect("invalid string for number"),
|
3421 - | ),
|
3422 - | float_value: ::std::option::Option::Some(
|
3423 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3424 - | "NaN",
|
3425 - | )
|
3426 - | .expect("invalid string for number"),
|
3427 - | ),
|
3428 - | true_boolean_value: ::std::option::Option::None,
|
3429 - | false_boolean_value: ::std::option::Option::None,
|
3430 - | byte_value: ::std::option::Option::None,
|
3431 - | integer_value: ::std::option::Option::None,
|
3432 - | long_value: ::std::option::Option::None,
|
3433 - | short_value: ::std::option::Option::None,
|
3434 - | string_value: ::std::option::Option::None,
|
3435 - | blob_value: ::std::option::Option::None,
|
3196 + | byte_value: ::std::option::Option::Some(5),
|
3197 + | double_value: ::std::option::Option::Some(1.889_f64),
|
3198 + | false_boolean_value: ::std::option::Option::Some(false),
|
3199 + | float_value: ::std::option::Option::Some(7.625_f32),
|
3200 + | integer_value: ::std::option::Option::Some(256),
|
3201 + | long_value: ::std::option::Option::Some(9873),
|
3202 + | short_value: ::std::option::Option::Some(9898),
|
3203 + | string_value: ::std::option::Option::Some("simple".to_owned()),
|
3204 + | true_boolean_value: ::std::option::Option::Some(true),
|
3205 + | blob_value: ::std::option::Option::Some(::aws_smithy_types::Blob::new(
|
3206 + | "foo",
|
3207 + | )),
|
3436 3208 | };
|
3437 3209 | ::pretty_assertions::assert_eq!(
|
3438 3210 | input.true_boolean_value,
|
3439 3211 | expected.true_boolean_value,
|
3440 3212 | "Unexpected value for `true_boolean_value`"
|
3441 3213 | );
|
3442 3214 | ::pretty_assertions::assert_eq!(
|
3443 3215 | input.false_boolean_value,
|
3444 3216 | expected.false_boolean_value,
|
3445 3217 | "Unexpected value for `false_boolean_value`"
|
3639 3406 | .build_unchecked();
|
3640 3407 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3641 3408 | .await
|
3642 3409 | .expect("unable to make an HTTP request");
|
3643 3410 | assert!(
|
3644 3411 | receiver.recv().await.is_some(),
|
3645 3412 | "we expected operation handler to be invoked but it was not entered"
|
3646 3413 | );
|
3647 3414 | }
|
3648 3415 |
|
3649 - | /// Supports handling Infinity float values.
|
3650 - | /// Test ID: RpcV2CborSupportsNegativeInfinityFloatInputs
|
3416 + | /// RpcV2 Cbor should not deserialize null structure values
|
3417 + | /// Test ID: RpcV2CborServerDoesntDeSerializeNullStructureValues
|
3651 3418 | #[::tokio::test]
|
3652 3419 | #[::tracing_test::traced_test]
|
3653 - | async fn rpc_v2_cbor_supports_negative_infinity_float_inputs_request() {
|
3420 + | async fn rpc_v2_cbor_server_doesnt_de_serialize_null_structure_values_request() {
|
3654 3421 | #[allow(unused_mut)]
|
3655 - | let mut http_request = http::Request::builder()
|
3422 + | let mut http_request = ::http_1x::Request::builder()
|
3656 3423 | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
3657 3424 | .method("POST")
|
3658 3425 | .header("Accept", "application/cbor")
|
3659 3426 | .header("Content-Type", "application/cbor")
|
3660 3427 | .header("smithy-protocol", "rpc-v2-cbor")
|
3661 - | .body(::aws_smithy_http_server::body::Body::from(
|
3662 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3663 - | "v2tkb3VibGVWYWx1Zfv/8AAAAAAAAGpmbG9hdFZhbHVl+v+AAAD/".as_bytes(),
|
3664 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
3428 + | .body(::aws_smithy_http_server::body::boxed(
|
3429 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3430 + | &::aws_smithy_protocol_test::decode_body_data(
|
3431 + | "v2tzdHJpbmdWYWx1Zfb/".as_bytes(),
|
3432 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
3433 + | ),
|
3665 3434 | )),
|
3666 3435 | ))
|
3667 3436 | .unwrap();
|
3668 3437 | #[allow(unused_mut)]
|
3669 3438 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3670 3439 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
3671 - | let service = crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(
|
3672 - | config,
|
3673 - | )
|
3440 + | let service = crate::service::RpcV2Protocol::builder::<
|
3441 + | ::aws_smithy_http_server::body::BoxBody,
|
3442 + | _,
|
3443 + | _,
|
3444 + | _,
|
3445 + | >(config)
|
3446 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3447 + | let sender = sender.clone();
|
3448 + | async move {
|
3449 + | let result = {
|
3450 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3451 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
3452 + | true_boolean_value: ::std::option::Option::None,
|
3453 + | false_boolean_value: ::std::option::Option::None,
|
3454 + | byte_value: ::std::option::Option::None,
|
3455 + | double_value: ::std::option::Option::None,
|
3456 + | float_value: ::std::option::Option::None,
|
3457 + | integer_value: ::std::option::Option::None,
|
3458 + | long_value: ::std::option::Option::None,
|
3459 + | short_value: ::std::option::Option::None,
|
3460 + | string_value: ::std::option::Option::None,
|
3461 + | blob_value: ::std::option::Option::None,
|
3462 + | };
|
3463 + | ::pretty_assertions::assert_eq!(
|
3464 + | input.true_boolean_value,
|
3465 + | expected.true_boolean_value,
|
3466 + | "Unexpected value for `true_boolean_value`"
|
3467 + | );
|
3468 + | ::pretty_assertions::assert_eq!(
|
3469 + | input.false_boolean_value,
|
3470 + | expected.false_boolean_value,
|
3471 + | "Unexpected value for `false_boolean_value`"
|
3472 + | );
|
3473 + | ::pretty_assertions::assert_eq!(
|
3474 + | input.byte_value,
|
3475 + | expected.byte_value,
|
3476 + | "Unexpected value for `byte_value`"
|
3477 + | );
|
3478 + | assert!(
|
3479 + | input.double_value.float_equals(&expected.double_value),
|
3480 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3481 + | expected.double_value,
|
3482 + | input.double_value
|
3483 + | );
|
3484 + | assert!(
|
3485 + | input.float_value.float_equals(&expected.float_value),
|
3486 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3487 + | expected.float_value,
|
3488 + | input.float_value
|
3489 + | );
|
3490 + | ::pretty_assertions::assert_eq!(
|
3491 + | input.integer_value,
|
3492 + | expected.integer_value,
|
3493 + | "Unexpected value for `integer_value`"
|
3494 + | );
|
3495 + | ::pretty_assertions::assert_eq!(
|
3496 + | input.long_value,
|
3497 + | expected.long_value,
|
3498 + | "Unexpected value for `long_value`"
|
3499 + | );
|
3500 + | ::pretty_assertions::assert_eq!(
|
3501 + | input.short_value,
|
3502 + | expected.short_value,
|
3503 + | "Unexpected value for `short_value`"
|
3504 + | );
|
3505 + | ::pretty_assertions::assert_eq!(
|
3506 + | input.string_value,
|
3507 + | expected.string_value,
|
3508 + | "Unexpected value for `string_value`"
|
3509 + | );
|
3510 + | ::pretty_assertions::assert_eq!(
|
3511 + | input.blob_value,
|
3512 + | expected.blob_value,
|
3513 + | "Unexpected value for `blob_value`"
|
3514 + | );
|
3515 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
3516 + | true_boolean_value: ::std::option::Option::None,
|
3517 + | false_boolean_value: ::std::option::Option::None,
|
3518 + | byte_value: ::std::option::Option::None,
|
3519 + | double_value: ::std::option::Option::None,
|
3520 + | float_value: ::std::option::Option::None,
|
3521 + | integer_value: ::std::option::Option::None,
|
3522 + | long_value: ::std::option::Option::None,
|
3523 + | short_value: ::std::option::Option::None,
|
3524 + | string_value: ::std::option::Option::None,
|
3525 + | blob_value: ::std::option::Option::None,
|
3526 + | };
|
3527 + | output
|
3528 + | };
|
3529 + | sender.send(()).await.expect("receiver dropped early");
|
3530 + | result
|
3531 + | }
|
3532 + | })
|
3533 + | .build_unchecked();
|
3534 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3535 + | .await
|
3536 + | .expect("unable to make an HTTP request");
|
3537 + | assert!(
|
3538 + | receiver.recv().await.is_some(),
|
3539 + | "we expected operation handler to be invoked but it was not entered"
|
3540 + | );
|
3541 + | }
|
3542 + |
|
3543 + | /// Supports handling NaN float values.
|
3544 + | /// Test ID: RpcV2CborSupportsNaNFloatInputs
|
3545 + | #[::tokio::test]
|
3546 + | #[::tracing_test::traced_test]
|
3547 + | async fn rpc_v2_cbor_supports_na_n_float_inputs_request() {
|
3548 + | #[allow(unused_mut)]
|
3549 + | let mut http_request = ::http_1x::Request::builder()
|
3550 + | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
3551 + | .method("POST")
|
3552 + | .header("Accept", "application/cbor")
|
3553 + | .header("Content-Type", "application/cbor")
|
3554 + | .header("smithy-protocol", "rpc-v2-cbor")
|
3555 + | .body(::aws_smithy_http_server::body::boxed(
|
3556 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3557 + | &::aws_smithy_protocol_test::decode_body_data(
|
3558 + | "v2tkb3VibGVWYWx1Zft/+AAAAAAAAGpmbG9hdFZhbHVl+n/AAAD/".as_bytes(),
|
3559 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
3560 + | ),
|
3561 + | )),
|
3562 + | ))
|
3563 + | .unwrap();
|
3564 + | #[allow(unused_mut)]
|
3565 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3566 + | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
3567 + | let service = crate::service::RpcV2Protocol::builder::<
|
3568 + | ::aws_smithy_http_server::body::BoxBody,
|
3569 + | _,
|
3570 + | _,
|
3571 + | _,
|
3572 + | >(config)
|
3573 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3574 + | let sender = sender.clone();
|
3575 + | async move {
|
3576 + | let result = {
|
3577 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3578 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
3579 + | double_value: ::std::option::Option::Some(
|
3580 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3581 + | "NaN",
|
3582 + | )
|
3583 + | .expect("invalid string for number"),
|
3584 + | ),
|
3585 + | float_value: ::std::option::Option::Some(
|
3586 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3587 + | "NaN",
|
3588 + | )
|
3589 + | .expect("invalid string for number"),
|
3590 + | ),
|
3591 + | true_boolean_value: ::std::option::Option::None,
|
3592 + | false_boolean_value: ::std::option::Option::None,
|
3593 + | byte_value: ::std::option::Option::None,
|
3594 + | integer_value: ::std::option::Option::None,
|
3595 + | long_value: ::std::option::Option::None,
|
3596 + | short_value: ::std::option::Option::None,
|
3597 + | string_value: ::std::option::Option::None,
|
3598 + | blob_value: ::std::option::Option::None,
|
3599 + | };
|
3600 + | ::pretty_assertions::assert_eq!(
|
3601 + | input.true_boolean_value,
|
3602 + | expected.true_boolean_value,
|
3603 + | "Unexpected value for `true_boolean_value`"
|
3604 + | );
|
3605 + | ::pretty_assertions::assert_eq!(
|
3606 + | input.false_boolean_value,
|
3607 + | expected.false_boolean_value,
|
3608 + | "Unexpected value for `false_boolean_value`"
|
3609 + | );
|
3610 + | ::pretty_assertions::assert_eq!(
|
3611 + | input.byte_value,
|
3612 + | expected.byte_value,
|
3613 + | "Unexpected value for `byte_value`"
|
3614 + | );
|
3615 + | assert!(
|
3616 + | input.double_value.float_equals(&expected.double_value),
|
3617 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3618 + | expected.double_value,
|
3619 + | input.double_value
|
3620 + | );
|
3621 + | assert!(
|
3622 + | input.float_value.float_equals(&expected.float_value),
|
3623 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3624 + | expected.float_value,
|
3625 + | input.float_value
|
3626 + | );
|
3627 + | ::pretty_assertions::assert_eq!(
|
3628 + | input.integer_value,
|
3629 + | expected.integer_value,
|
3630 + | "Unexpected value for `integer_value`"
|
3631 + | );
|
3632 + | ::pretty_assertions::assert_eq!(
|
3633 + | input.long_value,
|
3634 + | expected.long_value,
|
3635 + | "Unexpected value for `long_value`"
|
3636 + | );
|
3637 + | ::pretty_assertions::assert_eq!(
|
3638 + | input.short_value,
|
3639 + | expected.short_value,
|
3640 + | "Unexpected value for `short_value`"
|
3641 + | );
|
3642 + | ::pretty_assertions::assert_eq!(
|
3643 + | input.string_value,
|
3644 + | expected.string_value,
|
3645 + | "Unexpected value for `string_value`"
|
3646 + | );
|
3647 + | ::pretty_assertions::assert_eq!(
|
3648 + | input.blob_value,
|
3649 + | expected.blob_value,
|
3650 + | "Unexpected value for `blob_value`"
|
3651 + | );
|
3652 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
3653 + | true_boolean_value: ::std::option::Option::None,
|
3654 + | false_boolean_value: ::std::option::Option::None,
|
3655 + | byte_value: ::std::option::Option::None,
|
3656 + | double_value: ::std::option::Option::None,
|
3657 + | float_value: ::std::option::Option::None,
|
3658 + | integer_value: ::std::option::Option::None,
|
3659 + | long_value: ::std::option::Option::None,
|
3660 + | short_value: ::std::option::Option::None,
|
3661 + | string_value: ::std::option::Option::None,
|
3662 + | blob_value: ::std::option::Option::None,
|
3663 + | };
|
3664 + | output
|
3665 + | };
|
3666 + | sender.send(()).await.expect("receiver dropped early");
|
3667 + | result
|
3668 + | }
|
3669 + | })
|
3670 + | .build_unchecked();
|
3671 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3672 + | .await
|
3673 + | .expect("unable to make an HTTP request");
|
3674 + | assert!(
|
3675 + | receiver.recv().await.is_some(),
|
3676 + | "we expected operation handler to be invoked but it was not entered"
|
3677 + | );
|
3678 + | }
|
3679 + |
|
3680 + | /// Supports handling Infinity float values.
|
3681 + | /// Test ID: RpcV2CborSupportsInfinityFloatInputs
|
3682 + | #[::tokio::test]
|
3683 + | #[::tracing_test::traced_test]
|
3684 + | async fn rpc_v2_cbor_supports_infinity_float_inputs_request() {
|
3685 + | #[allow(unused_mut)]
|
3686 + | let mut http_request = ::http_1x::Request::builder()
|
3687 + | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
3688 + | .method("POST")
|
3689 + | .header("Accept", "application/cbor")
|
3690 + | .header("Content-Type", "application/cbor")
|
3691 + | .header("smithy-protocol", "rpc-v2-cbor")
|
3692 + | .body(::aws_smithy_http_server::body::boxed(
|
3693 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3694 + | &::aws_smithy_protocol_test::decode_body_data(
|
3695 + | "v2tkb3VibGVWYWx1Zft/8AAAAAAAAGpmbG9hdFZhbHVl+n+AAAD/".as_bytes(),
|
3696 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
3697 + | ),
|
3698 + | )),
|
3699 + | ))
|
3700 + | .unwrap();
|
3701 + | #[allow(unused_mut)]
|
3702 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3703 + | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
3704 + | let service = crate::service::RpcV2Protocol::builder::<
|
3705 + | ::aws_smithy_http_server::body::BoxBody,
|
3706 + | _,
|
3707 + | _,
|
3708 + | _,
|
3709 + | >(config)
|
3710 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3711 + | let sender = sender.clone();
|
3712 + | async move {
|
3713 + | let result = {
|
3714 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3715 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
3716 + | double_value: ::std::option::Option::Some(
|
3717 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3718 + | "Infinity",
|
3719 + | )
|
3720 + | .expect("invalid string for number"),
|
3721 + | ),
|
3722 + | float_value: ::std::option::Option::Some(
|
3723 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3724 + | "Infinity",
|
3725 + | )
|
3726 + | .expect("invalid string for number"),
|
3727 + | ),
|
3728 + | true_boolean_value: ::std::option::Option::None,
|
3729 + | false_boolean_value: ::std::option::Option::None,
|
3730 + | byte_value: ::std::option::Option::None,
|
3731 + | integer_value: ::std::option::Option::None,
|
3732 + | long_value: ::std::option::Option::None,
|
3733 + | short_value: ::std::option::Option::None,
|
3734 + | string_value: ::std::option::Option::None,
|
3735 + | blob_value: ::std::option::Option::None,
|
3736 + | };
|
3737 + | ::pretty_assertions::assert_eq!(
|
3738 + | input.true_boolean_value,
|
3739 + | expected.true_boolean_value,
|
3740 + | "Unexpected value for `true_boolean_value`"
|
3741 + | );
|
3742 + | ::pretty_assertions::assert_eq!(
|
3743 + | input.false_boolean_value,
|
3744 + | expected.false_boolean_value,
|
3745 + | "Unexpected value for `false_boolean_value`"
|
3746 + | );
|
3747 + | ::pretty_assertions::assert_eq!(
|
3748 + | input.byte_value,
|
3749 + | expected.byte_value,
|
3750 + | "Unexpected value for `byte_value`"
|
3751 + | );
|
3752 + | assert!(
|
3753 + | input.double_value.float_equals(&expected.double_value),
|
3754 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3755 + | expected.double_value,
|
3756 + | input.double_value
|
3757 + | );
|
3758 + | assert!(
|
3759 + | input.float_value.float_equals(&expected.float_value),
|
3760 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3761 + | expected.float_value,
|
3762 + | input.float_value
|
3763 + | );
|
3764 + | ::pretty_assertions::assert_eq!(
|
3765 + | input.integer_value,
|
3766 + | expected.integer_value,
|
3767 + | "Unexpected value for `integer_value`"
|
3768 + | );
|
3769 + | ::pretty_assertions::assert_eq!(
|
3770 + | input.long_value,
|
3771 + | expected.long_value,
|
3772 + | "Unexpected value for `long_value`"
|
3773 + | );
|
3774 + | ::pretty_assertions::assert_eq!(
|
3775 + | input.short_value,
|
3776 + | expected.short_value,
|
3777 + | "Unexpected value for `short_value`"
|
3778 + | );
|
3779 + | ::pretty_assertions::assert_eq!(
|
3780 + | input.string_value,
|
3781 + | expected.string_value,
|
3782 + | "Unexpected value for `string_value`"
|
3783 + | );
|
3784 + | ::pretty_assertions::assert_eq!(
|
3785 + | input.blob_value,
|
3786 + | expected.blob_value,
|
3787 + | "Unexpected value for `blob_value`"
|
3788 + | );
|
3789 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
3790 + | true_boolean_value: ::std::option::Option::None,
|
3791 + | false_boolean_value: ::std::option::Option::None,
|
3792 + | byte_value: ::std::option::Option::None,
|
3793 + | double_value: ::std::option::Option::None,
|
3794 + | float_value: ::std::option::Option::None,
|
3795 + | integer_value: ::std::option::Option::None,
|
3796 + | long_value: ::std::option::Option::None,
|
3797 + | short_value: ::std::option::Option::None,
|
3798 + | string_value: ::std::option::Option::None,
|
3799 + | blob_value: ::std::option::Option::None,
|
3800 + | };
|
3801 + | output
|
3802 + | };
|
3803 + | sender.send(()).await.expect("receiver dropped early");
|
3804 + | result
|
3805 + | }
|
3806 + | })
|
3807 + | .build_unchecked();
|
3808 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3809 + | .await
|
3810 + | .expect("unable to make an HTTP request");
|
3811 + | assert!(
|
3812 + | receiver.recv().await.is_some(),
|
3813 + | "we expected operation handler to be invoked but it was not entered"
|
3814 + | );
|
3815 + | }
|
3816 + |
|
3817 + | /// Supports handling Infinity float values.
|
3818 + | /// Test ID: RpcV2CborSupportsNegativeInfinityFloatInputs
|
3819 + | #[::tokio::test]
|
3820 + | #[::tracing_test::traced_test]
|
3821 + | async fn rpc_v2_cbor_supports_negative_infinity_float_inputs_request() {
|
3822 + | #[allow(unused_mut)]
|
3823 + | let mut http_request = ::http_1x::Request::builder()
|
3824 + | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
3825 + | .method("POST")
|
3826 + | .header("Accept", "application/cbor")
|
3827 + | .header("Content-Type", "application/cbor")
|
3828 + | .header("smithy-protocol", "rpc-v2-cbor")
|
3829 + | .body(::aws_smithy_http_server::body::boxed(
|
3830 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3831 + | &::aws_smithy_protocol_test::decode_body_data(
|
3832 + | "v2tkb3VibGVWYWx1Zfv/8AAAAAAAAGpmbG9hdFZhbHVl+v+AAAD/".as_bytes(),
|
3833 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
3834 + | ),
|
3835 + | )),
|
3836 + | ))
|
3837 + | .unwrap();
|
3838 + | #[allow(unused_mut)]
|
3839 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3840 + | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
3841 + | let service = crate::service::RpcV2Protocol::builder::<
|
3842 + | ::aws_smithy_http_server::body::BoxBody,
|
3843 + | _,
|
3844 + | _,
|
3845 + | _,
|
3846 + | >(config)
|
3847 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3848 + | let sender = sender.clone();
|
3849 + | async move {
|
3850 + | let result = {
|
3851 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3852 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
3853 + | double_value: ::std::option::Option::Some(
|
3854 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3855 + | "-Infinity",
|
3856 + | )
|
3857 + | .expect("invalid string for number"),
|
3858 + | ),
|
3859 + | float_value: ::std::option::Option::Some(
|
3860 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3861 + | "-Infinity",
|
3862 + | )
|
3863 + | .expect("invalid string for number"),
|
3864 + | ),
|
3865 + | true_boolean_value: ::std::option::Option::None,
|
3866 + | false_boolean_value: ::std::option::Option::None,
|
3867 + | byte_value: ::std::option::Option::None,
|
3868 + | integer_value: ::std::option::Option::None,
|
3869 + | long_value: ::std::option::Option::None,
|
3870 + | short_value: ::std::option::Option::None,
|
3871 + | string_value: ::std::option::Option::None,
|
3872 + | blob_value: ::std::option::Option::None,
|
3873 + | };
|
3874 + | ::pretty_assertions::assert_eq!(
|
3875 + | input.true_boolean_value,
|
3876 + | expected.true_boolean_value,
|
3877 + | "Unexpected value for `true_boolean_value`"
|
3878 + | );
|
3879 + | ::pretty_assertions::assert_eq!(
|
3880 + | input.false_boolean_value,
|
3881 + | expected.false_boolean_value,
|
3882 + | "Unexpected value for `false_boolean_value`"
|
3883 + | );
|
3884 + | ::pretty_assertions::assert_eq!(
|
3885 + | input.byte_value,
|
3886 + | expected.byte_value,
|
3887 + | "Unexpected value for `byte_value`"
|
3888 + | );
|
3889 + | assert!(
|
3890 + | input.double_value.float_equals(&expected.double_value),
|
3891 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3892 + | expected.double_value,
|
3893 + | input.double_value
|
3894 + | );
|
3895 + | assert!(
|
3896 + | input.float_value.float_equals(&expected.float_value),
|
3897 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3898 + | expected.float_value,
|
3899 + | input.float_value
|
3900 + | );
|
3901 + | ::pretty_assertions::assert_eq!(
|
3902 + | input.integer_value,
|
3903 + | expected.integer_value,
|
3904 + | "Unexpected value for `integer_value`"
|
3905 + | );
|
3906 + | ::pretty_assertions::assert_eq!(
|
3907 + | input.long_value,
|
3908 + | expected.long_value,
|
3909 + | "Unexpected value for `long_value`"
|
3910 + | );
|
3911 + | ::pretty_assertions::assert_eq!(
|
3912 + | input.short_value,
|
3913 + | expected.short_value,
|
3914 + | "Unexpected value for `short_value`"
|
3915 + | );
|
3916 + | ::pretty_assertions::assert_eq!(
|
3917 + | input.string_value,
|
3918 + | expected.string_value,
|
3919 + | "Unexpected value for `string_value`"
|
3920 + | );
|
3921 + | ::pretty_assertions::assert_eq!(
|
3922 + | input.blob_value,
|
3923 + | expected.blob_value,
|
3924 + | "Unexpected value for `blob_value`"
|
3925 + | );
|
3926 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
3927 + | true_boolean_value: ::std::option::Option::None,
|
3928 + | false_boolean_value: ::std::option::Option::None,
|
3929 + | byte_value: ::std::option::Option::None,
|
3930 + | double_value: ::std::option::Option::None,
|
3931 + | float_value: ::std::option::Option::None,
|
3932 + | integer_value: ::std::option::Option::None,
|
3933 + | long_value: ::std::option::Option::None,
|
3934 + | short_value: ::std::option::Option::None,
|
3935 + | string_value: ::std::option::Option::None,
|
3936 + | blob_value: ::std::option::Option::None,
|
3937 + | };
|
3938 + | output
|
3939 + | };
|
3940 + | sender.send(()).await.expect("receiver dropped early");
|
3941 + | result
|
3942 + | }
|
3943 + | })
|
3944 + | .build_unchecked();
|
3945 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3946 + | .await
|
3947 + | .expect("unable to make an HTTP request");
|
3948 + | assert!(
|
3949 + | receiver.recv().await.is_some(),
|
3950 + | "we expected operation handler to be invoked but it was not entered"
|
3951 + | );
|
3952 + | }
|
3953 + |
|
3954 + | /// The server should be capable of deserializing indefinite length text strings.
|
3955 + | /// Test ID: RpcV2CborIndefiniteLengthStringsCanBeDeserialized
|
3956 + | #[::tokio::test]
|
3957 + | #[::tracing_test::traced_test]
|
3958 + | async fn rpc_v2_cbor_indefinite_length_strings_can_be_deserialized_request() {
|
3959 + | #[allow(unused_mut)]
|
3960 + | let mut http_request = ::http_1x::Request::builder()
|
3961 + | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
3962 + | .method("POST")
|
3963 + | .header("Accept", "application/cbor")
|
3964 + | .header("Content-Type", "application/cbor")
|
3965 + | .header("smithy-protocol", "rpc-v2-cbor")
|
3966 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
3967 + | ::bytes::Bytes::copy_from_slice(
|
3968 + | &::aws_smithy_protocol_test::decode_body_data("oWtzdHJpbmdWYWx1ZX94HUFuIGV4YW1wbGUgaW5kZWZpbml0ZSBzdHJpbmcscSBjaHVua2VkIG9uIGNvbW1h/w==".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
3969 + | )
|
3970 + | ))).unwrap();
|
3971 + | #[allow(unused_mut)]
|
3972 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3973 + | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
3974 + | let service = crate::service::RpcV2Protocol::builder::<
|
3975 + | ::aws_smithy_http_server::body::BoxBody,
|
3976 + | _,
|
3977 + | _,
|
3978 + | _,
|
3979 + | >(config)
|
3980 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3981 + | let sender = sender.clone();
|
3982 + | async move {
|
3983 + | let result = {
|
3984 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3985 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
3986 + | string_value: ::std::option::Option::Some(
|
3987 + | "An example indefinite string, chunked on comma".to_owned(),
|
3988 + | ),
|
3989 + | true_boolean_value: ::std::option::Option::None,
|
3990 + | false_boolean_value: ::std::option::Option::None,
|
3991 + | byte_value: ::std::option::Option::None,
|
3992 + | double_value: ::std::option::Option::None,
|
3993 + | float_value: ::std::option::Option::None,
|
3994 + | integer_value: ::std::option::Option::None,
|
3995 + | long_value: ::std::option::Option::None,
|
3996 + | short_value: ::std::option::Option::None,
|
3997 + | blob_value: ::std::option::Option::None,
|
3998 + | };
|
3999 + | ::pretty_assertions::assert_eq!(
|
4000 + | input.true_boolean_value,
|
4001 + | expected.true_boolean_value,
|
4002 + | "Unexpected value for `true_boolean_value`"
|
4003 + | );
|
4004 + | ::pretty_assertions::assert_eq!(
|
4005 + | input.false_boolean_value,
|
4006 + | expected.false_boolean_value,
|
4007 + | "Unexpected value for `false_boolean_value`"
|
4008 + | );
|
4009 + | ::pretty_assertions::assert_eq!(
|
4010 + | input.byte_value,
|
4011 + | expected.byte_value,
|
4012 + | "Unexpected value for `byte_value`"
|
4013 + | );
|
4014 + | assert!(
|
4015 + | input.double_value.float_equals(&expected.double_value),
|
4016 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
4017 + | expected.double_value,
|
4018 + | input.double_value
|
4019 + | );
|
4020 + | assert!(
|
4021 + | input.float_value.float_equals(&expected.float_value),
|
4022 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
4023 + | expected.float_value,
|
4024 + | input.float_value
|
4025 + | );
|
4026 + | ::pretty_assertions::assert_eq!(
|
4027 + | input.integer_value,
|
4028 + | expected.integer_value,
|
4029 + | "Unexpected value for `integer_value`"
|
4030 + | );
|
4031 + | ::pretty_assertions::assert_eq!(
|
4032 + | input.long_value,
|
4033 + | expected.long_value,
|
4034 + | "Unexpected value for `long_value`"
|
4035 + | );
|
4036 + | ::pretty_assertions::assert_eq!(
|
4037 + | input.short_value,
|
4038 + | expected.short_value,
|
4039 + | "Unexpected value for `short_value`"
|
4040 + | );
|
4041 + | ::pretty_assertions::assert_eq!(
|
4042 + | input.string_value,
|
4043 + | expected.string_value,
|
4044 + | "Unexpected value for `string_value`"
|
4045 + | );
|
4046 + | ::pretty_assertions::assert_eq!(
|
4047 + | input.blob_value,
|
4048 + | expected.blob_value,
|
4049 + | "Unexpected value for `blob_value`"
|
4050 + | );
|
4051 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
4052 + | true_boolean_value: ::std::option::Option::None,
|
4053 + | false_boolean_value: ::std::option::Option::None,
|
4054 + | byte_value: ::std::option::Option::None,
|
4055 + | double_value: ::std::option::Option::None,
|
4056 + | float_value: ::std::option::Option::None,
|
4057 + | integer_value: ::std::option::Option::None,
|
4058 + | long_value: ::std::option::Option::None,
|
4059 + | short_value: ::std::option::Option::None,
|
4060 + | string_value: ::std::option::Option::None,
|
4061 + | blob_value: ::std::option::Option::None,
|
4062 + | };
|
4063 + | output
|
4064 + | };
|
4065 + | sender.send(()).await.expect("receiver dropped early");
|
4066 + | result
|
4067 + | }
|
4068 + | })
|
4069 + | .build_unchecked();
|
4070 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4071 + | .await
|
4072 + | .expect("unable to make an HTTP request");
|
4073 + | assert!(
|
4074 + | receiver.recv().await.is_some(),
|
4075 + | "we expected operation handler to be invoked but it was not entered"
|
4076 + | );
|
4077 + | }
|
4078 + |
|
4079 + | /// The server should be capable of deserializing indefinite length byte strings.
|
4080 + | /// Test ID: RpcV2CborIndefiniteLengthByteStringsCanBeDeserialized
|
4081 + | #[::tokio::test]
|
4082 + | #[::tracing_test::traced_test]
|
4083 + | async fn rpc_v2_cbor_indefinite_length_byte_strings_can_be_deserialized_request() {
|
4084 + | #[allow(unused_mut)]
|
4085 + | let mut http_request = ::http_1x::Request::builder()
|
4086 + | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
4087 + | .method("POST")
|
4088 + | .header("Accept", "application/cbor")
|
4089 + | .header("Content-Type", "application/cbor")
|
4090 + | .header("smithy-protocol", "rpc-v2-cbor")
|
4091 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
4092 + | ::bytes::Bytes::copy_from_slice(
|
4093 + | &::aws_smithy_protocol_test::decode_body_data("oWlibG9iVmFsdWVfWCJBbiBleGFtcGxlIGluZGVmaW5pdGUtYnl0ZSBzdHJpbmcsUSBjaHVua2VkIG9uIGNvbW1h/w==".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
4094 + | )
|
4095 + | ))).unwrap();
|
4096 + | #[allow(unused_mut)]
|
4097 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4098 + | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
4099 + | let service = crate::service::RpcV2Protocol::builder::<
|
4100 + | ::aws_smithy_http_server::body::BoxBody,
|
4101 + | _,
|
4102 + | _,
|
4103 + | _,
|
4104 + | >(config)
|
4105 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
4106 + | let sender = sender.clone();
|
4107 + | async move {
|
4108 + | let result = {
|
4109 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4110 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
4111 + | blob_value: ::std::option::Option::Some(::aws_smithy_types::Blob::new(
|
4112 + | "An example indefinite-byte string, chunked on comma",
|
4113 + | )),
|
4114 + | true_boolean_value: ::std::option::Option::None,
|
4115 + | false_boolean_value: ::std::option::Option::None,
|
4116 + | byte_value: ::std::option::Option::None,
|
4117 + | double_value: ::std::option::Option::None,
|
4118 + | float_value: ::std::option::Option::None,
|
4119 + | integer_value: ::std::option::Option::None,
|
4120 + | long_value: ::std::option::Option::None,
|
4121 + | short_value: ::std::option::Option::None,
|
4122 + | string_value: ::std::option::Option::None,
|
4123 + | };
|
4124 + | ::pretty_assertions::assert_eq!(
|
4125 + | input.true_boolean_value,
|
4126 + | expected.true_boolean_value,
|
4127 + | "Unexpected value for `true_boolean_value`"
|
4128 + | );
|
4129 + | ::pretty_assertions::assert_eq!(
|
4130 + | input.false_boolean_value,
|
4131 + | expected.false_boolean_value,
|
4132 + | "Unexpected value for `false_boolean_value`"
|
4133 + | );
|
4134 + | ::pretty_assertions::assert_eq!(
|
4135 + | input.byte_value,
|
4136 + | expected.byte_value,
|
4137 + | "Unexpected value for `byte_value`"
|
4138 + | );
|
4139 + | assert!(
|
4140 + | input.double_value.float_equals(&expected.double_value),
|
4141 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
4142 + | expected.double_value,
|
4143 + | input.double_value
|
4144 + | );
|
4145 + | assert!(
|
4146 + | input.float_value.float_equals(&expected.float_value),
|
4147 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
4148 + | expected.float_value,
|
4149 + | input.float_value
|
4150 + | );
|
4151 + | ::pretty_assertions::assert_eq!(
|
4152 + | input.integer_value,
|
4153 + | expected.integer_value,
|
4154 + | "Unexpected value for `integer_value`"
|
4155 + | );
|
4156 + | ::pretty_assertions::assert_eq!(
|
4157 + | input.long_value,
|
4158 + | expected.long_value,
|
4159 + | "Unexpected value for `long_value`"
|
4160 + | );
|
4161 + | ::pretty_assertions::assert_eq!(
|
4162 + | input.short_value,
|
4163 + | expected.short_value,
|
4164 + | "Unexpected value for `short_value`"
|
4165 + | );
|
4166 + | ::pretty_assertions::assert_eq!(
|
4167 + | input.string_value,
|
4168 + | expected.string_value,
|
4169 + | "Unexpected value for `string_value`"
|
4170 + | );
|
4171 + | ::pretty_assertions::assert_eq!(
|
4172 + | input.blob_value,
|
4173 + | expected.blob_value,
|
4174 + | "Unexpected value for `blob_value`"
|
4175 + | );
|
4176 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
4177 + | true_boolean_value: ::std::option::Option::None,
|
4178 + | false_boolean_value: ::std::option::Option::None,
|
4179 + | byte_value: ::std::option::Option::None,
|
4180 + | double_value: ::std::option::Option::None,
|
4181 + | float_value: ::std::option::Option::None,
|
4182 + | integer_value: ::std::option::Option::None,
|
4183 + | long_value: ::std::option::Option::None,
|
4184 + | short_value: ::std::option::Option::None,
|
4185 + | string_value: ::std::option::Option::None,
|
4186 + | blob_value: ::std::option::Option::None,
|
4187 + | };
|
4188 + | output
|
4189 + | };
|
4190 + | sender.send(()).await.expect("receiver dropped early");
|
4191 + | result
|
4192 + | }
|
4193 + | })
|
4194 + | .build_unchecked();
|
4195 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4196 + | .await
|
4197 + | .expect("unable to make an HTTP request");
|
4198 + | assert!(
|
4199 + | receiver.recv().await.is_some(),
|
4200 + | "we expected operation handler to be invoked but it was not entered"
|
4201 + | );
|
4202 + | }
|
4203 + |
|
4204 + | /// Supports upcasting from a smaller byte representation of the same data type.
|
4205 + | /// Test ID: RpcV2CborSupportsUpcastingData
|
4206 + | #[::tokio::test]
|
4207 + | #[::tracing_test::traced_test]
|
4208 + | async fn rpc_v2_cbor_supports_upcasting_data_request() {
|
4209 + | #[allow(unused_mut)]
|
4210 + | let mut http_request = ::http_1x::Request::builder()
|
4211 + | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
4212 + | .method("POST")
|
4213 + | .header("Accept", "application/cbor")
|
4214 + | .header("Content-Type", "application/cbor")
|
4215 + | .header("smithy-protocol", "rpc-v2-cbor")
|
4216 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
4217 + | ::bytes::Bytes::copy_from_slice(
|
4218 + | &::aws_smithy_protocol_test::decode_body_data("v2tkb3VibGVWYWx1Zfk+AGpmbG9hdFZhbHVl+UegbGludGVnZXJWYWx1ZRg4aWxvbmdWYWx1ZRkBAGpzaG9ydFZhbHVlCv8=".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
4219 + | )
|
4220 + | ))).unwrap();
|
4221 + | #[allow(unused_mut)]
|
4222 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4223 + | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
4224 + | let service = crate::service::RpcV2Protocol::builder::<
|
4225 + | ::aws_smithy_http_server::body::BoxBody,
|
4226 + | _,
|
4227 + | _,
|
4228 + | _,
|
4229 + | >(config)
|
4230 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
4231 + | let sender = sender.clone();
|
4232 + | async move {
|
4233 + | let result = {
|
4234 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4235 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
4236 + | double_value: ::std::option::Option::Some(1.5_f64),
|
4237 + | float_value: ::std::option::Option::Some(7.625_f32),
|
4238 + | integer_value: ::std::option::Option::Some(56),
|
4239 + | long_value: ::std::option::Option::Some(256),
|
4240 + | short_value: ::std::option::Option::Some(10),
|
4241 + | true_boolean_value: ::std::option::Option::None,
|
4242 + | false_boolean_value: ::std::option::Option::None,
|
4243 + | byte_value: ::std::option::Option::None,
|
4244 + | string_value: ::std::option::Option::None,
|
4245 + | blob_value: ::std::option::Option::None,
|
4246 + | };
|
4247 + | ::pretty_assertions::assert_eq!(
|
4248 + | input.true_boolean_value,
|
4249 + | expected.true_boolean_value,
|
4250 + | "Unexpected value for `true_boolean_value`"
|
4251 + | );
|
4252 + | ::pretty_assertions::assert_eq!(
|
4253 + | input.false_boolean_value,
|
4254 + | expected.false_boolean_value,
|
4255 + | "Unexpected value for `false_boolean_value`"
|
4256 + | );
|
4257 + | ::pretty_assertions::assert_eq!(
|
4258 + | input.byte_value,
|
4259 + | expected.byte_value,
|
4260 + | "Unexpected value for `byte_value`"
|
4261 + | );
|
4262 + | assert!(
|
4263 + | input.double_value.float_equals(&expected.double_value),
|
4264 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
4265 + | expected.double_value,
|
4266 + | input.double_value
|
4267 + | );
|
4268 + | assert!(
|
4269 + | input.float_value.float_equals(&expected.float_value),
|
4270 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
4271 + | expected.float_value,
|
4272 + | input.float_value
|
4273 + | );
|
4274 + | ::pretty_assertions::assert_eq!(
|
4275 + | input.integer_value,
|
4276 + | expected.integer_value,
|
4277 + | "Unexpected value for `integer_value`"
|
4278 + | );
|
4279 + | ::pretty_assertions::assert_eq!(
|
4280 + | input.long_value,
|
4281 + | expected.long_value,
|
4282 + | "Unexpected value for `long_value`"
|
4283 + | );
|
4284 + | ::pretty_assertions::assert_eq!(
|
4285 + | input.short_value,
|
4286 + | expected.short_value,
|
4287 + | "Unexpected value for `short_value`"
|
4288 + | );
|
4289 + | ::pretty_assertions::assert_eq!(
|
4290 + | input.string_value,
|
4291 + | expected.string_value,
|
4292 + | "Unexpected value for `string_value`"
|
4293 + | );
|
4294 + | ::pretty_assertions::assert_eq!(
|
4295 + | input.blob_value,
|
4296 + | expected.blob_value,
|
4297 + | "Unexpected value for `blob_value`"
|
4298 + | );
|
4299 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
4300 + | true_boolean_value: ::std::option::Option::None,
|
4301 + | false_boolean_value: ::std::option::Option::None,
|
4302 + | byte_value: ::std::option::Option::None,
|
4303 + | double_value: ::std::option::Option::None,
|
4304 + | float_value: ::std::option::Option::None,
|
4305 + | integer_value: ::std::option::Option::None,
|
4306 + | long_value: ::std::option::Option::None,
|
4307 + | short_value: ::std::option::Option::None,
|
4308 + | string_value: ::std::option::Option::None,
|
4309 + | blob_value: ::std::option::Option::None,
|
4310 + | };
|
4311 + | output
|
4312 + | };
|
4313 + | sender.send(()).await.expect("receiver dropped early");
|
4314 + | result
|
4315 + | }
|
4316 + | })
|
4317 + | .build_unchecked();
|
4318 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4319 + | .await
|
4320 + | .expect("unable to make an HTTP request");
|
4321 + | assert!(
|
4322 + | receiver.recv().await.is_some(),
|
4323 + | "we expected operation handler to be invoked but it was not entered"
|
4324 + | );
|
4325 + | }
|
4326 + |
|
4327 + | /// The server should skip over additional fields that are not part of the structure. This allows a
|
4328 + | /// client generated against a newer Smithy model to be able to communicate with a server that is
|
4329 + | /// generated against an older Smithy model.
|
4330 + | /// Test ID: RpcV2CborExtraFieldsInTheBodyShouldBeSkippedByServers
|
4331 + | #[::tokio::test]
|
4332 + | #[::tracing_test::traced_test]
|
4333 + | async fn rpc_v2_cbor_extra_fields_in_the_body_should_be_skipped_by_servers_request() {
|
4334 + | #[allow(unused_mut)]
|
4335 + | let mut http_request = ::http_1x::Request::builder()
|
4336 + | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
4337 + | .method("POST")
|
4338 + | .header("Accept", "application/cbor")
|
4339 + | .header("Content-Type", "application/cbor")
|
4340 + | .header("smithy-protocol", "rpc-v2-cbor")
|
4341 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
4342 + | ::bytes::Bytes::copy_from_slice(
|
4343 + | &::aws_smithy_protocol_test::decode_body_data("v2lieXRlVmFsdWUFa2RvdWJsZVZhbHVl+z/+OVgQYk3TcWZhbHNlQm9vbGVhblZhbHVl9GpmbG9hdFZhbHVl+kD0AABrZXh0cmFPYmplY3S/c2luZGVmaW5pdGVMZW5ndGhNYXC/a3dpdGhBbkFycmF5nwECA///cWRlZmluaXRlTGVuZ3RoTWFwo3J3aXRoQURlZmluaXRlQXJyYXmDAQIDeB1hbmRTb21lSW5kZWZpbml0ZUxlbmd0aFN0cmluZ3gfdGhhdCBoYXMsIGJlZW4gY2h1bmtlZCBvbiBjb21tYWxub3JtYWxTdHJpbmdjZm9vanNob3J0VmFsdWUZJw9uc29tZU90aGVyRmllbGR2dGhpcyBzaG91bGQgYmUgc2tpcHBlZP9saW50ZWdlclZhbHVlGQEAaWxvbmdWYWx1ZRkmkWpzaG9ydFZhbHVlGSaqa3N0cmluZ1ZhbHVlZnNpbXBsZXB0cnVlQm9vbGVhblZhbHVl9WlibG9iVmFsdWVDZm9v/w==".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
4344 + | )
|
4345 + | ))).unwrap();
|
4346 + | #[allow(unused_mut)]
|
4347 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4348 + | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
4349 + | let service = crate::service::RpcV2Protocol::builder::<
|
4350 + | ::aws_smithy_http_server::body::BoxBody,
|
4351 + | _,
|
4352 + | _,
|
4353 + | _,
|
4354 + | >(config)
|
4355 + | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
4356 + | let sender = sender.clone();
|
4357 + | async move {
|
4358 + | let result = {
|
4359 + | use ::aws_smithy_protocol_test::FloatEquals;
|
4360 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
4361 + | byte_value: ::std::option::Option::Some(5),
|
4362 + | double_value: ::std::option::Option::Some(1.889_f64),
|
4363 + | false_boolean_value: ::std::option::Option::Some(false),
|
4364 + | float_value: ::std::option::Option::Some(7.625_f32),
|
4365 + | integer_value: ::std::option::Option::Some(256),
|
4366 + | long_value: ::std::option::Option::Some(9873),
|
4367 + | short_value: ::std::option::Option::Some(9898),
|
4368 + | string_value: ::std::option::Option::Some("simple".to_owned()),
|
4369 + | true_boolean_value: ::std::option::Option::Some(true),
|
4370 + | blob_value: ::std::option::Option::Some(::aws_smithy_types::Blob::new(
|
4371 + | "foo",
|
4372 + | )),
|
4373 + | };
|
4374 + | ::pretty_assertions::assert_eq!(
|
4375 + | input.true_boolean_value,
|
4376 + | expected.true_boolean_value,
|
4377 + | "Unexpected value for `true_boolean_value`"
|
4378 + | );
|
4379 + | ::pretty_assertions::assert_eq!(
|
4380 + | input.false_boolean_value,
|
4381 + | expected.false_boolean_value,
|
4382 + | "Unexpected value for `false_boolean_value`"
|
4383 + | );
|
4384 + | ::pretty_assertions::assert_eq!(
|
4385 + | input.byte_value,
|
4386 + | expected.byte_value,
|
4387 + | "Unexpected value for `byte_value`"
|
4388 + | );
|
4389 + | assert!(
|
4390 + | input.double_value.float_equals(&expected.double_value),
|
4391 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
4392 + | expected.double_value,
|
4393 + | input.double_value
|
4394 + | );
|
4395 + | assert!(
|
4396 + | input.float_value.float_equals(&expected.float_value),
|
4397 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
4398 + | expected.float_value,
|
4399 + | input.float_value
|
4400 + | );
|
4401 + | ::pretty_assertions::assert_eq!(
|
4402 + | input.integer_value,
|
4403 + | expected.integer_value,
|
4404 + | "Unexpected value for `integer_value`"
|
4405 + | );
|
4406 + | ::pretty_assertions::assert_eq!(
|
4407 + | input.long_value,
|
4408 + | expected.long_value,
|
4409 + | "Unexpected value for `long_value`"
|
4410 + | );
|
4411 + | ::pretty_assertions::assert_eq!(
|
4412 + | input.short_value,
|
4413 + | expected.short_value,
|
4414 + | "Unexpected value for `short_value`"
|
4415 + | );
|
4416 + | ::pretty_assertions::assert_eq!(
|
4417 + | input.string_value,
|
4418 + | expected.string_value,
|
4419 + | "Unexpected value for `string_value`"
|
4420 + | );
|
4421 + | ::pretty_assertions::assert_eq!(
|
4422 + | input.blob_value,
|
4423 + | expected.blob_value,
|
4424 + | "Unexpected value for `blob_value`"
|
4425 + | );
|
4426 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
4427 + | true_boolean_value: ::std::option::Option::None,
|
4428 + | false_boolean_value: ::std::option::Option::None,
|
4429 + | byte_value: ::std::option::Option::None,
|
4430 + | double_value: ::std::option::Option::None,
|
4431 + | float_value: ::std::option::Option::None,
|
4432 + | integer_value: ::std::option::Option::None,
|
4433 + | long_value: ::std::option::Option::None,
|
4434 + | short_value: ::std::option::Option::None,
|
4435 + | string_value: ::std::option::Option::None,
|
4436 + | blob_value: ::std::option::Option::None,
|
4437 + | };
|
4438 + | output
|
4439 + | };
|
4440 + | sender.send(()).await.expect("receiver dropped early");
|
4441 + | result
|
4442 + | }
|
4443 + | })
|
4444 + | .build_unchecked();
|
4445 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4446 + | .await
|
4447 + | .expect("unable to make an HTTP request");
|
4448 + | assert!(
|
4449 + | receiver.recv().await.is_some(),
|
4450 + | "we expected operation handler to be invoked but it was not entered"
|
4451 + | );
|
4452 + | }
|
4453 + |
|
4454 + | /// Servers should tolerate requests without an Accept header set.
|
4455 + | /// Test ID: RpcV2CborServersShouldHandleNoAcceptHeader
|
4456 + | #[::tokio::test]
|
4457 + | #[::tracing_test::traced_test]
|
4458 + | async fn rpc_v2_cbor_servers_should_handle_no_accept_header_request() {
|
4459 + | #[allow(unused_mut)]
|
4460 + | let mut http_request = ::http_1x::Request::builder()
|
4461 + | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
4462 + | .method("POST")
|
4463 + | .header("Content-Type", "application/cbor")
|
4464 + | .header("smithy-protocol", "rpc-v2-cbor")
|
4465 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
4466 + | ::bytes::Bytes::copy_from_slice(
|
4467 + | &::aws_smithy_protocol_test::decode_body_data("v2lieXRlVmFsdWUFa2RvdWJsZVZhbHVl+z/+OVgQYk3TcWZhbHNlQm9vbGVhblZhbHVl9GpmbG9hdFZhbHVl+kD0AABsaW50ZWdlclZhbHVlGQEAaWxvbmdWYWx1ZRkmkWpzaG9ydFZhbHVlGSaqa3N0cmluZ1ZhbHVlZnNpbXBsZXB0cnVlQm9vbGVhblZhbHVl9WlibG9iVmFsdWVDZm9v/w==".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
4468 + | )
|
4469 + | ))).unwrap();
|
4470 + | #[allow(unused_mut)]
|
4471 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4472 + | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
4473 + | let service = crate::service::RpcV2Protocol::builder::<
|
4474 + | ::aws_smithy_http_server::body::BoxBody,
|
4475 + | _,
|
4476 + | _,
|
4477 + | _,
|
4478 + | >(config)
|
3674 4479 | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3675 4480 | let sender = sender.clone();
|
3676 4481 | async move {
|
3677 4482 | let result = {
|
3678 4483 | use ::aws_smithy_protocol_test::FloatEquals;
|
3679 4484 | let expected = crate::input::SimpleScalarPropertiesInput {
|
3680 - | double_value: ::std::option::Option::Some(
|
3681 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3682 - | "-Infinity",
|
3683 - | )
|
3684 - | .expect("invalid string for number"),
|
3685 - | ),
|
3686 - | float_value: ::std::option::Option::Some(
|
3687 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3688 - | "-Infinity",
|
3689 - | )
|
3690 - | .expect("invalid string for number"),
|
3691 - | ),
|
3692 - | true_boolean_value: ::std::option::Option::None,
|
3693 - | false_boolean_value: ::std::option::Option::None,
|
3694 - | byte_value: ::std::option::Option::None,
|
3695 - | integer_value: ::std::option::Option::None,
|
3696 - | long_value: ::std::option::Option::None,
|
3697 - | short_value: ::std::option::Option::None,
|
3698 - | string_value: ::std::option::Option::None,
|
3699 - | blob_value: ::std::option::Option::None,
|
4485 + | byte_value: ::std::option::Option::Some(5),
|
4486 + | double_value: ::std::option::Option::Some(1.889_f64),
|
4487 + | false_boolean_value: ::std::option::Option::Some(false),
|
4488 + | float_value: ::std::option::Option::Some(7.625_f32),
|
4489 + | integer_value: ::std::option::Option::Some(256),
|
4490 + | long_value: ::std::option::Option::Some(9873),
|
4491 + | short_value: ::std::option::Option::Some(9898),
|
4492 + | string_value: ::std::option::Option::Some("simple".to_owned()),
|
4493 + | true_boolean_value: ::std::option::Option::Some(true),
|
4494 + | blob_value: ::std::option::Option::Some(::aws_smithy_types::Blob::new(
|
4495 + | "foo",
|
4496 + | )),
|
3700 4497 | };
|
3701 4498 | ::pretty_assertions::assert_eq!(
|
3702 4499 | input.true_boolean_value,
|
3703 4500 | expected.true_boolean_value,
|
3704 4501 | "Unexpected value for `true_boolean_value`"
|
3705 4502 | );
|
3706 4503 | ::pretty_assertions::assert_eq!(
|
3707 4504 | input.false_boolean_value,
|
3708 4505 | expected.false_boolean_value,
|
3709 4506 | "Unexpected value for `false_boolean_value`"
|
3771 4568 | .build_unchecked();
|
3772 4569 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3773 4570 | .await
|
3774 4571 | .expect("unable to make an HTTP request");
|
3775 4572 | assert!(
|
3776 4573 | receiver.recv().await.is_some(),
|
3777 4574 | "we expected operation handler to be invoked but it was not entered"
|
3778 4575 | );
|
3779 4576 | }
|
3780 4577 |
|
3781 - | /// The server should be capable of deserializing indefinite length text strings.
|
3782 - | /// Test ID: RpcV2CborIndefiniteLengthStringsCanBeDeserialized
|
3783 - | #[::tokio::test]
|
3784 - | #[::tracing_test::traced_test]
|
3785 - | async fn rpc_v2_cbor_indefinite_length_strings_can_be_deserialized_request() {
|
3786 - | #[allow(unused_mut)]
|
3787 - | let mut http_request = http::Request::builder()
|
3788 - | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
3789 - | .method("POST")
|
3790 - | .header("Accept", "application/cbor")
|
3791 - | .header("Content-Type", "application/cbor")
|
3792 - | .header("smithy-protocol", "rpc-v2-cbor")
|
3793 - | .body(::aws_smithy_http_server::body::Body::from(
|
3794 - | ::bytes::Bytes::copy_from_slice(
|
3795 - | &::aws_smithy_protocol_test::decode_body_data("oWtzdHJpbmdWYWx1ZX94HUFuIGV4YW1wbGUgaW5kZWZpbml0ZSBzdHJpbmcscSBjaHVua2VkIG9uIGNvbW1h/w==".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
3796 - | )
|
3797 - | )).unwrap();
|
3798 - | #[allow(unused_mut)]
|
3799 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3800 - | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
3801 - | let service =
|
3802 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3803 - | .simple_scalar_properties(
|
3804 - | move |input: crate::input::SimpleScalarPropertiesInput| {
|
3805 - | let sender = sender.clone();
|
3806 - | async move {
|
3807 - | let result = {
|
3808 - | use ::aws_smithy_protocol_test::FloatEquals;
|
3809 - | let expected = crate::input::SimpleScalarPropertiesInput {
|
3810 - | string_value: ::std::option::Option::Some(
|
3811 - | "An example indefinite string, chunked on comma".to_owned(),
|
3812 - | ),
|
3813 - | true_boolean_value: ::std::option::Option::None,
|
3814 - | false_boolean_value: ::std::option::Option::None,
|
3815 - | byte_value: ::std::option::Option::None,
|
3816 - | double_value: ::std::option::Option::None,
|
3817 - | float_value: ::std::option::Option::None,
|
3818 - | integer_value: ::std::option::Option::None,
|
3819 - | long_value: ::std::option::Option::None,
|
3820 - | short_value: ::std::option::Option::None,
|
3821 - | blob_value: ::std::option::Option::None,
|
3822 - | };
|
3823 - | ::pretty_assertions::assert_eq!(
|
3824 - | input.true_boolean_value,
|
3825 - | expected.true_boolean_value,
|
3826 - | "Unexpected value for `true_boolean_value`"
|
3827 - | );
|
3828 - | ::pretty_assertions::assert_eq!(
|
3829 - | input.false_boolean_value,
|
3830 - | expected.false_boolean_value,
|
3831 - | "Unexpected value for `false_boolean_value`"
|
3832 - | );
|
3833 - | ::pretty_assertions::assert_eq!(
|
3834 - | input.byte_value,
|
3835 - | expected.byte_value,
|
3836 - | "Unexpected value for `byte_value`"
|
3837 - | );
|
3838 - | assert!(
|
3839 - | input.double_value.float_equals(&expected.double_value),
|
3840 - | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3841 - | expected.double_value,
|
3842 - | input.double_value
|
3843 - | );
|
3844 - | assert!(
|
3845 - | input.float_value.float_equals(&expected.float_value),
|
3846 - | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3847 - | expected.float_value,
|
3848 - | input.float_value
|
3849 - | );
|
3850 - | ::pretty_assertions::assert_eq!(
|
3851 - | input.integer_value,
|
3852 - | expected.integer_value,
|
3853 - | "Unexpected value for `integer_value`"
|
3854 - | );
|
3855 - | ::pretty_assertions::assert_eq!(
|
3856 - | input.long_value,
|
3857 - | expected.long_value,
|
3858 - | "Unexpected value for `long_value`"
|
3859 - | );
|
3860 - | ::pretty_assertions::assert_eq!(
|
3861 - | input.short_value,
|
3862 - | expected.short_value,
|
3863 - | "Unexpected value for `short_value`"
|
3864 - | );
|
3865 - | ::pretty_assertions::assert_eq!(
|
3866 - | input.string_value,
|
3867 - | expected.string_value,
|
3868 - | "Unexpected value for `string_value`"
|
3869 - | );
|
3870 - | ::pretty_assertions::assert_eq!(
|
3871 - | input.blob_value,
|
3872 - | expected.blob_value,
|
3873 - | "Unexpected value for `blob_value`"
|
3874 - | );
|
3875 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
3876 - | true_boolean_value: ::std::option::Option::None,
|
3877 - | false_boolean_value: ::std::option::Option::None,
|
3878 - | byte_value: ::std::option::Option::None,
|
3879 - | double_value: ::std::option::Option::None,
|
3880 - | float_value: ::std::option::Option::None,
|
3881 - | integer_value: ::std::option::Option::None,
|
3882 - | long_value: ::std::option::Option::None,
|
3883 - | short_value: ::std::option::Option::None,
|
3884 - | string_value: ::std::option::Option::None,
|
3885 - | blob_value: ::std::option::Option::None,
|
3886 - | };
|
3887 - | output
|
3888 - | };
|
3889 - | sender.send(()).await.expect("receiver dropped early");
|
3890 - | result
|
3891 - | }
|
3892 - | },
|
3893 - | )
|
3894 - | .build_unchecked();
|
3895 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3896 - | .await
|
3897 - | .expect("unable to make an HTTP request");
|
3898 - | assert!(
|
3899 - | receiver.recv().await.is_some(),
|
3900 - | "we expected operation handler to be invoked but it was not entered"
|
3901 - | );
|
3902 - | }
|
3903 - |
|
3904 - | /// The server should be capable of deserializing indefinite length byte strings.
|
3905 - | /// Test ID: RpcV2CborIndefiniteLengthByteStringsCanBeDeserialized
|
3906 - | #[::tokio::test]
|
3907 - | #[::tracing_test::traced_test]
|
3908 - | async fn rpc_v2_cbor_indefinite_length_byte_strings_can_be_deserialized_request() {
|
3909 - | #[allow(unused_mut)]
|
3910 - | let mut http_request = http::Request::builder()
|
3911 - | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
3912 - | .method("POST")
|
3913 - | .header("Accept", "application/cbor")
|
3914 - | .header("Content-Type", "application/cbor")
|
3915 - | .header("smithy-protocol", "rpc-v2-cbor")
|
3916 - | .body(::aws_smithy_http_server::body::Body::from(
|
3917 - | ::bytes::Bytes::copy_from_slice(
|
3918 - | &::aws_smithy_protocol_test::decode_body_data("oWlibG9iVmFsdWVfWCJBbiBleGFtcGxlIGluZGVmaW5pdGUtYnl0ZSBzdHJpbmcsUSBjaHVua2VkIG9uIGNvbW1h/w==".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
3919 - | )
|
3920 - | )).unwrap();
|
3921 - | #[allow(unused_mut)]
|
3922 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3923 - | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
3924 - | let service =
|
3925 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3926 - | .simple_scalar_properties(
|
3927 - | move |input: crate::input::SimpleScalarPropertiesInput| {
|
3928 - | let sender = sender.clone();
|
3929 - | async move {
|
3930 - | let result = {
|
3931 - | use ::aws_smithy_protocol_test::FloatEquals;
|
3932 - | let expected = crate::input::SimpleScalarPropertiesInput {
|
3933 - | blob_value: ::std::option::Option::Some(
|
3934 - | ::aws_smithy_types::Blob::new(
|
3935 - | "An example indefinite-byte string, chunked on comma",
|
3936 - | ),
|
3937 - | ),
|
3938 - | true_boolean_value: ::std::option::Option::None,
|
3939 - | false_boolean_value: ::std::option::Option::None,
|
3940 - | byte_value: ::std::option::Option::None,
|
3941 - | double_value: ::std::option::Option::None,
|
3942 - | float_value: ::std::option::Option::None,
|
3943 - | integer_value: ::std::option::Option::None,
|
3944 - | long_value: ::std::option::Option::None,
|
3945 - | short_value: ::std::option::Option::None,
|
3946 - | string_value: ::std::option::Option::None,
|
3947 - | };
|
3948 - | ::pretty_assertions::assert_eq!(
|
3949 - | input.true_boolean_value,
|
3950 - | expected.true_boolean_value,
|
3951 - | "Unexpected value for `true_boolean_value`"
|
3952 - | );
|
3953 - | ::pretty_assertions::assert_eq!(
|
3954 - | input.false_boolean_value,
|
3955 - | expected.false_boolean_value,
|
3956 - | "Unexpected value for `false_boolean_value`"
|
3957 - | );
|
3958 - | ::pretty_assertions::assert_eq!(
|
3959 - | input.byte_value,
|
3960 - | expected.byte_value,
|
3961 - | "Unexpected value for `byte_value`"
|
3962 - | );
|
3963 - | assert!(
|
3964 - | input.double_value.float_equals(&expected.double_value),
|
3965 - | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3966 - | expected.double_value,
|
3967 - | input.double_value
|
3968 - | );
|
3969 - | assert!(
|
3970 - | input.float_value.float_equals(&expected.float_value),
|
3971 - | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3972 - | expected.float_value,
|
3973 - | input.float_value
|
3974 - | );
|
3975 - | ::pretty_assertions::assert_eq!(
|
3976 - | input.integer_value,
|
3977 - | expected.integer_value,
|
3978 - | "Unexpected value for `integer_value`"
|
3979 - | );
|
3980 - | ::pretty_assertions::assert_eq!(
|
3981 - | input.long_value,
|
3982 - | expected.long_value,
|
3983 - | "Unexpected value for `long_value`"
|
3984 - | );
|
3985 - | ::pretty_assertions::assert_eq!(
|
3986 - | input.short_value,
|
3987 - | expected.short_value,
|
3988 - | "Unexpected value for `short_value`"
|
3989 - | );
|
3990 - | ::pretty_assertions::assert_eq!(
|
3991 - | input.string_value,
|
3992 - | expected.string_value,
|
3993 - | "Unexpected value for `string_value`"
|
3994 - | );
|
3995 - | ::pretty_assertions::assert_eq!(
|
3996 - | input.blob_value,
|
3997 - | expected.blob_value,
|
3998 - | "Unexpected value for `blob_value`"
|
3999 - | );
|
4000 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
4001 - | true_boolean_value: ::std::option::Option::None,
|
4002 - | false_boolean_value: ::std::option::Option::None,
|
4003 - | byte_value: ::std::option::Option::None,
|
4004 - | double_value: ::std::option::Option::None,
|
4005 - | float_value: ::std::option::Option::None,
|
4006 - | integer_value: ::std::option::Option::None,
|
4007 - | long_value: ::std::option::Option::None,
|
4008 - | short_value: ::std::option::Option::None,
|
4009 - | string_value: ::std::option::Option::None,
|
4010 - | blob_value: ::std::option::Option::None,
|
4011 - | };
|
4012 - | output
|
4013 - | };
|
4014 - | sender.send(()).await.expect("receiver dropped early");
|
4015 - | result
|
4016 - | }
|
4017 - | },
|
4018 - | )
|
4019 - | .build_unchecked();
|
4020 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4021 - | .await
|
4022 - | .expect("unable to make an HTTP request");
|
4023 - | assert!(
|
4024 - | receiver.recv().await.is_some(),
|
4025 - | "we expected operation handler to be invoked but it was not entered"
|
4026 - | );
|
4027 - | }
|
4028 - |
|
4029 - | /// Supports upcasting from a smaller byte representation of the same data type.
|
4030 - | /// Test ID: RpcV2CborSupportsUpcastingData
|
4031 - | #[::tokio::test]
|
4032 - | #[::tracing_test::traced_test]
|
4033 - | async fn rpc_v2_cbor_supports_upcasting_data_request() {
|
4034 - | #[allow(unused_mut)]
|
4035 - | let mut http_request = http::Request::builder()
|
4036 - | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
4037 - | .method("POST")
|
4038 - | .header("Accept", "application/cbor")
|
4039 - | .header("Content-Type", "application/cbor")
|
4040 - | .header("smithy-protocol", "rpc-v2-cbor")
|
4041 - | .body(::aws_smithy_http_server::body::Body::from(
|
4042 - | ::bytes::Bytes::copy_from_slice(
|
4043 - | &::aws_smithy_protocol_test::decode_body_data("v2tkb3VibGVWYWx1Zfk+AGpmbG9hdFZhbHVl+UegbGludGVnZXJWYWx1ZRg4aWxvbmdWYWx1ZRkBAGpzaG9ydFZhbHVlCv8=".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
4044 - | )
|
4045 - | )).unwrap();
|
4046 - | #[allow(unused_mut)]
|
4047 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4048 - | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
4049 - | let service =
|
4050 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4051 - | .simple_scalar_properties(
|
4052 - | move |input: crate::input::SimpleScalarPropertiesInput| {
|
4053 - | let sender = sender.clone();
|
4054 - | async move {
|
4055 - | let result = {
|
4056 - | use ::aws_smithy_protocol_test::FloatEquals;
|
4057 - | let expected = crate::input::SimpleScalarPropertiesInput {
|
4058 - | double_value: ::std::option::Option::Some(1.5_f64),
|
4059 - | float_value: ::std::option::Option::Some(7.625_f32),
|
4060 - | integer_value: ::std::option::Option::Some(56),
|
4061 - | long_value: ::std::option::Option::Some(256),
|
4062 - | short_value: ::std::option::Option::Some(10),
|
4063 - | true_boolean_value: ::std::option::Option::None,
|
4064 - | false_boolean_value: ::std::option::Option::None,
|
4065 - | byte_value: ::std::option::Option::None,
|
4066 - | string_value: ::std::option::Option::None,
|
4067 - | blob_value: ::std::option::Option::None,
|
4068 - | };
|
4069 - | ::pretty_assertions::assert_eq!(
|
4070 - | input.true_boolean_value,
|
4071 - | expected.true_boolean_value,
|
4072 - | "Unexpected value for `true_boolean_value`"
|
4073 - | );
|
4074 - | ::pretty_assertions::assert_eq!(
|
4075 - | input.false_boolean_value,
|
4076 - | expected.false_boolean_value,
|
4077 - | "Unexpected value for `false_boolean_value`"
|
4078 - | );
|
4079 - | ::pretty_assertions::assert_eq!(
|
4080 - | input.byte_value,
|
4081 - | expected.byte_value,
|
4082 - | "Unexpected value for `byte_value`"
|
4083 - | );
|
4084 - | assert!(
|
4085 - | input.double_value.float_equals(&expected.double_value),
|
4086 - | "Unexpected value for `double_value` {:?} vs. {:?}",
|
4087 - | expected.double_value,
|
4088 - | input.double_value
|
4089 - | );
|
4090 - | assert!(
|
4091 - | input.float_value.float_equals(&expected.float_value),
|
4092 - | "Unexpected value for `float_value` {:?} vs. {:?}",
|
4093 - | expected.float_value,
|
4094 - | input.float_value
|
4095 - | );
|
4096 - | ::pretty_assertions::assert_eq!(
|
4097 - | input.integer_value,
|
4098 - | expected.integer_value,
|
4099 - | "Unexpected value for `integer_value`"
|
4100 - | );
|
4101 - | ::pretty_assertions::assert_eq!(
|
4102 - | input.long_value,
|
4103 - | expected.long_value,
|
4104 - | "Unexpected value for `long_value`"
|
4105 - | );
|
4106 - | ::pretty_assertions::assert_eq!(
|
4107 - | input.short_value,
|
4108 - | expected.short_value,
|
4109 - | "Unexpected value for `short_value`"
|
4110 - | );
|
4111 - | ::pretty_assertions::assert_eq!(
|
4112 - | input.string_value,
|
4113 - | expected.string_value,
|
4114 - | "Unexpected value for `string_value`"
|
4115 - | );
|
4116 - | ::pretty_assertions::assert_eq!(
|
4117 - | input.blob_value,
|
4118 - | expected.blob_value,
|
4119 - | "Unexpected value for `blob_value`"
|
4120 - | );
|
4121 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
4122 - | true_boolean_value: ::std::option::Option::None,
|
4123 - | false_boolean_value: ::std::option::Option::None,
|
4124 - | byte_value: ::std::option::Option::None,
|
4125 - | double_value: ::std::option::Option::None,
|
4126 - | float_value: ::std::option::Option::None,
|
4127 - | integer_value: ::std::option::Option::None,
|
4128 - | long_value: ::std::option::Option::None,
|
4129 - | short_value: ::std::option::Option::None,
|
4130 - | string_value: ::std::option::Option::None,
|
4131 - | blob_value: ::std::option::Option::None,
|
4132 - | };
|
4133 - | output
|
4134 - | };
|
4135 - | sender.send(()).await.expect("receiver dropped early");
|
4136 - | result
|
4137 - | }
|
4138 - | },
|
4139 - | )
|
4140 - | .build_unchecked();
|
4141 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4142 - | .await
|
4143 - | .expect("unable to make an HTTP request");
|
4144 - | assert!(
|
4145 - | receiver.recv().await.is_some(),
|
4146 - | "we expected operation handler to be invoked but it was not entered"
|
4147 - | );
|
4148 - | }
|
4149 - |
|
4150 - | /// The server should skip over additional fields that are not part of the structure. This allows a
|
4151 - | /// client generated against a newer Smithy model to be able to communicate with a server that is
|
4152 - | /// generated against an older Smithy model.
|
4153 - | /// Test ID: RpcV2CborExtraFieldsInTheBodyShouldBeSkippedByServers
|
4154 - | #[::tokio::test]
|
4155 - | #[::tracing_test::traced_test]
|
4156 - | async fn rpc_v2_cbor_extra_fields_in_the_body_should_be_skipped_by_servers_request() {
|
4157 - | #[allow(unused_mut)]
|
4158 - | let mut http_request = http::Request::builder()
|
4159 - | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
4160 - | .method("POST")
|
4161 - | .header("Accept", "application/cbor")
|
4162 - | .header("Content-Type", "application/cbor")
|
4163 - | .header("smithy-protocol", "rpc-v2-cbor")
|
4164 - | .body(::aws_smithy_http_server::body::Body::from(
|
4165 - | ::bytes::Bytes::copy_from_slice(
|
4166 - | &::aws_smithy_protocol_test::decode_body_data("v2lieXRlVmFsdWUFa2RvdWJsZVZhbHVl+z/+OVgQYk3TcWZhbHNlQm9vbGVhblZhbHVl9GpmbG9hdFZhbHVl+kD0AABrZXh0cmFPYmplY3S/c2luZGVmaW5pdGVMZW5ndGhNYXC/a3dpdGhBbkFycmF5nwECA///cWRlZmluaXRlTGVuZ3RoTWFwo3J3aXRoQURlZmluaXRlQXJyYXmDAQIDeB1hbmRTb21lSW5kZWZpbml0ZUxlbmd0aFN0cmluZ3gfdGhhdCBoYXMsIGJlZW4gY2h1bmtlZCBvbiBjb21tYWxub3JtYWxTdHJpbmdjZm9vanNob3J0VmFsdWUZJw9uc29tZU90aGVyRmllbGR2dGhpcyBzaG91bGQgYmUgc2tpcHBlZP9saW50ZWdlclZhbHVlGQEAaWxvbmdWYWx1ZRkmkWpzaG9ydFZhbHVlGSaqa3N0cmluZ1ZhbHVlZnNpbXBsZXB0cnVlQm9vbGVhblZhbHVl9WlibG9iVmFsdWVDZm9v/w==".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
4167 - | )
|
4168 - | )).unwrap();
|
4169 - | #[allow(unused_mut)]
|
4170 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4171 - | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
4172 - | let service =
|
4173 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4174 - | .simple_scalar_properties(
|
4175 - | move |input: crate::input::SimpleScalarPropertiesInput| {
|
4176 - | let sender = sender.clone();
|
4177 - | async move {
|
4178 - | let result = {
|
4179 - | use ::aws_smithy_protocol_test::FloatEquals;
|
4180 - | let expected = crate::input::SimpleScalarPropertiesInput {
|
4181 - | byte_value: ::std::option::Option::Some(5),
|
4182 - | double_value: ::std::option::Option::Some(1.889_f64),
|
4183 - | false_boolean_value: ::std::option::Option::Some(false),
|
4184 - | float_value: ::std::option::Option::Some(7.625_f32),
|
4185 - | integer_value: ::std::option::Option::Some(256),
|
4186 - | long_value: ::std::option::Option::Some(9873),
|
4187 - | short_value: ::std::option::Option::Some(9898),
|
4188 - | string_value: ::std::option::Option::Some("simple".to_owned()),
|
4189 - | true_boolean_value: ::std::option::Option::Some(true),
|
4190 - | blob_value: ::std::option::Option::Some(
|
4191 - | ::aws_smithy_types::Blob::new("foo"),
|
4192 - | ),
|
4193 - | };
|
4194 - | ::pretty_assertions::assert_eq!(
|
4195 - | input.true_boolean_value,
|
4196 - | expected.true_boolean_value,
|
4197 - | "Unexpected value for `true_boolean_value`"
|
4198 - | );
|
4199 - | ::pretty_assertions::assert_eq!(
|
4200 - | input.false_boolean_value,
|
4201 - | expected.false_boolean_value,
|
4202 - | "Unexpected value for `false_boolean_value`"
|
4203 - | );
|
4204 - | ::pretty_assertions::assert_eq!(
|
4205 - | input.byte_value,
|
4206 - | expected.byte_value,
|
4207 - | "Unexpected value for `byte_value`"
|
4208 - | );
|
4209 - | assert!(
|
4210 - | input.double_value.float_equals(&expected.double_value),
|
4211 - | "Unexpected value for `double_value` {:?} vs. {:?}",
|
4212 - | expected.double_value,
|
4213 - | input.double_value
|
4214 - | );
|
4215 - | assert!(
|
4216 - | input.float_value.float_equals(&expected.float_value),
|
4217 - | "Unexpected value for `float_value` {:?} vs. {:?}",
|
4218 - | expected.float_value,
|
4219 - | input.float_value
|
4220 - | );
|
4221 - | ::pretty_assertions::assert_eq!(
|
4222 - | input.integer_value,
|
4223 - | expected.integer_value,
|
4224 - | "Unexpected value for `integer_value`"
|
4225 - | );
|
4226 - | ::pretty_assertions::assert_eq!(
|
4227 - | input.long_value,
|
4228 - | expected.long_value,
|
4229 - | "Unexpected value for `long_value`"
|
4230 - | );
|
4231 - | ::pretty_assertions::assert_eq!(
|
4232 - | input.short_value,
|
4233 - | expected.short_value,
|
4234 - | "Unexpected value for `short_value`"
|
4235 - | );
|
4236 - | ::pretty_assertions::assert_eq!(
|
4237 - | input.string_value,
|
4238 - | expected.string_value,
|
4239 - | "Unexpected value for `string_value`"
|
4240 - | );
|
4241 - | ::pretty_assertions::assert_eq!(
|
4242 - | input.blob_value,
|
4243 - | expected.blob_value,
|
4244 - | "Unexpected value for `blob_value`"
|
4245 - | );
|
4246 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
4247 - | true_boolean_value: ::std::option::Option::None,
|
4248 - | false_boolean_value: ::std::option::Option::None,
|
4249 - | byte_value: ::std::option::Option::None,
|
4250 - | double_value: ::std::option::Option::None,
|
4251 - | float_value: ::std::option::Option::None,
|
4252 - | integer_value: ::std::option::Option::None,
|
4253 - | long_value: ::std::option::Option::None,
|
4254 - | short_value: ::std::option::Option::None,
|
4255 - | string_value: ::std::option::Option::None,
|
4256 - | blob_value: ::std::option::Option::None,
|
4257 - | };
|
4258 - | output
|
4259 - | };
|
4260 - | sender.send(()).await.expect("receiver dropped early");
|
4261 - | result
|
4262 - | }
|
4263 - | },
|
4264 - | )
|
4265 - | .build_unchecked();
|
4266 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4267 - | .await
|
4268 - | .expect("unable to make an HTTP request");
|
4269 - | assert!(
|
4270 - | receiver.recv().await.is_some(),
|
4271 - | "we expected operation handler to be invoked but it was not entered"
|
4272 - | );
|
4273 - | }
|
4274 - |
|
4275 - | /// Servers should tolerate requests without an Accept header set.
|
4276 - | /// Test ID: RpcV2CborServersShouldHandleNoAcceptHeader
|
4277 - | #[::tokio::test]
|
4278 - | #[::tracing_test::traced_test]
|
4279 - | async fn rpc_v2_cbor_servers_should_handle_no_accept_header_request() {
|
4280 - | #[allow(unused_mut)]
|
4281 - | let mut http_request = http::Request::builder()
|
4282 - | .uri("/service/RpcV2Protocol/operation/SimpleScalarProperties")
|
4283 - | .method("POST")
|
4284 - | .header("Content-Type", "application/cbor")
|
4285 - | .header("smithy-protocol", "rpc-v2-cbor")
|
4286 - | .body(::aws_smithy_http_server::body::Body::from(
|
4287 - | ::bytes::Bytes::copy_from_slice(
|
4288 - | &::aws_smithy_protocol_test::decode_body_data("v2lieXRlVmFsdWUFa2RvdWJsZVZhbHVl+z/+OVgQYk3TcWZhbHNlQm9vbGVhblZhbHVl9GpmbG9hdFZhbHVl+kD0AABsaW50ZWdlclZhbHVlGQEAaWxvbmdWYWx1ZRkmkWpzaG9ydFZhbHVlGSaqa3N0cmluZ1ZhbHVlZnNpbXBsZXB0cnVlQm9vbGVhblZhbHVl9WlibG9iVmFsdWVDZm9v/w==".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
4289 - | )
|
4290 - | )).unwrap();
|
4291 - | #[allow(unused_mut)]
|
4292 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4293 - | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
4294 - | let service =
|
4295 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4296 - | .simple_scalar_properties(
|
4297 - | move |input: crate::input::SimpleScalarPropertiesInput| {
|
4298 - | let sender = sender.clone();
|
4299 - | async move {
|
4300 - | let result = {
|
4301 - | use ::aws_smithy_protocol_test::FloatEquals;
|
4302 - | let expected = crate::input::SimpleScalarPropertiesInput {
|
4303 - | byte_value: ::std::option::Option::Some(5),
|
4304 - | double_value: ::std::option::Option::Some(1.889_f64),
|
4305 - | false_boolean_value: ::std::option::Option::Some(false),
|
4306 - | float_value: ::std::option::Option::Some(7.625_f32),
|
4307 - | integer_value: ::std::option::Option::Some(256),
|
4308 - | long_value: ::std::option::Option::Some(9873),
|
4309 - | short_value: ::std::option::Option::Some(9898),
|
4310 - | string_value: ::std::option::Option::Some("simple".to_owned()),
|
4311 - | true_boolean_value: ::std::option::Option::Some(true),
|
4312 - | blob_value: ::std::option::Option::Some(
|
4313 - | ::aws_smithy_types::Blob::new("foo"),
|
4314 - | ),
|
4315 - | };
|
4316 - | ::pretty_assertions::assert_eq!(
|
4317 - | input.true_boolean_value,
|
4318 - | expected.true_boolean_value,
|
4319 - | "Unexpected value for `true_boolean_value`"
|
4320 - | );
|
4321 - | ::pretty_assertions::assert_eq!(
|
4322 - | input.false_boolean_value,
|
4323 - | expected.false_boolean_value,
|
4324 - | "Unexpected value for `false_boolean_value`"
|
4325 - | );
|
4326 - | ::pretty_assertions::assert_eq!(
|
4327 - | input.byte_value,
|
4328 - | expected.byte_value,
|
4329 - | "Unexpected value for `byte_value`"
|
4330 - | );
|
4331 - | assert!(
|
4332 - | input.double_value.float_equals(&expected.double_value),
|
4333 - | "Unexpected value for `double_value` {:?} vs. {:?}",
|
4334 - | expected.double_value,
|
4335 - | input.double_value
|
4336 - | );
|
4337 - | assert!(
|
4338 - | input.float_value.float_equals(&expected.float_value),
|
4339 - | "Unexpected value for `float_value` {:?} vs. {:?}",
|
4340 - | expected.float_value,
|
4341 - | input.float_value
|
4342 - | );
|
4343 - | ::pretty_assertions::assert_eq!(
|
4344 - | input.integer_value,
|
4345 - | expected.integer_value,
|
4346 - | "Unexpected value for `integer_value`"
|
4347 - | );
|
4348 - | ::pretty_assertions::assert_eq!(
|
4349 - | input.long_value,
|
4350 - | expected.long_value,
|
4351 - | "Unexpected value for `long_value`"
|
4352 - | );
|
4353 - | ::pretty_assertions::assert_eq!(
|
4354 - | input.short_value,
|
4355 - | expected.short_value,
|
4356 - | "Unexpected value for `short_value`"
|
4357 - | );
|
4358 - | ::pretty_assertions::assert_eq!(
|
4359 - | input.string_value,
|
4360 - | expected.string_value,
|
4361 - | "Unexpected value for `string_value`"
|
4362 - | );
|
4363 - | ::pretty_assertions::assert_eq!(
|
4364 - | input.blob_value,
|
4365 - | expected.blob_value,
|
4366 - | "Unexpected value for `blob_value`"
|
4367 - | );
|
4368 - | let output = crate::output::SimpleScalarPropertiesOutput {
|
4369 - | true_boolean_value: ::std::option::Option::None,
|
4370 - | false_boolean_value: ::std::option::Option::None,
|
4371 - | byte_value: ::std::option::Option::None,
|
4372 - | double_value: ::std::option::Option::None,
|
4373 - | float_value: ::std::option::Option::None,
|
4374 - | integer_value: ::std::option::Option::None,
|
4375 - | long_value: ::std::option::Option::None,
|
4376 - | short_value: ::std::option::Option::None,
|
4377 - | string_value: ::std::option::Option::None,
|
4378 - | blob_value: ::std::option::Option::None,
|
4379 - | };
|
4380 - | output
|
4381 - | };
|
4382 - | sender.send(()).await.expect("receiver dropped early");
|
4383 - | result
|
4384 - | }
|
4385 - | },
|
4386 - | )
|
4387 - | .build_unchecked();
|
4388 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4389 - | .await
|
4390 - | .expect("unable to make an HTTP request");
|
4391 - | assert!(
|
4392 - | receiver.recv().await.is_some(),
|
4393 - | "we expected operation handler to be invoked but it was not entered"
|
4394 - | );
|
4395 - | }
|
4396 - |
|
4397 4578 | /// Serializes simple scalar properties
|
4398 4579 | /// Test ID: RpcV2CborSimpleScalarProperties
|
4399 4580 | #[::tokio::test]
|
4400 4581 | #[::tracing_test::traced_test]
|
4401 4582 | async fn rpc_v2_cbor_simple_scalar_properties_response() {
|
4402 4583 | let output = crate::output::SimpleScalarPropertiesOutput {
|
4403 4584 | true_boolean_value: ::std::option::Option::Some(true),
|
4404 4585 | false_boolean_value: ::std::option::Option::Some(false),
|
4405 4586 | byte_value: ::std::option::Option::Some(5),
|
4406 4587 | double_value: ::std::option::Option::Some(1.889_f64),
|
4407 4588 | float_value: ::std::option::Option::Some(7.625_f32),
|
4408 4589 | integer_value: ::std::option::Option::Some(256),
|
4409 4590 | short_value: ::std::option::Option::Some(9898),
|
4410 4591 | string_value: ::std::option::Option::Some("simple".to_owned()),
|
4411 4592 | blob_value: ::std::option::Option::Some(::aws_smithy_types::Blob::new("foo")),
|
4412 4593 | long_value: ::std::option::Option::None,
|
4413 4594 | };
|
4414 4595 | use ::aws_smithy_http_server::response::IntoResponse;
|
4415 4596 | let http_response = output.into_response();
|
4416 4597 | ::pretty_assertions::assert_eq!(
|
4417 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
4598 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
4418 4599 | http_response.status()
|
4419 4600 | );
|
4420 4601 | let expected_headers = [
|
4421 4602 | ("Content-Type", "application/cbor"),
|
4422 4603 | ("smithy-protocol", "rpc-v2-cbor"),
|
4423 4604 | ];
|
4424 4605 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4425 4606 | http_response.headers(),
|
4426 4607 | expected_headers,
|
4427 4608 | ));
|
4428 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4609 + | use ::http_body_util::BodyExt;
|
4610 + | let body = http_response
|
4611 + | .into_body()
|
4612 + | .collect()
|
4429 4613 | .await
|
4430 - | .expect("unable to extract body to bytes");
|
4614 + | .expect("unable to collect body")
|
4615 + | .to_bytes();
|
4431 4616 | ::aws_smithy_protocol_test::assert_ok(
|
4432 4617 | ::aws_smithy_protocol_test::validate_body(&body, "v3B0cnVlQm9vbGVhblZhbHVl9XFmYWxzZUJvb2xlYW5WYWx1ZfRpYnl0ZVZhbHVlBWtkb3VibGVWYWx1Zfs//jlYEGJN02pmbG9hdFZhbHVl+kD0AABsaW50ZWdlclZhbHVlGQEAanNob3J0VmFsdWUZJqprc3RyaW5nVmFsdWVmc2ltcGxlaWJsb2JWYWx1ZUNmb2//", ::aws_smithy_protocol_test::MediaType::from("application/cbor"))
|
4433 4618 | );
|
4434 4619 | }
|
4435 4620 |
|
4436 4621 | /// RpcV2 Cbor should not serialize null structure values
|
4437 4622 | /// Test ID: RpcV2CborServerDoesntSerializeNullStructureValues
|
4438 4623 | #[::tokio::test]
|
4439 4624 | #[::tracing_test::traced_test]
|
4440 4625 | async fn rpc_v2_cbor_server_doesnt_serialize_null_structure_values_response() {
|
4441 4626 | let output = crate::output::SimpleScalarPropertiesOutput {
|
4442 4627 | string_value: ::std::option::Option::None,
|
4443 4628 | true_boolean_value: ::std::option::Option::None,
|
4444 4629 | false_boolean_value: ::std::option::Option::None,
|
4445 4630 | byte_value: ::std::option::Option::None,
|
4446 4631 | double_value: ::std::option::Option::None,
|
4447 4632 | float_value: ::std::option::Option::None,
|
4448 4633 | integer_value: ::std::option::Option::None,
|
4449 4634 | long_value: ::std::option::Option::None,
|
4450 4635 | short_value: ::std::option::Option::None,
|
4451 4636 | blob_value: ::std::option::Option::None,
|
4452 4637 | };
|
4453 4638 | use ::aws_smithy_http_server::response::IntoResponse;
|
4454 4639 | let http_response = output.into_response();
|
4455 4640 | ::pretty_assertions::assert_eq!(
|
4456 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
4641 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
4457 4642 | http_response.status()
|
4458 4643 | );
|
4459 4644 | let expected_headers = [
|
4460 4645 | ("Content-Type", "application/cbor"),
|
4461 4646 | ("smithy-protocol", "rpc-v2-cbor"),
|
4462 4647 | ];
|
4463 4648 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4464 4649 | http_response.headers(),
|
4465 4650 | expected_headers,
|
4466 4651 | ));
|
4467 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4652 + | use ::http_body_util::BodyExt;
|
4653 + | let body = http_response
|
4654 + | .into_body()
|
4655 + | .collect()
|
4468 4656 | .await
|
4469 - | .expect("unable to extract body to bytes");
|
4657 + | .expect("unable to collect body")
|
4658 + | .to_bytes();
|
4470 4659 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
4471 4660 | &body,
|
4472 4661 | "v/8=",
|
4473 4662 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
4474 4663 | ));
|
4475 4664 | }
|
4476 4665 |
|
4477 4666 | /// Supports handling NaN float values.
|
4478 4667 | /// Test ID: RpcV2CborSupportsNaNFloatOutputs
|
4479 4668 | #[::tokio::test]
|
4480 4669 | #[::tracing_test::traced_test]
|
4481 4670 | async fn rpc_v2_cbor_supports_na_n_float_outputs_response() {
|
4482 4671 | let output = crate::output::SimpleScalarPropertiesOutput {
|
4483 4672 | double_value: ::std::option::Option::Some(
|
4484 4673 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
4485 4674 | .expect("invalid string for number"),
|
4486 4675 | ),
|
4487 4676 | float_value: ::std::option::Option::Some(
|
4488 4677 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
4489 4678 | .expect("invalid string for number"),
|
4490 4679 | ),
|
4491 4680 | true_boolean_value: ::std::option::Option::None,
|
4492 4681 | false_boolean_value: ::std::option::Option::None,
|
4493 4682 | byte_value: ::std::option::Option::None,
|
4494 4683 | integer_value: ::std::option::Option::None,
|
4495 4684 | long_value: ::std::option::Option::None,
|
4496 4685 | short_value: ::std::option::Option::None,
|
4497 4686 | string_value: ::std::option::Option::None,
|
4498 4687 | blob_value: ::std::option::Option::None,
|
4499 4688 | };
|
4500 4689 | use ::aws_smithy_http_server::response::IntoResponse;
|
4501 4690 | let http_response = output.into_response();
|
4502 4691 | ::pretty_assertions::assert_eq!(
|
4503 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
4692 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
4504 4693 | http_response.status()
|
4505 4694 | );
|
4506 4695 | let expected_headers = [
|
4507 4696 | ("Content-Type", "application/cbor"),
|
4508 4697 | ("smithy-protocol", "rpc-v2-cbor"),
|
4509 4698 | ];
|
4510 4699 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4511 4700 | http_response.headers(),
|
4512 4701 | expected_headers,
|
4513 4702 | ));
|
4514 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4703 + | use ::http_body_util::BodyExt;
|
4704 + | let body = http_response
|
4705 + | .into_body()
|
4706 + | .collect()
|
4515 4707 | .await
|
4516 - | .expect("unable to extract body to bytes");
|
4708 + | .expect("unable to collect body")
|
4709 + | .to_bytes();
|
4517 4710 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
4518 4711 | &body,
|
4519 4712 | "v2tkb3VibGVWYWx1Zft/+AAAAAAAAGpmbG9hdFZhbHVl+n/AAAD/",
|
4520 4713 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
4521 4714 | ));
|
4522 4715 | }
|
4523 4716 |
|
4524 4717 | /// Supports handling Infinity float values.
|
4525 4718 | /// Test ID: RpcV2CborSupportsInfinityFloatOutputs
|
4526 4719 | #[::tokio::test]
|
4527 4720 | #[::tracing_test::traced_test]
|
4528 4721 | async fn rpc_v2_cbor_supports_infinity_float_outputs_response() {
|
4529 4722 | let output = crate::output::SimpleScalarPropertiesOutput {
|
4530 4723 | double_value: ::std::option::Option::Some(
|
4531 4724 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
4532 4725 | .expect("invalid string for number"),
|
4533 4726 | ),
|
4534 4727 | float_value: ::std::option::Option::Some(
|
4535 4728 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
4536 4729 | .expect("invalid string for number"),
|
4537 4730 | ),
|
4538 4731 | true_boolean_value: ::std::option::Option::None,
|
4539 4732 | false_boolean_value: ::std::option::Option::None,
|
4540 4733 | byte_value: ::std::option::Option::None,
|
4541 4734 | integer_value: ::std::option::Option::None,
|
4542 4735 | long_value: ::std::option::Option::None,
|
4543 4736 | short_value: ::std::option::Option::None,
|
4544 4737 | string_value: ::std::option::Option::None,
|
4545 4738 | blob_value: ::std::option::Option::None,
|
4546 4739 | };
|
4547 4740 | use ::aws_smithy_http_server::response::IntoResponse;
|
4548 4741 | let http_response = output.into_response();
|
4549 4742 | ::pretty_assertions::assert_eq!(
|
4550 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
4743 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
4551 4744 | http_response.status()
|
4552 4745 | );
|
4553 4746 | let expected_headers = [
|
4554 4747 | ("Content-Type", "application/cbor"),
|
4555 4748 | ("smithy-protocol", "rpc-v2-cbor"),
|
4556 4749 | ];
|
4557 4750 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4558 4751 | http_response.headers(),
|
4559 4752 | expected_headers,
|
4560 4753 | ));
|
4561 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4754 + | use ::http_body_util::BodyExt;
|
4755 + | let body = http_response
|
4756 + | .into_body()
|
4757 + | .collect()
|
4562 4758 | .await
|
4563 - | .expect("unable to extract body to bytes");
|
4759 + | .expect("unable to collect body")
|
4760 + | .to_bytes();
|
4564 4761 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
4565 4762 | &body,
|
4566 4763 | "v2tkb3VibGVWYWx1Zft/8AAAAAAAAGpmbG9hdFZhbHVl+n+AAAD/",
|
4567 4764 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
4568 4765 | ));
|
4569 4766 | }
|
4570 4767 |
|
4571 4768 | /// Supports handling Negative Infinity float values.
|
4572 4769 | /// Test ID: RpcV2CborSupportsNegativeInfinityFloatOutputs
|
4573 4770 | #[::tokio::test]
|
4574 4771 | #[::tracing_test::traced_test]
|
4575 4772 | async fn rpc_v2_cbor_supports_negative_infinity_float_outputs_response() {
|
4576 4773 | let output = crate::output::SimpleScalarPropertiesOutput {
|
4577 4774 | double_value: ::std::option::Option::Some(
|
4578 4775 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
4579 4776 | .expect("invalid string for number"),
|
4580 4777 | ),
|
4581 4778 | float_value: ::std::option::Option::Some(
|
4582 4779 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
4583 4780 | .expect("invalid string for number"),
|
4584 4781 | ),
|
4585 4782 | true_boolean_value: ::std::option::Option::None,
|
4586 4783 | false_boolean_value: ::std::option::Option::None,
|
4587 4784 | byte_value: ::std::option::Option::None,
|
4588 4785 | integer_value: ::std::option::Option::None,
|
4589 4786 | long_value: ::std::option::Option::None,
|
4590 4787 | short_value: ::std::option::Option::None,
|
4591 4788 | string_value: ::std::option::Option::None,
|
4592 4789 | blob_value: ::std::option::Option::None,
|
4593 4790 | };
|
4594 4791 | use ::aws_smithy_http_server::response::IntoResponse;
|
4595 4792 | let http_response = output.into_response();
|
4596 4793 | ::pretty_assertions::assert_eq!(
|
4597 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
4794 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
4598 4795 | http_response.status()
|
4599 4796 | );
|
4600 4797 | let expected_headers = [
|
4601 4798 | ("Content-Type", "application/cbor"),
|
4602 4799 | ("smithy-protocol", "rpc-v2-cbor"),
|
4603 4800 | ];
|
4604 4801 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4605 4802 | http_response.headers(),
|
4606 4803 | expected_headers,
|
4607 4804 | ));
|
4608 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4805 + | use ::http_body_util::BodyExt;
|
4806 + | let body = http_response
|
4807 + | .into_body()
|
4808 + | .collect()
|
4609 4809 | .await
|
4610 - | .expect("unable to extract body to bytes");
|
4810 + | .expect("unable to collect body")
|
4811 + | .to_bytes();
|
4611 4812 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
4612 4813 | &body,
|
4613 4814 | "v2tkb3VibGVWYWx1Zfv/8AAAAAAAAGpmbG9hdFZhbHVl+v+AAAD/",
|
4614 4815 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
4615 4816 | ));
|
4616 4817 | }
|
4617 4818 | }
|
4618 4819 |
|
4619 4820 | ::pin_project_lite::pin_project! {
|
4620 4821 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
4621 4822 | /// [`OptionalInputOutputInput`](crate::input::OptionalInputOutputInput) using modelled bindings.
|
4622 4823 | pub struct OptionalInputOutputInputFuture {
|
4623 4824 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::OptionalInputOutputInput, ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
4624 4825 | }
|
4625 4826 | }
|
4626 4827 |
|
4627 4828 | impl std::future::Future for OptionalInputOutputInputFuture {
|
4628 4829 | type Output = Result<
|
4629 4830 | crate::input::OptionalInputOutputInput,
|
4630 4831 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
4631 4832 | >;
|
4632 4833 |
|
4633 4834 | fn poll(
|
4634 4835 | self: std::pin::Pin<&mut Self>,
|
4635 4836 | cx: &mut std::task::Context<'_>,
|
4636 4837 | ) -> std::task::Poll<Self::Output> {
|
4637 4838 | let this = self.project();
|
4638 4839 | this.inner.as_mut().poll(cx)
|
4639 4840 | }
|
4640 4841 | }
|
4641 4842 |
|
4642 4843 | impl<B>
|
4643 4844 | ::aws_smithy_http_server::request::FromRequest<
|
4644 4845 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
4645 4846 | B,
|
4646 4847 | > for crate::input::OptionalInputOutputInput
|
4647 4848 | where
|
4648 4849 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
4649 4850 | B: 'static,
|
4650 4851 |
|
4651 4852 | B::Data: Send,
|
4652 4853 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
4653 4854 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
4654 4855 | {
|
4655 4856 | type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
4656 4857 | type Future = OptionalInputOutputInputFuture;
|
4657 4858 |
|
4658 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
4859 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
4659 4860 | let fut = async move {
|
4660 4861 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
4661 4862 | request.headers(),
|
4662 4863 | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
4663 4864 | ) {
|
4664 4865 | return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
4665 4866 | }
|
4666 4867 | crate::protocol_serde::shape_optional_input_output::de_optional_input_output_http_request(request)
|
4667 4868 | .await
|
4668 4869 | };
|
4669 4870 | use ::futures_util::future::TryFutureExt;
|
4670 4871 | let fut = fut.map_err(
|
4671 4872 | |e: ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
|
4672 4873 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
4673 4874 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(
|
4674 4875 | e,
|
4675 4876 | )
|
4676 4877 | },
|
4677 4878 | );
|
4678 4879 | OptionalInputOutputInputFuture {
|
4679 4880 | inner: Box::pin(fut),
|
4680 4881 | }
|
4681 4882 | }
|
4682 4883 | }
|
4683 4884 | impl
|
4684 4885 | ::aws_smithy_http_server::response::IntoResponse<
|
4685 4886 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
4686 4887 | > for crate::output::OptionalInputOutputOutput
|
4687 4888 | {
|
4688 4889 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
4689 4890 | match crate::protocol_serde::shape_optional_input_output::ser_optional_input_output_http_response(self) {
|
4690 4891 | Ok(response) => response,
|
4691 4892 | Err(e) => {
|
4692 4893 | ::tracing::error!(error = %e, "failed to serialize response");
|
4693 4894 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
4694 4895 | }
|
4695 4896 | }
|
4696 4897 | }
|
4697 4898 | }
|
4698 4899 |
|
4699 4900 | #[allow(unreachable_code, unused_variables)]
|
4700 4901 | #[cfg(test)]
|
4701 4902 | mod optional_input_output_test {
|
4702 4903 |
|
4703 4904 | /// When input is empty we write CBOR equivalent of {}
|
4704 4905 | /// Test ID: optional_input
|
4705 4906 | #[::tokio::test]
|
4706 4907 | #[::tracing_test::traced_test]
|
4707 4908 | async fn optional_input_request() {
|
4708 4909 | #[allow(unused_mut)]
|
4709 - | let mut http_request = http::Request::builder()
|
4910 + | let mut http_request = ::http_1x::Request::builder()
|
4710 4911 | .uri("/service/RpcV2Protocol/operation/OptionalInputOutput")
|
4711 4912 | .method("POST")
|
4712 4913 | .header("Accept", "application/cbor")
|
4713 4914 | .header("Content-Type", "application/cbor")
|
4714 4915 | .header("smithy-protocol", "rpc-v2-cbor")
|
4715 - | .body(::aws_smithy_http_server::body::Body::from(
|
4716 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4717 - | "v/8=".as_bytes(),
|
4718 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
4916 + | .body(::aws_smithy_http_server::body::boxed(
|
4917 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4918 + | &::aws_smithy_protocol_test::decode_body_data(
|
4919 + | "v/8=".as_bytes(),
|
4920 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
4921 + | ),
|
4719 4922 | )),
|
4720 4923 | ))
|
4721 4924 | .unwrap();
|
4722 4925 | #[allow(unused_mut)]
|
4723 4926 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4724 4927 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
4725 - | let service =
|
4726 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4727 - | .optional_input_output(move |input: crate::input::OptionalInputOutputInput| {
|
4728 - | let sender = sender.clone();
|
4729 - | async move {
|
4730 - | let result = {
|
4731 - | let expected = crate::input::OptionalInputOutputInput {
|
4732 - | value: ::std::option::Option::None,
|
4733 - | };
|
4734 - | ::pretty_assertions::assert_eq!(input, expected);
|
4735 - | let output = crate::output::OptionalInputOutputOutput {
|
4736 - | value: ::std::option::Option::None,
|
4737 - | };
|
4738 - | output
|
4739 - | };
|
4740 - | sender.send(()).await.expect("receiver dropped early");
|
4741 - | result
|
4742 - | }
|
4743 - | })
|
4744 - | .build_unchecked();
|
4928 + | let service = crate::service::RpcV2Protocol::builder::<
|
4929 + | ::aws_smithy_http_server::body::BoxBody,
|
4930 + | _,
|
4931 + | _,
|
4932 + | _,
|
4933 + | >(config)
|
4934 + | .optional_input_output(move |input: crate::input::OptionalInputOutputInput| {
|
4935 + | let sender = sender.clone();
|
4936 + | async move {
|
4937 + | let result = {
|
4938 + | let expected = crate::input::OptionalInputOutputInput {
|
4939 + | value: ::std::option::Option::None,
|
4940 + | };
|
4941 + | ::pretty_assertions::assert_eq!(input, expected);
|
4942 + | let output = crate::output::OptionalInputOutputOutput {
|
4943 + | value: ::std::option::Option::None,
|
4944 + | };
|
4945 + | output
|
4946 + | };
|
4947 + | sender.send(()).await.expect("receiver dropped early");
|
4948 + | result
|
4949 + | }
|
4950 + | })
|
4951 + | .build_unchecked();
|
4745 4952 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4746 4953 | .await
|
4747 4954 | .expect("unable to make an HTTP request");
|
4748 4955 | assert!(
|
4749 4956 | receiver.recv().await.is_some(),
|
4750 4957 | "we expected operation handler to be invoked but it was not entered"
|
4751 4958 | );
|
4752 4959 | }
|
4753 4960 |
|
4754 4961 | /// When output is empty we write CBOR equivalent of {}
|
4755 4962 | /// Test ID: optional_output
|
4756 4963 | #[::tokio::test]
|
4757 4964 | #[::tracing_test::traced_test]
|
4758 4965 | async fn optional_output_response() {
|
4759 4966 | let output = crate::output::OptionalInputOutputOutput {
|
4760 4967 | value: ::std::option::Option::None,
|
4761 4968 | };
|
4762 4969 | use ::aws_smithy_http_server::response::IntoResponse;
|
4763 4970 | let http_response = output.into_response();
|
4764 4971 | ::pretty_assertions::assert_eq!(
|
4765 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
4972 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
4766 4973 | http_response.status()
|
4767 4974 | );
|
4768 4975 | let expected_headers = [
|
4769 4976 | ("Content-Type", "application/cbor"),
|
4770 4977 | ("smithy-protocol", "rpc-v2-cbor"),
|
4771 4978 | ];
|
4772 4979 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4773 4980 | http_response.headers(),
|
4774 4981 | expected_headers,
|
4775 4982 | ));
|
4776 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4983 + | use ::http_body_util::BodyExt;
|
4984 + | let body = http_response
|
4985 + | .into_body()
|
4986 + | .collect()
|
4777 4987 | .await
|
4778 - | .expect("unable to extract body to bytes");
|
4988 + | .expect("unable to collect body")
|
4989 + | .to_bytes();
|
4779 4990 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
4780 4991 | &body,
|
4781 4992 | "v/8=",
|
4782 4993 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
4783 4994 | ));
|
4784 4995 | }
|
4785 4996 | }
|
4786 4997 |
|
4787 4998 | ::pin_project_lite::pin_project! {
|
4788 4999 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
4789 5000 | /// [`EmptyInputOutputInput`](crate::input::EmptyInputOutputInput) using modelled bindings.
|
4790 5001 | pub struct EmptyInputOutputInputFuture {
|
4791 5002 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EmptyInputOutputInput, ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
4792 5003 | }
|
4793 5004 | }
|
4794 5005 |
|
4795 5006 | impl std::future::Future for EmptyInputOutputInputFuture {
|
4796 5007 | type Output = Result<
|
4797 5008 | crate::input::EmptyInputOutputInput,
|
4798 5009 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
4799 5010 | >;
|
4800 5011 |
|
4801 5012 | fn poll(
|
4802 5013 | self: std::pin::Pin<&mut Self>,
|
4803 5014 | cx: &mut std::task::Context<'_>,
|
4804 5015 | ) -> std::task::Poll<Self::Output> {
|
4805 5016 | let this = self.project();
|
4806 5017 | this.inner.as_mut().poll(cx)
|
4807 5018 | }
|
4808 5019 | }
|
4809 5020 |
|
4810 5021 | impl<B>
|
4811 5022 | ::aws_smithy_http_server::request::FromRequest<
|
4812 5023 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
4813 5024 | B,
|
4814 5025 | > for crate::input::EmptyInputOutputInput
|
4815 5026 | where
|
4816 5027 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
4817 5028 | B: 'static,
|
4818 5029 |
|
4819 5030 | B::Data: Send,
|
4820 5031 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
4821 5032 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
4822 5033 | {
|
4823 5034 | type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
4824 5035 | type Future = EmptyInputOutputInputFuture;
|
4825 5036 |
|
4826 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
5037 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
4827 5038 | let fut = async move {
|
4828 5039 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
4829 5040 | request.headers(),
|
4830 5041 | &crate::mimes::CONTENT_TYPE_APPLICATION_CBOR,
|
4831 5042 | ) {
|
4832 5043 | return Err(::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection::NotAcceptable);
|
4833 5044 | }
|
4834 5045 | crate::protocol_serde::shape_empty_input_output::de_empty_input_output_http_request(
|
4835 5046 | request,
|
4836 5047 | )
|
4837 5048 | .await
|
4838 5049 | };
|
4839 5050 | use ::futures_util::future::TryFutureExt;
|
4840 5051 | let fut = fut.map_err(
|
4841 5052 | |e: ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
|
4842 5053 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
4843 5054 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(
|
4844 5055 | e,
|
4845 5056 | )
|
4846 5057 | },
|
4847 5058 | );
|
4848 5059 | EmptyInputOutputInputFuture {
|
4849 5060 | inner: Box::pin(fut),
|
4850 5061 | }
|
4851 5062 | }
|
4852 5063 | }
|
4853 5064 | impl
|
4854 5065 | ::aws_smithy_http_server::response::IntoResponse<
|
4855 5066 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
4856 5067 | > for crate::output::EmptyInputOutputOutput
|
4857 5068 | {
|
4858 5069 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
4859 5070 | match crate::protocol_serde::shape_empty_input_output::ser_empty_input_output_http_response(
|
4860 5071 | self,
|
4861 5072 | ) {
|
4862 5073 | Ok(response) => response,
|
4863 5074 | Err(e) => {
|
4864 5075 | ::tracing::error!(error = %e, "failed to serialize response");
|
4865 5076 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
4866 5077 | }
|
4867 5078 | }
|
4868 5079 | }
|
4869 5080 | }
|
4870 5081 |
|
4871 5082 | #[allow(unreachable_code, unused_variables)]
|
4872 5083 | #[cfg(test)]
|
4873 5084 | mod empty_input_output_test {
|
4874 5085 |
|
4875 5086 | /// When Input structure is empty we write CBOR equivalent of {}
|
4876 5087 | /// Test ID: empty_input
|
4877 5088 | #[::tokio::test]
|
4878 5089 | #[::tracing_test::traced_test]
|
4879 5090 | async fn empty_input_request() {
|
4880 5091 | #[allow(unused_mut)]
|
4881 - | let mut http_request = http::Request::builder()
|
5092 + | let mut http_request = ::http_1x::Request::builder()
|
4882 5093 | .uri("/service/RpcV2Protocol/operation/EmptyInputOutput")
|
4883 5094 | .method("POST")
|
4884 5095 | .header("Accept", "application/cbor")
|
4885 5096 | .header("Content-Type", "application/cbor")
|
4886 5097 | .header("smithy-protocol", "rpc-v2-cbor")
|
4887 - | .body(::aws_smithy_http_server::body::Body::from(
|
4888 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4889 - | "v/8=".as_bytes(),
|
4890 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
5098 + | .body(::aws_smithy_http_server::body::boxed(
|
5099 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5100 + | &::aws_smithy_protocol_test::decode_body_data(
|
5101 + | "v/8=".as_bytes(),
|
5102 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
5103 + | ),
|
4891 5104 | )),
|
4892 5105 | ))
|
4893 5106 | .unwrap();
|
4894 5107 | #[allow(unused_mut)]
|
4895 5108 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4896 5109 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
4897 - | let service =
|
4898 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4899 - | .empty_input_output(move |input: crate::input::EmptyInputOutputInput| {
|
4900 - | let sender = sender.clone();
|
4901 - | async move {
|
4902 - | let result = {
|
4903 - | let expected = crate::input::EmptyInputOutputInput {};
|
4904 - | ::pretty_assertions::assert_eq!(input, expected);
|
4905 - | let output = crate::output::EmptyInputOutputOutput {};
|
4906 - | output
|
4907 - | };
|
4908 - | sender.send(()).await.expect("receiver dropped early");
|
4909 - | result
|
4910 - | }
|
4911 - | })
|
4912 - | .build_unchecked();
|
5110 + | let service = crate::service::RpcV2Protocol::builder::<
|
5111 + | ::aws_smithy_http_server::body::BoxBody,
|
5112 + | _,
|
5113 + | _,
|
5114 + | _,
|
5115 + | >(config)
|
5116 + | .empty_input_output(move |input: crate::input::EmptyInputOutputInput| {
|
5117 + | let sender = sender.clone();
|
5118 + | async move {
|
5119 + | let result = {
|
5120 + | let expected = crate::input::EmptyInputOutputInput {};
|
5121 + | ::pretty_assertions::assert_eq!(input, expected);
|
5122 + | let output = crate::output::EmptyInputOutputOutput {};
|
5123 + | output
|
5124 + | };
|
5125 + | sender.send(()).await.expect("receiver dropped early");
|
5126 + | result
|
5127 + | }
|
5128 + | })
|
5129 + | .build_unchecked();
|
4913 5130 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4914 5131 | .await
|
4915 5132 | .expect("unable to make an HTTP request");
|
4916 5133 | assert!(
|
4917 5134 | receiver.recv().await.is_some(),
|
4918 5135 | "we expected operation handler to be invoked but it was not entered"
|
4919 5136 | );
|
4920 5137 | }
|
4921 5138 |
|
4922 5139 | /// When Input structure is empty the server should accept an empty body
|
4923 5140 | /// Test ID: empty_input_no_body
|
4924 5141 | #[::tokio::test]
|
4925 5142 | #[::tracing_test::traced_test]
|
4926 5143 | async fn empty_input_no_body_request() {
|
4927 5144 | #[allow(unused_mut)]
|
4928 - | let mut http_request = http::Request::builder()
|
5145 + | let mut http_request = ::http_1x::Request::builder()
|
4929 5146 | .uri("/service/RpcV2Protocol/operation/EmptyInputOutput")
|
4930 5147 | .method("POST")
|
4931 5148 | .header("Accept", "application/cbor")
|
4932 5149 | .header("Content-Type", "application/cbor")
|
4933 5150 | .header("smithy-protocol", "rpc-v2-cbor")
|
4934 - | .body(::aws_smithy_http_server::body::Body::from(
|
4935 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4936 - | "".as_bytes(),
|
4937 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
5151 + | .body(::aws_smithy_http_server::body::boxed(
|
5152 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5153 + | &::aws_smithy_protocol_test::decode_body_data(
|
5154 + | "".as_bytes(),
|
5155 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
5156 + | ),
|
4938 5157 | )),
|
4939 5158 | ))
|
4940 5159 | .unwrap();
|
4941 5160 | #[allow(unused_mut)]
|
4942 5161 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4943 5162 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
4944 - | let service =
|
4945 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4946 - | .empty_input_output(move |input: crate::input::EmptyInputOutputInput| {
|
4947 - | let sender = sender.clone();
|
4948 - | async move {
|
4949 - | let result = {
|
4950 - | let expected = crate::input::EmptyInputOutputInput {};
|
4951 - | ::pretty_assertions::assert_eq!(input, expected);
|
4952 - | let output = crate::output::EmptyInputOutputOutput {};
|
4953 - | output
|
4954 - | };
|
4955 - | sender.send(()).await.expect("receiver dropped early");
|
4956 - | result
|
4957 - | }
|
4958 - | })
|
4959 - | .build_unchecked();
|
5163 + | let service = crate::service::RpcV2Protocol::builder::<
|
5164 + | ::aws_smithy_http_server::body::BoxBody,
|
5165 + | _,
|
5166 + | _,
|
5167 + | _,
|
5168 + | >(config)
|
5169 + | .empty_input_output(move |input: crate::input::EmptyInputOutputInput| {
|
5170 + | let sender = sender.clone();
|
5171 + | async move {
|
5172 + | let result = {
|
5173 + | let expected = crate::input::EmptyInputOutputInput {};
|
5174 + | ::pretty_assertions::assert_eq!(input, expected);
|
5175 + | let output = crate::output::EmptyInputOutputOutput {};
|
5176 + | output
|
5177 + | };
|
5178 + | sender.send(()).await.expect("receiver dropped early");
|
5179 + | result
|
5180 + | }
|
5181 + | })
|
5182 + | .build_unchecked();
|
4960 5183 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4961 5184 | .await
|
4962 5185 | .expect("unable to make an HTTP request");
|
4963 5186 | assert!(
|
4964 5187 | receiver.recv().await.is_some(),
|
4965 5188 | "we expected operation handler to be invoked but it was not entered"
|
4966 5189 | );
|
4967 5190 | }
|
4968 5191 |
|
4969 5192 | /// When input structure, is empty the server should accept an empty body
|
4970 5193 | /// even if the Accept header is set.
|
4971 5194 | /// Test ID: empty_input_no_body_has_accept
|
4972 5195 | #[::tokio::test]
|
4973 5196 | #[::tracing_test::traced_test]
|
4974 5197 | async fn empty_input_no_body_has_accept_request() {
|
4975 5198 | #[allow(unused_mut)]
|
4976 - | let mut http_request = http::Request::builder()
|
5199 + | let mut http_request = ::http_1x::Request::builder()
|
4977 5200 | .uri("/service/RpcV2Protocol/operation/EmptyInputOutput")
|
4978 5201 | .method("POST")
|
4979 5202 | .header("Accept", "application/cbor")
|
4980 5203 | .header("Content-Type", "application/cbor")
|
4981 5204 | .header("smithy-protocol", "rpc-v2-cbor")
|
4982 - | .body(::aws_smithy_http_server::body::Body::from(
|
4983 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4984 - | "".as_bytes(),
|
4985 - | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
5205 + | .body(::aws_smithy_http_server::body::boxed(
|
5206 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5207 + | &::aws_smithy_protocol_test::decode_body_data(
|
5208 + | "".as_bytes(),
|
5209 + | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
5210 + | ),
|
4986 5211 | )),
|
4987 5212 | ))
|
4988 5213 | .unwrap();
|
4989 5214 | #[allow(unused_mut)]
|
4990 5215 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4991 5216 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
4992 - | let service =
|
4993 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
4994 - | .empty_input_output(move |input: crate::input::EmptyInputOutputInput| {
|
4995 - | let sender = sender.clone();
|
4996 - | async move {
|
4997 - | let result = {
|
4998 - | let expected = crate::input::EmptyInputOutputInput {};
|
4999 - | ::pretty_assertions::assert_eq!(input, expected);
|
5000 - | let output = crate::output::EmptyInputOutputOutput {};
|
5001 - | output
|
5002 - | };
|
5003 - | sender.send(()).await.expect("receiver dropped early");
|
5004 - | result
|
5005 - | }
|
5006 - | })
|
5007 - | .build_unchecked();
|
5217 + | let service = crate::service::RpcV2Protocol::builder::<
|
5218 + | ::aws_smithy_http_server::body::BoxBody,
|
5219 + | _,
|
5220 + | _,
|
5221 + | _,
|
5222 + | >(config)
|
5223 + | .empty_input_output(move |input: crate::input::EmptyInputOutputInput| {
|
5224 + | let sender = sender.clone();
|
5225 + | async move {
|
5226 + | let result = {
|
5227 + | let expected = crate::input::EmptyInputOutputInput {};
|
5228 + | ::pretty_assertions::assert_eq!(input, expected);
|
5229 + | let output = crate::output::EmptyInputOutputOutput {};
|
5230 + | output
|
5231 + | };
|
5232 + | sender.send(()).await.expect("receiver dropped early");
|
5233 + | result
|
5234 + | }
|
5235 + | })
|
5236 + | .build_unchecked();
|
5008 5237 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5009 5238 | .await
|
5010 5239 | .expect("unable to make an HTTP request");
|
5011 5240 | assert!(
|
5012 5241 | receiver.recv().await.is_some(),
|
5013 5242 | "we expected operation handler to be invoked but it was not entered"
|
5014 5243 | );
|
5015 5244 | }
|
5016 5245 |
|
5017 5246 | /// When output structure is empty we write CBOR equivalent of {}
|
5018 5247 | /// Test ID: empty_output
|
5019 5248 | #[::tokio::test]
|
5020 5249 | #[::tracing_test::traced_test]
|
5021 5250 | async fn empty_output_response() {
|
5022 5251 | let output = crate::output::EmptyInputOutputOutput {};
|
5023 5252 | use ::aws_smithy_http_server::response::IntoResponse;
|
5024 5253 | let http_response = output.into_response();
|
5025 5254 | ::pretty_assertions::assert_eq!(
|
5026 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
5255 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
5027 5256 | http_response.status()
|
5028 5257 | );
|
5029 5258 | let expected_headers = [
|
5030 5259 | ("Content-Type", "application/cbor"),
|
5031 5260 | ("smithy-protocol", "rpc-v2-cbor"),
|
5032 5261 | ];
|
5033 5262 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5034 5263 | http_response.headers(),
|
5035 5264 | expected_headers,
|
5036 5265 | ));
|
5037 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5266 + | use ::http_body_util::BodyExt;
|
5267 + | let body = http_response
|
5268 + | .into_body()
|
5269 + | .collect()
|
5038 5270 | .await
|
5039 - | .expect("unable to extract body to bytes");
|
5271 + | .expect("unable to collect body")
|
5272 + | .to_bytes();
|
5040 5273 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
5041 5274 | &body,
|
5042 5275 | "v/8=",
|
5043 5276 | ::aws_smithy_protocol_test::MediaType::from("application/cbor"),
|
5044 5277 | ));
|
5045 5278 | }
|
5046 5279 | }
|
5047 5280 |
|
5048 5281 | ::pin_project_lite::pin_project! {
|
5049 5282 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
5050 5283 | /// [`NoInputOutputInput`](crate::input::NoInputOutputInput) using modelled bindings.
|
5051 5284 | pub struct NoInputOutputInputFuture {
|
5052 5285 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::NoInputOutputInput, ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError>> + Send>>
|
5053 5286 | }
|
5054 5287 | }
|
5055 5288 |
|
5056 5289 | impl std::future::Future for NoInputOutputInputFuture {
|
5057 5290 | type Output = Result<
|
5058 5291 | crate::input::NoInputOutputInput,
|
5059 5292 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError,
|
5060 5293 | >;
|
5061 5294 |
|
5062 5295 | fn poll(
|
5063 5296 | self: std::pin::Pin<&mut Self>,
|
5064 5297 | cx: &mut std::task::Context<'_>,
|
5065 5298 | ) -> std::task::Poll<Self::Output> {
|
5066 5299 | let this = self.project();
|
5067 5300 | this.inner.as_mut().poll(cx)
|
5068 5301 | }
|
5069 5302 | }
|
5070 5303 |
|
5071 5304 | impl<B>
|
5072 5305 | ::aws_smithy_http_server::request::FromRequest<
|
5073 5306 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
5074 5307 | B,
|
5075 5308 | > for crate::input::NoInputOutputInput
|
5076 5309 | where
|
5077 5310 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
5078 5311 | B: 'static,
|
5079 5312 |
|
5080 5313 | B::Data: Send,
|
5081 5314 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection:
|
5082 5315 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
5083 5316 | {
|
5084 5317 | type Rejection = ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError;
|
5085 5318 | type Future = NoInputOutputInputFuture;
|
5086 5319 |
|
5087 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
5320 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
5088 5321 | let fut = async move {
|
5089 5322 | crate::protocol_serde::shape_no_input_output::de_no_input_output_http_request(request)
|
5090 5323 | .await
|
5091 5324 | };
|
5092 5325 | use ::futures_util::future::TryFutureExt;
|
5093 5326 | let fut = fut.map_err(
|
5094 5327 | |e: ::aws_smithy_http_server::protocol::rpc_v2_cbor::rejection::RequestRejection| {
|
5095 5328 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
5096 5329 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(
|
5097 5330 | e,
|
5098 5331 | )
|
5099 5332 | },
|
5100 5333 | );
|
5101 5334 | NoInputOutputInputFuture {
|
5102 5335 | inner: Box::pin(fut),
|
5103 5336 | }
|
5104 5337 | }
|
5105 5338 | }
|
5106 5339 | impl
|
5107 5340 | ::aws_smithy_http_server::response::IntoResponse<
|
5108 5341 | ::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor,
|
5109 5342 | > for crate::output::NoInputOutputOutput
|
5110 5343 | {
|
5111 5344 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
5112 5345 | match crate::protocol_serde::shape_no_input_output::ser_no_input_output_http_response(self)
|
5113 5346 | {
|
5114 5347 | Ok(response) => response,
|
5115 5348 | Err(e) => {
|
5116 5349 | ::tracing::error!(error = %e, "failed to serialize response");
|
5117 5350 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rpc_v2_cbor::RpcV2Cbor>::into_response(::aws_smithy_http_server::protocol::rpc_v2_cbor::runtime_error::RuntimeError::from(e))
|
5118 5351 | }
|
5119 5352 | }
|
5120 5353 | }
|
5121 5354 | }
|
5122 5355 |
|
5123 5356 | #[allow(unreachable_code, unused_variables)]
|
5124 5357 | #[cfg(test)]
|
5125 5358 | mod no_input_output_test {
|
5126 5359 |
|
5127 5360 | /// Body is empty and no Content-Type header if no input
|
5128 5361 | /// Test ID: no_input
|
5129 5362 | #[::tokio::test]
|
5130 5363 | #[::tracing_test::traced_test]
|
5131 5364 | async fn no_input_request() {
|
5132 5365 | #[allow(unused_mut)]
|
5133 - | let mut http_request = http::Request::builder()
|
5366 + | let mut http_request = ::http_1x::Request::builder()
|
5134 5367 | .uri("/service/RpcV2Protocol/operation/NoInputOutput")
|
5135 5368 | .method("POST")
|
5136 5369 | .header("Accept", "application/cbor")
|
5137 5370 | .header("smithy-protocol", "rpc-v2-cbor")
|
5138 - | .body(::aws_smithy_http_server::body::Body::from(
|
5139 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5140 - | "".as_bytes(),
|
5141 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5371 + | .body(::aws_smithy_http_server::body::boxed(
|
5372 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5373 + | &::aws_smithy_protocol_test::decode_body_data(
|
5374 + | "".as_bytes(),
|
5375 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5376 + | ),
|
5142 5377 | )),
|
5143 5378 | ))
|
5144 5379 | .unwrap();
|
5145 5380 | #[allow(unused_mut)]
|
5146 5381 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5147 5382 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
5148 - | let service =
|
5149 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5150 - | .no_input_output(move |input: crate::input::NoInputOutputInput| {
|
5151 - | let sender = sender.clone();
|
5152 - | async move {
|
5153 - | let result = {
|
5154 - | let expected = crate::input::NoInputOutputInput {};
|
5155 - | ::pretty_assertions::assert_eq!(input, expected);
|
5156 - | let output = crate::output::NoInputOutputOutput {};
|
5157 - | output
|
5158 - | };
|
5159 - | sender.send(()).await.expect("receiver dropped early");
|
5160 - | result
|
5161 - | }
|
5162 - | })
|
5163 - | .build_unchecked();
|
5383 + | let service = crate::service::RpcV2Protocol::builder::<
|
5384 + | ::aws_smithy_http_server::body::BoxBody,
|
5385 + | _,
|
5386 + | _,
|
5387 + | _,
|
5388 + | >(config)
|
5389 + | .no_input_output(move |input: crate::input::NoInputOutputInput| {
|
5390 + | let sender = sender.clone();
|
5391 + | async move {
|
5392 + | let result = {
|
5393 + | let expected = crate::input::NoInputOutputInput {};
|
5394 + | ::pretty_assertions::assert_eq!(input, expected);
|
5395 + | let output = crate::output::NoInputOutputOutput {};
|
5396 + | output
|
5397 + | };
|
5398 + | sender.send(()).await.expect("receiver dropped early");
|
5399 + | result
|
5400 + | }
|
5401 + | })
|
5402 + | .build_unchecked();
|
5164 5403 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5165 5404 | .await
|
5166 5405 | .expect("unable to make an HTTP request");
|
5167 5406 | assert!(
|
5168 5407 | receiver.recv().await.is_some(),
|
5169 5408 | "we expected operation handler to be invoked but it was not entered"
|
5170 5409 | );
|
5171 5410 | }
|
5172 5411 |
|
5173 5412 | /// Servers should accept CBOR empty struct if no input.
|
5174 5413 | /// Test ID: NoInputServerAllowsEmptyCbor
|
5175 5414 | #[::tokio::test]
|
5176 5415 | #[::tracing_test::traced_test]
|
5177 5416 | async fn no_input_server_allows_empty_cbor_request() {
|
5178 5417 | #[allow(unused_mut)]
|
5179 - | let mut http_request = http::Request::builder()
|
5418 + | let mut http_request = ::http_1x::Request::builder()
|
5180 5419 | .uri("/service/RpcV2Protocol/operation/NoInputOutput")
|
5181 5420 | .method("POST")
|
5182 5421 | .header("Accept", "application/cbor")
|
5183 5422 | .header("Content-Type", "application/cbor")
|
5184 5423 | .header("smithy-protocol", "rpc-v2-cbor")
|
5185 - | .body(::aws_smithy_http_server::body::Body::from(
|
5186 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5187 - | "v/8=".as_bytes(),
|
5188 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5424 + | .body(::aws_smithy_http_server::body::boxed(
|
5425 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5426 + | &::aws_smithy_protocol_test::decode_body_data(
|
5427 + | "v/8=".as_bytes(),
|
5428 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5429 + | ),
|
5189 5430 | )),
|
5190 5431 | ))
|
5191 5432 | .unwrap();
|
5192 5433 | #[allow(unused_mut)]
|
5193 5434 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5194 5435 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
5195 - | let service =
|
5196 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5197 - | .no_input_output(move |input: crate::input::NoInputOutputInput| {
|
5198 - | let sender = sender.clone();
|
5199 - | async move {
|
5200 - | let result = {
|
5201 - | let expected = crate::input::NoInputOutputInput {};
|
5202 - | ::pretty_assertions::assert_eq!(input, expected);
|
5203 - | let output = crate::output::NoInputOutputOutput {};
|
5204 - | output
|
5205 - | };
|
5206 - | sender.send(()).await.expect("receiver dropped early");
|
5207 - | result
|
5208 - | }
|
5209 - | })
|
5210 - | .build_unchecked();
|
5436 + | let service = crate::service::RpcV2Protocol::builder::<
|
5437 + | ::aws_smithy_http_server::body::BoxBody,
|
5438 + | _,
|
5439 + | _,
|
5440 + | _,
|
5441 + | >(config)
|
5442 + | .no_input_output(move |input: crate::input::NoInputOutputInput| {
|
5443 + | let sender = sender.clone();
|
5444 + | async move {
|
5445 + | let result = {
|
5446 + | let expected = crate::input::NoInputOutputInput {};
|
5447 + | ::pretty_assertions::assert_eq!(input, expected);
|
5448 + | let output = crate::output::NoInputOutputOutput {};
|
5449 + | output
|
5450 + | };
|
5451 + | sender.send(()).await.expect("receiver dropped early");
|
5452 + | result
|
5453 + | }
|
5454 + | })
|
5455 + | .build_unchecked();
|
5211 5456 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5212 5457 | .await
|
5213 5458 | .expect("unable to make an HTTP request");
|
5214 5459 | assert!(
|
5215 5460 | receiver.recv().await.is_some(),
|
5216 5461 | "we expected operation handler to be invoked but it was not entered"
|
5217 5462 | );
|
5218 5463 | }
|
5219 5464 |
|
5220 5465 | /// Servers should accept an empty body if there is no input. Additionally,
|
5221 5466 | /// they should not raise an error if the `Accept` header is set.
|
5222 5467 | /// Test ID: NoInputServerAllowsEmptyBody
|
5223 5468 | #[::tokio::test]
|
5224 5469 | #[::tracing_test::traced_test]
|
5225 5470 | async fn no_input_server_allows_empty_body_request() {
|
5226 5471 | #[allow(unused_mut)]
|
5227 - | let mut http_request = http::Request::builder()
|
5472 + | let mut http_request = ::http_1x::Request::builder()
|
5228 5473 | .uri("/service/RpcV2Protocol/operation/NoInputOutput")
|
5229 5474 | .method("POST")
|
5230 5475 | .header("Accept", "application/cbor")
|
5231 5476 | .header("Content-Type", "application/cbor")
|
5232 5477 | .header("smithy-protocol", "rpc-v2-cbor")
|
5233 - | .body(::aws_smithy_http_server::body::Body::from(
|
5234 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5235 - | "".as_bytes(),
|
5236 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5478 + | .body(::aws_smithy_http_server::body::boxed(
|
5479 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5480 + | &::aws_smithy_protocol_test::decode_body_data(
|
5481 + | "".as_bytes(),
|
5482 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5483 + | ),
|
5237 5484 | )),
|
5238 5485 | ))
|
5239 5486 | .unwrap();
|
5240 5487 | #[allow(unused_mut)]
|
5241 5488 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5242 5489 | let config = crate::service::RpcV2ProtocolConfig::builder().build();
|
5243 - | let service =
|
5244 - | crate::service::RpcV2Protocol::builder::<::hyper::body::Body, _, _, _>(config)
|
5245 - | .no_input_output(move |input: crate::input::NoInputOutputInput| {
|
5246 - | let sender = sender.clone();
|
5247 - | async move {
|
5248 - | let result = {
|
5249 - | let expected = crate::input::NoInputOutputInput {};
|
5250 - | ::pretty_assertions::assert_eq!(input, expected);
|
5251 - | let output = crate::output::NoInputOutputOutput {};
|
5252 - | output
|
5253 - | };
|
5254 - | sender.send(()).await.expect("receiver dropped early");
|
5255 - | result
|
5256 - | }
|
5257 - | })
|
5258 - | .build_unchecked();
|
5490 + | let service = crate::service::RpcV2Protocol::builder::<
|
5491 + | ::aws_smithy_http_server::body::BoxBody,
|
5492 + | _,
|
5493 + | _,
|
5494 + | _,
|
5495 + | >(config)
|
5496 + | .no_input_output(move |input: crate::input::NoInputOutputInput| {
|
5497 + | let sender = sender.clone();
|
5498 + | async move {
|
5499 + | let result = {
|
5500 + | let expected = crate::input::NoInputOutputInput {};
|
5501 + | ::pretty_assertions::assert_eq!(input, expected);
|
5502 + | let output = crate::output::NoInputOutputOutput {};
|
5503 + | output
|
5504 + | };
|
5505 + | sender.send(()).await.expect("receiver dropped early");
|
5506 + | result
|
5507 + | }
|
5508 + | })
|
5509 + | .build_unchecked();
|
5259 5510 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5260 5511 | .await
|
5261 5512 | .expect("unable to make an HTTP request");
|
5262 5513 | assert!(
|
5263 5514 | receiver.recv().await.is_some(),
|
5264 5515 | "we expected operation handler to be invoked but it was not entered"
|
5265 5516 | );
|
5266 5517 | }
|
5267 5518 |
|
5268 5519 | /// A `Content-Type` header should not be set if the response body is empty.
|
5269 5520 | /// Test ID: no_output
|
5270 5521 | #[::tokio::test]
|
5271 5522 | #[::tracing_test::traced_test]
|
5272 5523 | async fn no_output_response() {
|
5273 5524 | let output = crate::output::NoInputOutputOutput {};
|
5274 5525 | use ::aws_smithy_http_server::response::IntoResponse;
|
5275 5526 | let http_response = output.into_response();
|
5276 5527 | ::pretty_assertions::assert_eq!(
|
5277 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
5528 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
5278 5529 | http_response.status()
|
5279 5530 | );
|
5280 5531 | let expected_headers = [("smithy-protocol", "rpc-v2-cbor")];
|
5281 5532 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5282 5533 | http_response.headers(),
|
5283 5534 | expected_headers,
|
5284 5535 | ));
|
5285 5536 | let forbidden_headers = &["Content-Type"];
|
5286 5537 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::forbid_headers(
|
5287 5538 | http_response.headers(),
|
5288 5539 | forbidden_headers,
|
5289 5540 | ));
|
5290 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5541 + | use ::http_body_util::BodyExt;
|
5542 + | let body = http_response
|
5543 + | .into_body()
|
5544 + | .collect()
|
5291 5545 | .await
|
5292 - | .expect("unable to extract body to bytes");
|
5546 + | .expect("unable to collect body")
|
5547 + | .to_bytes();
|
5293 5548 | // No body.
|
5294 5549 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
5295 5550 | }
|
5296 5551 | }
|