449 453 | #[cfg(test)]
|
450 454 | mod list_objects_v2_test {
|
451 455 |
|
452 456 | /// S3 clients should map the default addressing style to virtual host.
|
453 457 | /// Test ID: S3DefaultAddressing
|
454 458 | #[::tokio::test]
|
455 459 | #[::tracing_test::traced_test]
|
456 460 | #[should_panic]
|
457 461 | async fn s3_default_addressing_request() {
|
458 462 | #[allow(unused_mut)]
|
459 - | let mut http_request = http::Request::builder()
|
463 + | let mut http_request = ::http_1x::Request::builder()
|
460 464 | .uri("/")
|
461 465 | .method("GET")
|
462 - | .body(::aws_smithy_http_server::body::Body::from(
|
463 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
464 - | "".as_bytes(),
|
465 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
466 + | .body(::aws_smithy_http_server::body::boxed(
|
467 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
468 + | &::aws_smithy_protocol_test::decode_body_data(
|
469 + | "".as_bytes(),
|
470 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
471 + | ),
|
466 472 | )),
|
467 473 | ))
|
468 474 | .unwrap();
|
469 475 | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
470 476 | todo!("endpoint trait not supported yet");
|
471 477 | #[allow(unused_mut)]
|
472 478 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
473 479 | let config = crate::service::AmazonS3Config::builder().build();
|
474 - | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
480 + | let service =
|
481 + | crate::service::AmazonS3::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
482 + | config,
|
483 + | )
|
475 484 | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
476 485 | let sender = sender.clone();
|
477 486 | async move {
|
478 487 | let result = {
|
479 488 | let expected = crate::input::ListObjectsV2Input {
|
480 489 | bucket: "mybucket".to_owned(),
|
481 490 | delimiter: ::std::option::Option::None,
|
482 491 | encoding_type: ::std::option::Option::None,
|
483 492 | max_keys: ::std::option::Option::None,
|
484 493 | prefix: ::std::option::Option::None,
|
485 494 | continuation_token: ::std::option::Option::None,
|
486 495 | fetch_owner: ::std::option::Option::None,
|
487 496 | start_after: ::std::option::Option::None,
|
488 497 | request_payer: ::std::option::Option::None,
|
489 498 | expected_bucket_owner: ::std::option::Option::None,
|
490 499 | };
|
491 500 | ::pretty_assertions::assert_eq!(input, expected);
|
492 501 | let output = crate::output::ListObjectsV2Output {
|
493 502 | is_truncated: ::std::option::Option::None,
|
494 503 | contents: ::std::option::Option::None,
|
495 504 | name: ::std::option::Option::None,
|
496 505 | prefix: ::std::option::Option::None,
|
497 506 | delimiter: ::std::option::Option::None,
|
498 507 | max_keys: ::std::option::Option::None,
|
499 508 | common_prefixes: ::std::option::Option::None,
|
500 509 | encoding_type: ::std::option::Option::None,
|
501 510 | key_count: ::std::option::Option::None,
|
502 511 | continuation_token: ::std::option::Option::None,
|
503 512 | next_continuation_token: ::std::option::Option::None,
|
504 513 | start_after: ::std::option::Option::None,
|
505 514 | };
|
506 515 | Ok(output)
|
507 516 | };
|
508 517 | sender.send(()).await.expect("receiver dropped early");
|
509 518 | result
|
510 519 | }
|
511 520 | })
|
512 521 | .build_unchecked();
|
513 522 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
514 523 | .await
|
515 524 | .expect("unable to make an HTTP request");
|
516 525 | assert!(
|
517 526 | receiver.recv().await.is_some(),
|
518 527 | "we expected operation handler to be invoked but it was not entered"
|
519 528 | );
|
520 529 | }
|
521 530 |
|
522 531 | /// S3 clients should support the explicit virtual host addressing style.
|
523 532 | /// Test ID: S3VirtualHostAddressing
|
524 533 | #[::tokio::test]
|
525 534 | #[::tracing_test::traced_test]
|
526 535 | #[should_panic]
|
527 536 | async fn s3_virtual_host_addressing_request() {
|
528 537 | #[allow(unused_mut)]
|
529 - | let mut http_request = http::Request::builder()
|
538 + | let mut http_request = ::http_1x::Request::builder()
|
530 539 | .uri("/")
|
531 540 | .method("GET")
|
532 - | .body(::aws_smithy_http_server::body::Body::from(
|
533 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
534 - | "".as_bytes(),
|
535 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
541 + | .body(::aws_smithy_http_server::body::boxed(
|
542 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
543 + | &::aws_smithy_protocol_test::decode_body_data(
|
544 + | "".as_bytes(),
|
545 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
546 + | ),
|
536 547 | )),
|
537 548 | ))
|
538 549 | .unwrap();
|
539 550 | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
540 551 | todo!("endpoint trait not supported yet");
|
541 552 | #[allow(unused_mut)]
|
542 553 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
543 554 | let config = crate::service::AmazonS3Config::builder().build();
|
544 - | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
555 + | let service =
|
556 + | crate::service::AmazonS3::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
557 + | config,
|
558 + | )
|
545 559 | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
546 560 | let sender = sender.clone();
|
547 561 | async move {
|
548 562 | let result = {
|
549 563 | let expected = crate::input::ListObjectsV2Input {
|
550 564 | bucket: "mybucket".to_owned(),
|
551 565 | delimiter: ::std::option::Option::None,
|
552 566 | encoding_type: ::std::option::Option::None,
|
553 567 | max_keys: ::std::option::Option::None,
|
554 568 | prefix: ::std::option::Option::None,
|
555 569 | continuation_token: ::std::option::Option::None,
|
556 570 | fetch_owner: ::std::option::Option::None,
|
557 571 | start_after: ::std::option::Option::None,
|
558 572 | request_payer: ::std::option::Option::None,
|
559 573 | expected_bucket_owner: ::std::option::Option::None,
|
560 574 | };
|
561 575 | ::pretty_assertions::assert_eq!(input, expected);
|
562 576 | let output = crate::output::ListObjectsV2Output {
|
563 577 | is_truncated: ::std::option::Option::None,
|
564 578 | contents: ::std::option::Option::None,
|
565 579 | name: ::std::option::Option::None,
|
566 580 | prefix: ::std::option::Option::None,
|
567 581 | delimiter: ::std::option::Option::None,
|
568 582 | max_keys: ::std::option::Option::None,
|
569 583 | common_prefixes: ::std::option::Option::None,
|
570 584 | encoding_type: ::std::option::Option::None,
|
571 585 | key_count: ::std::option::Option::None,
|
572 586 | continuation_token: ::std::option::Option::None,
|
573 587 | next_continuation_token: ::std::option::Option::None,
|
574 588 | start_after: ::std::option::Option::None,
|
575 589 | };
|
576 590 | Ok(output)
|
577 591 | };
|
578 592 | sender.send(()).await.expect("receiver dropped early");
|
579 593 | result
|
580 594 | }
|
581 595 | })
|
582 596 | .build_unchecked();
|
583 597 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
584 598 | .await
|
585 599 | .expect("unable to make an HTTP request");
|
586 600 | assert!(
|
587 601 | receiver.recv().await.is_some(),
|
588 602 | "we expected operation handler to be invoked but it was not entered"
|
589 603 | );
|
590 604 | }
|
591 605 |
|
592 606 | /// S3 clients should support the explicit path addressing style.
|
593 607 | /// Test ID: S3PathAddressing
|
594 608 | #[::tokio::test]
|
595 609 | #[::tracing_test::traced_test]
|
596 610 | #[should_panic]
|
597 611 | async fn s3_path_addressing_request() {
|
598 612 | #[allow(unused_mut)]
|
599 - | let mut http_request = http::Request::builder()
|
613 + | let mut http_request = ::http_1x::Request::builder()
|
600 614 | .uri("/mybucket")
|
601 615 | .method("GET")
|
602 - | .body(::aws_smithy_http_server::body::Body::from(
|
603 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
604 - | "".as_bytes(),
|
605 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
616 + | .body(::aws_smithy_http_server::body::boxed(
|
617 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
618 + | &::aws_smithy_protocol_test::decode_body_data(
|
619 + | "".as_bytes(),
|
620 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
621 + | ),
|
606 622 | )),
|
607 623 | ))
|
608 624 | .unwrap();
|
609 625 | *http_request.uri_mut() = "/mybucket?list-type=2".parse().unwrap();
|
610 626 | todo!("endpoint trait not supported yet");
|
611 627 | #[allow(unused_mut)]
|
612 628 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
613 629 | let config = crate::service::AmazonS3Config::builder().build();
|
614 - | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
630 + | let service =
|
631 + | crate::service::AmazonS3::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
632 + | config,
|
633 + | )
|
615 634 | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
616 635 | let sender = sender.clone();
|
617 636 | async move {
|
618 637 | let result = {
|
619 638 | let expected = crate::input::ListObjectsV2Input {
|
620 639 | bucket: "mybucket".to_owned(),
|
621 640 | delimiter: ::std::option::Option::None,
|
622 641 | encoding_type: ::std::option::Option::None,
|
623 642 | max_keys: ::std::option::Option::None,
|
624 643 | prefix: ::std::option::Option::None,
|
625 644 | continuation_token: ::std::option::Option::None,
|
626 645 | fetch_owner: ::std::option::Option::None,
|
627 646 | start_after: ::std::option::Option::None,
|
628 647 | request_payer: ::std::option::Option::None,
|
629 648 | expected_bucket_owner: ::std::option::Option::None,
|
630 649 | };
|
631 650 | ::pretty_assertions::assert_eq!(input, expected);
|
632 651 | let output = crate::output::ListObjectsV2Output {
|
633 652 | is_truncated: ::std::option::Option::None,
|
634 653 | contents: ::std::option::Option::None,
|
635 654 | name: ::std::option::Option::None,
|
636 655 | prefix: ::std::option::Option::None,
|
637 656 | delimiter: ::std::option::Option::None,
|
638 657 | max_keys: ::std::option::Option::None,
|
639 658 | common_prefixes: ::std::option::Option::None,
|
640 659 | encoding_type: ::std::option::Option::None,
|
641 660 | key_count: ::std::option::Option::None,
|
642 661 | continuation_token: ::std::option::Option::None,
|
643 662 | next_continuation_token: ::std::option::Option::None,
|
644 663 | start_after: ::std::option::Option::None,
|
645 664 | };
|
646 665 | Ok(output)
|
647 666 | };
|
648 667 | sender.send(()).await.expect("receiver dropped early");
|
649 668 | result
|
650 669 | }
|
651 670 | })
|
652 671 | .build_unchecked();
|
653 672 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
654 673 | .await
|
655 674 | .expect("unable to make an HTTP request");
|
656 675 | assert!(
|
657 676 | receiver.recv().await.is_some(),
|
658 677 | "we expected operation handler to be invoked but it was not entered"
|
659 678 | );
|
660 679 | }
|
661 680 |
|
662 681 | /// S3 clients should support the explicit virtual host
|
663 682 | /// addressing style with Dualstack.
|
664 683 | /// Test ID: S3VirtualHostDualstackAddressing
|
665 684 | #[::tokio::test]
|
666 685 | #[::tracing_test::traced_test]
|
667 686 | #[should_panic]
|
668 687 | async fn s3_virtual_host_dualstack_addressing_request() {
|
669 688 | #[allow(unused_mut)]
|
670 - | let mut http_request = http::Request::builder()
|
689 + | let mut http_request = ::http_1x::Request::builder()
|
671 690 | .uri("/")
|
672 691 | .method("GET")
|
673 - | .body(::aws_smithy_http_server::body::Body::from(
|
674 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
675 - | "".as_bytes(),
|
676 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
692 + | .body(::aws_smithy_http_server::body::boxed(
|
693 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
694 + | &::aws_smithy_protocol_test::decode_body_data(
|
695 + | "".as_bytes(),
|
696 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
697 + | ),
|
677 698 | )),
|
678 699 | ))
|
679 700 | .unwrap();
|
680 701 | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
681 702 | todo!("endpoint trait not supported yet");
|
682 703 | #[allow(unused_mut)]
|
683 704 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
684 705 | let config = crate::service::AmazonS3Config::builder().build();
|
685 - | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
706 + | let service =
|
707 + | crate::service::AmazonS3::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
708 + | config,
|
709 + | )
|
686 710 | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
687 711 | let sender = sender.clone();
|
688 712 | async move {
|
689 713 | let result = {
|
690 714 | let expected = crate::input::ListObjectsV2Input {
|
691 715 | bucket: "mybucket".to_owned(),
|
692 716 | delimiter: ::std::option::Option::None,
|
693 717 | encoding_type: ::std::option::Option::None,
|
694 718 | max_keys: ::std::option::Option::None,
|
695 719 | prefix: ::std::option::Option::None,
|
696 720 | continuation_token: ::std::option::Option::None,
|
697 721 | fetch_owner: ::std::option::Option::None,
|
698 722 | start_after: ::std::option::Option::None,
|
699 723 | request_payer: ::std::option::Option::None,
|
700 724 | expected_bucket_owner: ::std::option::Option::None,
|
701 725 | };
|
702 726 | ::pretty_assertions::assert_eq!(input, expected);
|
703 727 | let output = crate::output::ListObjectsV2Output {
|
704 728 | is_truncated: ::std::option::Option::None,
|
705 729 | contents: ::std::option::Option::None,
|
706 730 | name: ::std::option::Option::None,
|
707 731 | prefix: ::std::option::Option::None,
|
708 732 | delimiter: ::std::option::Option::None,
|
709 733 | max_keys: ::std::option::Option::None,
|
710 734 | common_prefixes: ::std::option::Option::None,
|
711 735 | encoding_type: ::std::option::Option::None,
|
712 736 | key_count: ::std::option::Option::None,
|
713 737 | continuation_token: ::std::option::Option::None,
|
714 738 | next_continuation_token: ::std::option::Option::None,
|
715 739 | start_after: ::std::option::Option::None,
|
716 740 | };
|
717 741 | Ok(output)
|
718 742 | };
|
719 743 | sender.send(()).await.expect("receiver dropped early");
|
720 744 | result
|
721 745 | }
|
722 746 | })
|
723 747 | .build_unchecked();
|
724 748 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
725 749 | .await
|
726 750 | .expect("unable to make an HTTP request");
|
727 751 | assert!(
|
728 752 | receiver.recv().await.is_some(),
|
729 753 | "we expected operation handler to be invoked but it was not entered"
|
730 754 | );
|
731 755 | }
|
732 756 |
|
733 757 | /// S3 clients should support the explicit virtual host
|
734 758 | /// addressing style with S3 Accelerate.
|
735 759 | /// Test ID: S3VirtualHostAccelerateAddressing
|
736 760 | #[::tokio::test]
|
737 761 | #[::tracing_test::traced_test]
|
738 762 | #[should_panic]
|
739 763 | async fn s3_virtual_host_accelerate_addressing_request() {
|
740 764 | #[allow(unused_mut)]
|
741 - | let mut http_request = http::Request::builder()
|
765 + | let mut http_request = ::http_1x::Request::builder()
|
742 766 | .uri("/")
|
743 767 | .method("GET")
|
744 - | .body(::aws_smithy_http_server::body::Body::from(
|
745 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
746 - | "".as_bytes(),
|
747 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
768 + | .body(::aws_smithy_http_server::body::boxed(
|
769 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
770 + | &::aws_smithy_protocol_test::decode_body_data(
|
771 + | "".as_bytes(),
|
772 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
773 + | ),
|
748 774 | )),
|
749 775 | ))
|
750 776 | .unwrap();
|
751 777 | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
752 778 | todo!("endpoint trait not supported yet");
|
753 779 | #[allow(unused_mut)]
|
754 780 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
755 781 | let config = crate::service::AmazonS3Config::builder().build();
|
756 - | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
782 + | let service =
|
783 + | crate::service::AmazonS3::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
784 + | config,
|
785 + | )
|
757 786 | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
758 787 | let sender = sender.clone();
|
759 788 | async move {
|
760 789 | let result = {
|
761 790 | let expected = crate::input::ListObjectsV2Input {
|
762 791 | bucket: "mybucket".to_owned(),
|
763 792 | delimiter: ::std::option::Option::None,
|
764 793 | encoding_type: ::std::option::Option::None,
|
765 794 | max_keys: ::std::option::Option::None,
|
766 795 | prefix: ::std::option::Option::None,
|
767 796 | continuation_token: ::std::option::Option::None,
|
768 797 | fetch_owner: ::std::option::Option::None,
|
769 798 | start_after: ::std::option::Option::None,
|
770 799 | request_payer: ::std::option::Option::None,
|
771 800 | expected_bucket_owner: ::std::option::Option::None,
|
772 801 | };
|
773 802 | ::pretty_assertions::assert_eq!(input, expected);
|
774 803 | let output = crate::output::ListObjectsV2Output {
|
775 804 | is_truncated: ::std::option::Option::None,
|
776 805 | contents: ::std::option::Option::None,
|
777 806 | name: ::std::option::Option::None,
|
778 807 | prefix: ::std::option::Option::None,
|
779 808 | delimiter: ::std::option::Option::None,
|
780 809 | max_keys: ::std::option::Option::None,
|
781 810 | common_prefixes: ::std::option::Option::None,
|
782 811 | encoding_type: ::std::option::Option::None,
|
783 812 | key_count: ::std::option::Option::None,
|
784 813 | continuation_token: ::std::option::Option::None,
|
785 814 | next_continuation_token: ::std::option::Option::None,
|
786 815 | start_after: ::std::option::Option::None,
|
787 816 | };
|
788 817 | Ok(output)
|
789 818 | };
|
790 819 | sender.send(()).await.expect("receiver dropped early");
|
791 820 | result
|
792 821 | }
|
793 822 | })
|
794 823 | .build_unchecked();
|
795 824 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
796 825 | .await
|
797 826 | .expect("unable to make an HTTP request");
|
798 827 | assert!(
|
799 828 | receiver.recv().await.is_some(),
|
800 829 | "we expected operation handler to be invoked but it was not entered"
|
801 830 | );
|
802 831 | }
|
803 832 |
|
804 833 | /// S3 clients should support the explicit virtual host
|
805 834 | /// addressing style with Dualstack and S3 Accelerate.
|
806 835 | /// Test ID: S3VirtualHostDualstackAccelerateAddressing
|
807 836 | #[::tokio::test]
|
808 837 | #[::tracing_test::traced_test]
|
809 838 | #[should_panic]
|
810 839 | async fn s3_virtual_host_dualstack_accelerate_addressing_request() {
|
811 840 | #[allow(unused_mut)]
|
812 - | let mut http_request = http::Request::builder()
|
841 + | let mut http_request = ::http_1x::Request::builder()
|
813 842 | .uri("/")
|
814 843 | .method("GET")
|
815 - | .body(::aws_smithy_http_server::body::Body::from(
|
816 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
817 - | "".as_bytes(),
|
818 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
844 + | .body(::aws_smithy_http_server::body::boxed(
|
845 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
846 + | &::aws_smithy_protocol_test::decode_body_data(
|
847 + | "".as_bytes(),
|
848 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
849 + | ),
|
819 850 | )),
|
820 851 | ))
|
821 852 | .unwrap();
|
822 853 | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
823 854 | todo!("endpoint trait not supported yet");
|
824 855 | #[allow(unused_mut)]
|
825 856 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
826 857 | let config = crate::service::AmazonS3Config::builder().build();
|
827 - | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
858 + | let service =
|
859 + | crate::service::AmazonS3::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
860 + | config,
|
861 + | )
|
828 862 | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
829 863 | let sender = sender.clone();
|
830 864 | async move {
|
831 865 | let result = {
|
832 866 | let expected = crate::input::ListObjectsV2Input {
|
833 867 | bucket: "mybucket".to_owned(),
|
834 868 | delimiter: ::std::option::Option::None,
|
835 869 | encoding_type: ::std::option::Option::None,
|
836 870 | max_keys: ::std::option::Option::None,
|
837 871 | prefix: ::std::option::Option::None,
|
838 872 | continuation_token: ::std::option::Option::None,
|
839 873 | fetch_owner: ::std::option::Option::None,
|
840 874 | start_after: ::std::option::Option::None,
|
841 875 | request_payer: ::std::option::Option::None,
|
842 876 | expected_bucket_owner: ::std::option::Option::None,
|
843 877 | };
|
844 878 | ::pretty_assertions::assert_eq!(input, expected);
|
845 879 | let output = crate::output::ListObjectsV2Output {
|
846 880 | is_truncated: ::std::option::Option::None,
|
847 881 | contents: ::std::option::Option::None,
|
848 882 | name: ::std::option::Option::None,
|
849 883 | prefix: ::std::option::Option::None,
|
850 884 | delimiter: ::std::option::Option::None,
|
851 885 | max_keys: ::std::option::Option::None,
|
852 886 | common_prefixes: ::std::option::Option::None,
|
853 887 | encoding_type: ::std::option::Option::None,
|
854 888 | key_count: ::std::option::Option::None,
|
855 889 | continuation_token: ::std::option::Option::None,
|
856 890 | next_continuation_token: ::std::option::Option::None,
|
857 891 | start_after: ::std::option::Option::None,
|
858 892 | };
|
859 893 | Ok(output)
|
860 894 | };
|
861 895 | sender.send(()).await.expect("receiver dropped early");
|
862 896 | result
|
863 897 | }
|
864 898 | })
|
865 899 | .build_unchecked();
|
866 900 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
867 901 | .await
|
868 902 | .expect("unable to make an HTTP request");
|
869 903 | assert!(
|
870 904 | receiver.recv().await.is_some(),
|
871 905 | "we expected operation handler to be invoked but it was not entered"
|
872 906 | );
|
873 907 | }
|
874 908 |
|
875 909 | /// S3 clients should resolve to the addressing style of the
|
876 910 | /// operation if defined on both the client and operation.
|
877 911 | /// Test ID: S3OperationAddressingPreferred
|
878 912 | #[::tokio::test]
|
879 913 | #[::tracing_test::traced_test]
|
880 914 | #[should_panic]
|
881 915 | async fn s3_operation_addressing_preferred_request() {
|
882 916 | #[allow(unused_mut)]
|
883 - | let mut http_request = http::Request::builder()
|
917 + | let mut http_request = ::http_1x::Request::builder()
|
884 918 | .uri("/")
|
885 919 | .method("GET")
|
886 - | .body(::aws_smithy_http_server::body::Body::from(
|
887 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
888 - | "".as_bytes(),
|
889 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
920 + | .body(::aws_smithy_http_server::body::boxed(
|
921 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
922 + | &::aws_smithy_protocol_test::decode_body_data(
|
923 + | "".as_bytes(),
|
924 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
925 + | ),
|
890 926 | )),
|
891 927 | ))
|
892 928 | .unwrap();
|
893 929 | *http_request.uri_mut() = "/?list-type=2".parse().unwrap();
|
894 930 | todo!("endpoint trait not supported yet");
|
895 931 | #[allow(unused_mut)]
|
896 932 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
897 933 | let config = crate::service::AmazonS3Config::builder().build();
|
898 - | let service = crate::service::AmazonS3::builder::<::hyper::body::Body, _, _, _>(config)
|
934 + | let service =
|
935 + | crate::service::AmazonS3::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
936 + | config,
|
937 + | )
|
899 938 | .list_objects_v2(move |input: crate::input::ListObjectsV2Input| {
|
900 939 | let sender = sender.clone();
|
901 940 | async move {
|
902 941 | let result = {
|
903 942 | let expected = crate::input::ListObjectsV2Input {
|
904 943 | bucket: "mybucket".to_owned(),
|
905 944 | delimiter: ::std::option::Option::None,
|
906 945 | encoding_type: ::std::option::Option::None,
|
907 946 | max_keys: ::std::option::Option::None,
|
908 947 | prefix: ::std::option::Option::None,
|
909 948 | continuation_token: ::std::option::Option::None,
|
910 949 | fetch_owner: ::std::option::Option::None,
|
911 950 | start_after: ::std::option::Option::None,
|
912 951 | request_payer: ::std::option::Option::None,
|
913 952 | expected_bucket_owner: ::std::option::Option::None,
|
914 953 | };
|
915 954 | ::pretty_assertions::assert_eq!(input, expected);
|
916 955 | let output = crate::output::ListObjectsV2Output {
|
917 956 | is_truncated: ::std::option::Option::None,
|
918 957 | contents: ::std::option::Option::None,
|
919 958 | name: ::std::option::Option::None,
|
920 959 | prefix: ::std::option::Option::None,
|
921 960 | delimiter: ::std::option::Option::None,
|
922 961 | max_keys: ::std::option::Option::None,
|
923 962 | common_prefixes: ::std::option::Option::None,
|
924 963 | encoding_type: ::std::option::Option::None,
|
925 964 | key_count: ::std::option::Option::None,
|
926 965 | continuation_token: ::std::option::Option::None,
|
927 966 | next_continuation_token: ::std::option::Option::None,
|
928 967 | start_after: ::std::option::Option::None,
|
929 968 | };
|
930 969 | Ok(output)
|
931 970 | };
|
932 971 | sender.send(()).await.expect("receiver dropped early");
|
933 972 | result
|
934 973 | }
|
935 974 | })
|
936 975 | .build_unchecked();
|
937 976 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
938 977 | .await
|
939 978 | .expect("unable to make an HTTP request");
|
940 979 | assert!(
|
941 980 | receiver.recv().await.is_some(),
|
942 981 | "we expected operation handler to be invoked but it was not entered"
|
943 982 | );
|
944 983 | }
|
945 984 |
|
946 985 | /// S3 operations return Error XML nodes unwrapped by
|
947 986 | /// the ErrorResponse XML node.
|
948 987 | ///
|
949 988 | /// Test ID: S3OperationNoErrorWrappingResponse
|
950 989 | #[::tokio::test]
|
951 990 | #[::tracing_test::traced_test]
|
952 991 | #[should_panic]
|
953 992 | async fn s3_operation_no_error_wrapping_response_response() {
|
954 993 | let output = crate::error::NoSuchBucket {};
|
955 994 | let output = crate::error::ListObjectsV2Error::NoSuchBucket(output);
|
956 995 | use ::aws_smithy_http_server::response::IntoResponse;
|
957 996 | let http_response = output.into_response();
|
958 997 | ::pretty_assertions::assert_eq!(
|
959 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
998 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
960 999 | http_response.status()
|
961 1000 | );
|
962 1001 | let expected_headers = [("Content-Type", "application/xml")];
|
963 1002 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
964 1003 | http_response.headers(),
|
965 1004 | expected_headers,
|
966 1005 | ));
|
967 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1006 + | use ::http_body_util::BodyExt;
|
1007 + | let body = http_response
|
1008 + | .into_body()
|
1009 + | .collect()
|
968 1010 | .await
|
969 - | .expect("unable to extract body to bytes");
|
1011 + | .expect("unable to collect body")
|
1012 + | .to_bytes();
|
970 1013 | ::aws_smithy_protocol_test::assert_ok(
|
971 1014 | ::aws_smithy_protocol_test::validate_body(&body, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Error>\n\t<Type>Sender</Type>\n\t<Code>NoSuchBucket</Code>\n</Error>", ::aws_smithy_protocol_test::MediaType::from("application/xml"))
|
972 1015 | );
|
973 1016 | }
|
974 1017 | }
|