234 234 | mod query_maps_test {
|
235 235 |
|
236 236 | /// Serializes query maps
|
237 237 | /// Test ID: QuerySimpleQueryMaps
|
238 238 | #[::tokio::test]
|
239 239 | #[::tracing_test::traced_test]
|
240 240 | async fn query_simple_query_maps_request() {
|
241 241 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
242 242 | let config_builder = crate::config::Config::builder()
|
243 243 | .with_test_defaults()
|
244 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
244 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
245 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
246 + | .allow_no_auth()
|
245 247 | .endpoint_url("https://example.com");
|
246 248 |
|
247 249 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
248 250 | let result = client
|
249 251 | .query_maps()
|
250 252 | .set_map_arg(::std::option::Option::Some({
|
251 253 | let mut ret = ::std::collections::HashMap::new();
|
252 254 | ret.insert("bar".to_owned(), "Bar".to_owned());
|
253 255 | ret.insert("foo".to_owned(), "Foo".to_owned());
|
254 256 | ret
|
255 257 | }))
|
256 258 | .send()
|
257 259 | .await;
|
258 260 | let _ = dbg!(result);
|
259 261 | let http_request = request_receiver.expect_request();
|
260 262 | let expected_headers = [("Content-Type", "application/x-www-form-urlencoded")];
|
261 263 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
262 264 | let body = http_request.body().bytes().expect("body should be strict");
|
263 265 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
264 266 | body,
|
265 267 | "Action=QueryMaps&Version=2020-01-08&MapArg.entry.1.key=bar&MapArg.entry.1.value=Bar&MapArg.entry.2.key=foo&MapArg.entry.2.value=Foo",
|
266 268 | ::aws_smithy_protocol_test::MediaType::from("application/x-www-form-urlencoded"),
|
267 269 | ));
|
268 270 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
269 271 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
270 272 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
271 273 | }
|
272 274 |
|
273 275 | /// Serializes query maps and uses xmlName
|
274 276 | /// Test ID: QuerySimpleQueryMapsWithXmlName
|
275 277 | #[::tokio::test]
|
276 278 | #[::tracing_test::traced_test]
|
277 279 | async fn query_simple_query_maps_with_xml_name_request() {
|
278 280 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
279 281 | let config_builder = crate::config::Config::builder()
|
280 282 | .with_test_defaults()
|
281 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
283 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
284 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
285 + | .allow_no_auth()
|
282 286 | .endpoint_url("https://example.com");
|
283 287 |
|
284 288 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
285 289 | let result = client
|
286 290 | .query_maps()
|
287 291 | .set_renamed_map_arg(::std::option::Option::Some({
|
288 292 | let mut ret = ::std::collections::HashMap::new();
|
289 293 | ret.insert("foo".to_owned(), "Foo".to_owned());
|
290 294 | ret
|
291 295 | }))
|
292 296 | .send()
|
293 297 | .await;
|
294 298 | let _ = dbg!(result);
|
295 299 | let http_request = request_receiver.expect_request();
|
296 300 | let expected_headers = [("Content-Type", "application/x-www-form-urlencoded")];
|
297 301 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
298 302 | let body = http_request.body().bytes().expect("body should be strict");
|
299 303 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
300 304 | body,
|
301 305 | "Action=QueryMaps&Version=2020-01-08&Foo.entry.1.key=foo&Foo.entry.1.value=Foo",
|
302 306 | ::aws_smithy_protocol_test::MediaType::from("application/x-www-form-urlencoded"),
|
303 307 | ));
|
304 308 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
305 309 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
306 310 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
307 311 | }
|
308 312 |
|
309 313 | /// Serializes complex query maps
|
310 314 | /// Test ID: QueryComplexQueryMaps
|
311 315 | #[::tokio::test]
|
312 316 | #[::tracing_test::traced_test]
|
313 317 | async fn query_complex_query_maps_request() {
|
314 318 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
315 319 | let config_builder = crate::config::Config::builder()
|
316 320 | .with_test_defaults()
|
317 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
321 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
322 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
323 + | .allow_no_auth()
|
318 324 | .endpoint_url("https://example.com");
|
319 325 |
|
320 326 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
321 327 | let result = client
|
322 328 | .query_maps()
|
323 329 | .set_complex_map_arg(::std::option::Option::Some({
|
324 330 | let mut ret = ::std::collections::HashMap::new();
|
325 331 | ret.insert(
|
326 332 | "bar".to_owned(),
|
327 333 | crate::types::GreetingStruct::builder()
|
328 334 | .set_hi(::std::option::Option::Some("Bar".to_owned()))
|
329 335 | .build(),
|
330 336 | );
|
331 337 | ret.insert(
|
332 338 | "foo".to_owned(),
|
333 339 | crate::types::GreetingStruct::builder()
|
334 340 | .set_hi(::std::option::Option::Some("Foo".to_owned()))
|
335 341 | .build(),
|
336 342 | );
|
337 343 | ret
|
338 344 | }))
|
339 345 | .send()
|
340 346 | .await;
|
341 347 | let _ = dbg!(result);
|
342 348 | let http_request = request_receiver.expect_request();
|
343 349 | let expected_headers = [("Content-Type", "application/x-www-form-urlencoded")];
|
344 350 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
345 351 | let body = http_request.body().bytes().expect("body should be strict");
|
346 352 | ::aws_smithy_protocol_test::assert_ok(
|
347 353 | ::aws_smithy_protocol_test::validate_body(body, "Action=QueryMaps&Version=2020-01-08&ComplexMapArg.entry.1.key=bar&ComplexMapArg.entry.1.value.hi=Bar&ComplexMapArg.entry.2.key=foo&ComplexMapArg.entry.2.value.hi=Foo", ::aws_smithy_protocol_test::MediaType::from("application/x-www-form-urlencoded"))
|
348 354 | );
|
349 355 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
350 356 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
351 357 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
352 358 | }
|
353 359 |
|
354 360 | /// Does not serialize empty query maps
|
355 361 | /// Test ID: QueryEmptyQueryMaps
|
356 362 | #[::tokio::test]
|
357 363 | #[::tracing_test::traced_test]
|
358 364 | async fn query_empty_query_maps_request() {
|
359 365 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
360 366 | let config_builder = crate::config::Config::builder()
|
361 367 | .with_test_defaults()
|
362 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
368 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
369 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
370 + | .allow_no_auth()
|
363 371 | .endpoint_url("https://example.com");
|
364 372 |
|
365 373 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
366 374 | let result = client
|
367 375 | .query_maps()
|
368 376 | .set_map_arg(::std::option::Option::Some(::std::collections::HashMap::new()))
|
369 377 | .send()
|
370 378 | .await;
|
371 379 | let _ = dbg!(result);
|
372 380 | let http_request = request_receiver.expect_request();
|
373 381 | let expected_headers = [("Content-Type", "application/x-www-form-urlencoded")];
|
374 382 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
375 383 | let body = http_request.body().bytes().expect("body should be strict");
|
376 384 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
377 385 | body,
|
378 386 | "Action=QueryMaps&Version=2020-01-08",
|
379 387 | ::aws_smithy_protocol_test::MediaType::from("application/x-www-form-urlencoded"),
|
380 388 | ));
|
381 389 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
382 390 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
383 391 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
384 392 | }
|
385 393 |
|
386 394 | /// Serializes query maps where the member has an xmlName trait
|
387 395 | /// Test ID: QueryQueryMapWithMemberXmlName
|
388 396 | #[::tokio::test]
|
389 397 | #[::tracing_test::traced_test]
|
390 398 | async fn query_query_map_with_member_xml_name_request() {
|
391 399 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
392 400 | let config_builder = crate::config::Config::builder()
|
393 401 | .with_test_defaults()
|
394 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
402 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
403 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
404 + | .allow_no_auth()
|
395 405 | .endpoint_url("https://example.com");
|
396 406 |
|
397 407 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
398 408 | let result = client
|
399 409 | .query_maps()
|
400 410 | .set_map_with_xml_member_name(::std::option::Option::Some({
|
401 411 | let mut ret = ::std::collections::HashMap::new();
|
402 412 | ret.insert("bar".to_owned(), "Bar".to_owned());
|
403 413 | ret.insert("foo".to_owned(), "Foo".to_owned());
|
404 414 | ret
|
405 415 | }))
|
406 416 | .send()
|
407 417 | .await;
|
408 418 | let _ = dbg!(result);
|
409 419 | let http_request = request_receiver.expect_request();
|
410 420 | let expected_headers = [("Content-Type", "application/x-www-form-urlencoded")];
|
411 421 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
412 422 | let body = http_request.body().bytes().expect("body should be strict");
|
413 423 | ::aws_smithy_protocol_test::assert_ok(
|
414 424 | ::aws_smithy_protocol_test::validate_body(body, "Action=QueryMaps&Version=2020-01-08&MapWithXmlMemberName.entry.1.K=bar&MapWithXmlMemberName.entry.1.V=Bar&MapWithXmlMemberName.entry.2.K=foo&MapWithXmlMemberName.entry.2.V=Foo", ::aws_smithy_protocol_test::MediaType::from("application/x-www-form-urlencoded"))
|
415 425 | );
|
416 426 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
417 427 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
418 428 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
419 429 | }
|
420 430 |
|
421 431 | /// Serializes flattened query maps
|
422 432 | /// Test ID: QueryFlattenedQueryMaps
|
423 433 | #[::tokio::test]
|
424 434 | #[::tracing_test::traced_test]
|
425 435 | async fn query_flattened_query_maps_request() {
|
426 436 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
427 437 | let config_builder = crate::config::Config::builder()
|
428 438 | .with_test_defaults()
|
429 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
439 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
440 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
441 + | .allow_no_auth()
|
430 442 | .endpoint_url("https://example.com");
|
431 443 |
|
432 444 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
433 445 | let result = client
|
434 446 | .query_maps()
|
435 447 | .set_flattened_map(::std::option::Option::Some({
|
436 448 | let mut ret = ::std::collections::HashMap::new();
|
437 449 | ret.insert("bar".to_owned(), "Bar".to_owned());
|
438 450 | ret.insert("foo".to_owned(), "Foo".to_owned());
|
439 451 | ret
|
440 452 | }))
|
441 453 | .send()
|
442 454 | .await;
|
443 455 | let _ = dbg!(result);
|
444 456 | let http_request = request_receiver.expect_request();
|
445 457 | let expected_headers = [("Content-Type", "application/x-www-form-urlencoded")];
|
446 458 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
447 459 | let body = http_request.body().bytes().expect("body should be strict");
|
448 460 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
449 461 | body,
|
450 462 | "Action=QueryMaps&Version=2020-01-08&FlattenedMap.1.key=bar&FlattenedMap.1.value=Bar&FlattenedMap.2.key=foo&FlattenedMap.2.value=Foo",
|
451 463 | ::aws_smithy_protocol_test::MediaType::from("application/x-www-form-urlencoded"),
|
452 464 | ));
|
453 465 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
454 466 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
455 467 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
456 468 | }
|
457 469 |
|
458 470 | /// Serializes flattened query maps that use an xmlName
|
459 471 | /// Test ID: QueryFlattenedQueryMapsWithXmlName
|
460 472 | #[::tokio::test]
|
461 473 | #[::tracing_test::traced_test]
|
462 474 | async fn query_flattened_query_maps_with_xml_name_request() {
|
463 475 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
464 476 | let config_builder = crate::config::Config::builder()
|
465 477 | .with_test_defaults()
|
466 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
478 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
479 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
480 + | .allow_no_auth()
|
467 481 | .endpoint_url("https://example.com");
|
468 482 |
|
469 483 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
470 484 | let result = client
|
471 485 | .query_maps()
|
472 486 | .set_flattened_map_with_xml_name(::std::option::Option::Some({
|
473 487 | let mut ret = ::std::collections::HashMap::new();
|
474 488 | ret.insert("bar".to_owned(), "Bar".to_owned());
|
475 489 | ret.insert("foo".to_owned(), "Foo".to_owned());
|
476 490 | ret
|
477 491 | }))
|
478 492 | .send()
|
479 493 | .await;
|
480 494 | let _ = dbg!(result);
|
481 495 | let http_request = request_receiver.expect_request();
|
482 496 | let expected_headers = [("Content-Type", "application/x-www-form-urlencoded")];
|
483 497 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
484 498 | let body = http_request.body().bytes().expect("body should be strict");
|
485 499 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
486 500 | body,
|
487 501 | "Action=QueryMaps&Version=2020-01-08&Hi.1.K=bar&Hi.1.V=Bar&Hi.2.K=foo&Hi.2.V=Foo",
|
488 502 | ::aws_smithy_protocol_test::MediaType::from("application/x-www-form-urlencoded"),
|
489 503 | ));
|
490 504 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
491 505 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
492 506 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
493 507 | }
|
494 508 |
|
495 509 | /// Serializes query map of lists
|
496 510 | /// Test ID: QueryQueryMapOfLists
|
497 511 | #[::tokio::test]
|
498 512 | #[::tracing_test::traced_test]
|
499 513 | async fn query_query_map_of_lists_request() {
|
500 514 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
501 515 | let config_builder = crate::config::Config::builder()
|
502 516 | .with_test_defaults()
|
503 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
517 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
518 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
519 + | .allow_no_auth()
|
504 520 | .endpoint_url("https://example.com");
|
505 521 |
|
506 522 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
507 523 | let result = client
|
508 524 | .query_maps()
|
509 525 | .set_map_of_lists(::std::option::Option::Some({
|
510 526 | let mut ret = ::std::collections::HashMap::new();
|
511 527 | ret.insert("bar".to_owned(), vec!["C".to_owned(), "D".to_owned()]);
|
512 528 | ret.insert("foo".to_owned(), vec!["A".to_owned(), "B".to_owned()]);
|
513 529 | ret
|
514 530 | }))
|
515 531 | .send()
|
516 532 | .await;
|
517 533 | let _ = dbg!(result);
|
518 534 | let http_request = request_receiver.expect_request();
|
519 535 | let expected_headers = [("Content-Type", "application/x-www-form-urlencoded")];
|
520 536 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
521 537 | let body = http_request.body().bytes().expect("body should be strict");
|
522 538 | ::aws_smithy_protocol_test::assert_ok(
|
523 539 | ::aws_smithy_protocol_test::validate_body(body, "Action=QueryMaps&Version=2020-01-08&MapOfLists.entry.1.key=bar&MapOfLists.entry.1.value.member.1=C&MapOfLists.entry.1.value.member.2=D&MapOfLists.entry.2.key=foo&MapOfLists.entry.2.value.member.1=A&MapOfLists.entry.2.value.member.2=B", ::aws_smithy_protocol_test::MediaType::from("application/x-www-form-urlencoded"))
|
524 540 | );
|
525 541 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
526 542 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
527 543 | ::pretty_assertions::assert_eq!(uri.path(), "/", "path was incorrect");
|
528 544 | }
|
529 545 |
|
530 546 | /// Serializes nested struct with map member
|
531 547 | /// Test ID: QueryNestedStructWithMap
|
532 548 | #[::tokio::test]
|
533 549 | #[::tracing_test::traced_test]
|
534 550 | async fn query_nested_struct_with_map_request() {
|
535 551 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
536 552 | let config_builder = crate::config::Config::builder()
|
537 553 | .with_test_defaults()
|
538 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
554 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
555 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
556 + | .allow_no_auth()
|
539 557 | .endpoint_url("https://example.com");
|
540 558 |
|
541 559 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
542 560 | let result = client
|
543 561 | .query_maps()
|
544 562 | .set_nested_struct_with_map(::std::option::Option::Some(
|
545 563 | crate::types::NestedStructWithMap::builder()
|
546 564 | .set_map_arg(::std::option::Option::Some({
|
547 565 | let mut ret = ::std::collections::HashMap::new();
|
548 566 | ret.insert("bar".to_owned(), "Bar".to_owned());
|