480 492 |
|
481 493 | /// When a blob list contains non-unique values,
|
482 494 | /// the response should be a 400 ValidationException.
|
483 495 | /// Test ID: RestJsonMalformedUniqueItemsBlobList
|
484 496 | #[::tokio::test]
|
485 497 | #[::tracing_test::traced_test]
|
486 498 | #[should_panic]
|
487 499 | async fn rest_json_malformed_unique_items_blob_list_malformed_request() {
|
488 500 | {
|
489 501 | #[allow(unused_mut)]
|
490 - | let mut http_request = http::Request::builder()
|
502 + | let mut http_request = ::http_1x::Request::builder()
|
491 503 | .uri("/MalformedUniqueItems")
|
492 504 | .method("POST")
|
493 505 | .header("content-type", "application/json")
|
494 - | .body(::aws_smithy_http_server::body::Body::from(
|
495 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
496 - | "{ \"blobList\" : [\"YQ==\", \"YQ==\"] }".as_bytes(),
|
497 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
506 + | .body(::aws_smithy_http_server::body::boxed(
|
507 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
508 + | &::aws_smithy_protocol_test::decode_body_data(
|
509 + | "{ \"blobList\" : [\"YQ==\", \"YQ==\"] }".as_bytes(),
|
510 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
511 + | ),
|
498 512 | )),
|
499 513 | ))
|
500 514 | .unwrap();
|
501 515 | #[allow(unused_mut)]
|
502 516 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
503 517 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
504 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
518 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
505 519 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
506 520 | let sender = sender.clone();
|
507 521 | async move {
|
508 522 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
509 523 | sender.send(()).await.expect("receiver dropped early");
|
510 524 | result
|
511 525 | }
|
512 526 | })
|
513 527 | .build_unchecked();
|
514 528 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
515 529 | .await
|
516 530 | .expect("unable to make an HTTP request");
|
517 531 | ::pretty_assertions::assert_eq!(
|
518 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
532 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
519 533 | http_response.status()
|
520 534 | );
|
521 535 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
522 536 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
523 537 | http_response.headers(),
|
524 538 | expected_headers,
|
525 539 | ));
|
526 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
540 + | use ::http_body_util::BodyExt;
|
541 + | let body = http_response
|
542 + | .into_body()
|
543 + | .collect()
|
527 544 | .await
|
528 - | .expect("unable to extract body to bytes");
|
545 + | .expect("unable to collect body")
|
546 + | .to_bytes();
|
529 547 | ::aws_smithy_protocol_test::assert_ok(
|
530 548 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/blobList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/blobList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/blobList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
531 549 | );
|
532 550 | }
|
533 551 | }
|
534 552 |
|
535 553 | /// When a boolean list contains non-unique values,
|
536 554 | /// the response should be a 400 ValidationException.
|
537 555 | /// Test ID: RestJsonMalformedUniqueItemsBooleanList_case0
|
538 556 | #[::tokio::test]
|
539 557 | #[::tracing_test::traced_test]
|
540 558 | #[should_panic]
|
541 559 | async fn rest_json_malformed_unique_items_boolean_list_case0_malformed_request() {
|
542 560 | {
|
543 561 | #[allow(unused_mut)]
|
544 - | let mut http_request = http::Request::builder()
|
562 + | let mut http_request = ::http_1x::Request::builder()
|
545 563 | .uri("/MalformedUniqueItems")
|
546 564 | .method("POST")
|
547 565 | .header("content-type", "application/json")
|
548 - | .body(::aws_smithy_http_server::body::Body::from(
|
549 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
550 - | "{ \"booleanList\" : [true, true] }".as_bytes(),
|
551 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
566 + | .body(::aws_smithy_http_server::body::boxed(
|
567 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
568 + | &::aws_smithy_protocol_test::decode_body_data(
|
569 + | "{ \"booleanList\" : [true, true] }".as_bytes(),
|
570 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
571 + | ),
|
552 572 | )),
|
553 573 | ))
|
554 574 | .unwrap();
|
555 575 | #[allow(unused_mut)]
|
556 576 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
557 577 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
558 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
578 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
559 579 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
560 580 | let sender = sender.clone();
|
561 581 | async move {
|
562 582 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
563 583 | sender.send(()).await.expect("receiver dropped early");
|
564 584 | result
|
565 585 | }
|
566 586 | })
|
567 587 | .build_unchecked();
|
568 588 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
569 589 | .await
|
570 590 | .expect("unable to make an HTTP request");
|
571 591 | ::pretty_assertions::assert_eq!(
|
572 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
592 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
573 593 | http_response.status()
|
574 594 | );
|
575 595 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
576 596 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
577 597 | http_response.headers(),
|
578 598 | expected_headers,
|
579 599 | ));
|
580 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
600 + | use ::http_body_util::BodyExt;
|
601 + | let body = http_response
|
602 + | .into_body()
|
603 + | .collect()
|
581 604 | .await
|
582 - | .expect("unable to extract body to bytes");
|
605 + | .expect("unable to collect body")
|
606 + | .to_bytes();
|
583 607 | ::aws_smithy_protocol_test::assert_ok(
|
584 608 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/booleanList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/booleanList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/booleanList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
585 609 | );
|
586 610 | }
|
587 611 | }
|
588 612 |
|
589 613 | /// When a boolean list contains non-unique values,
|
590 614 | /// the response should be a 400 ValidationException.
|
591 615 | /// Test ID: RestJsonMalformedUniqueItemsBooleanList_case1
|
592 616 | #[::tokio::test]
|
593 617 | #[::tracing_test::traced_test]
|
594 618 | #[should_panic]
|
595 619 | async fn rest_json_malformed_unique_items_boolean_list_case1_malformed_request() {
|
596 620 | {
|
597 621 | #[allow(unused_mut)]
|
598 - | let mut http_request = http::Request::builder()
|
622 + | let mut http_request = ::http_1x::Request::builder()
|
599 623 | .uri("/MalformedUniqueItems")
|
600 624 | .method("POST")
|
601 625 | .header("content-type", "application/json")
|
602 - | .body(::aws_smithy_http_server::body::Body::from(
|
603 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
604 - | "{ \"booleanList\" : [false, false] }".as_bytes(),
|
605 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
626 + | .body(::aws_smithy_http_server::body::boxed(
|
627 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
628 + | &::aws_smithy_protocol_test::decode_body_data(
|
629 + | "{ \"booleanList\" : [false, false] }".as_bytes(),
|
630 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
631 + | ),
|
606 632 | )),
|
607 633 | ))
|
608 634 | .unwrap();
|
609 635 | #[allow(unused_mut)]
|
610 636 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
611 637 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
612 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
638 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
613 639 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
614 640 | let sender = sender.clone();
|
615 641 | async move {
|
616 642 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
617 643 | sender.send(()).await.expect("receiver dropped early");
|
618 644 | result
|
619 645 | }
|
620 646 | })
|
621 647 | .build_unchecked();
|
622 648 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
623 649 | .await
|
624 650 | .expect("unable to make an HTTP request");
|
625 651 | ::pretty_assertions::assert_eq!(
|
626 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
652 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
627 653 | http_response.status()
|
628 654 | );
|
629 655 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
630 656 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
631 657 | http_response.headers(),
|
632 658 | expected_headers,
|
633 659 | ));
|
634 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
660 + | use ::http_body_util::BodyExt;
|
661 + | let body = http_response
|
662 + | .into_body()
|
663 + | .collect()
|
635 664 | .await
|
636 - | .expect("unable to extract body to bytes");
|
665 + | .expect("unable to collect body")
|
666 + | .to_bytes();
|
637 667 | ::aws_smithy_protocol_test::assert_ok(
|
638 668 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/booleanList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/booleanList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/booleanList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
639 669 | );
|
640 670 | }
|
641 671 | }
|
642 672 |
|
643 673 | /// When a string list contains non-unique values,
|
644 674 | /// the response should be a 400 ValidationException.
|
645 675 | /// Test ID: RestJsonMalformedUniqueItemsStringList
|
646 676 | #[::tokio::test]
|
647 677 | #[::tracing_test::traced_test]
|
648 678 | #[should_panic]
|
649 679 | async fn rest_json_malformed_unique_items_string_list_malformed_request() {
|
650 680 | {
|
651 681 | #[allow(unused_mut)]
|
652 - | let mut http_request = http::Request::builder()
|
682 + | let mut http_request = ::http_1x::Request::builder()
|
653 683 | .uri("/MalformedUniqueItems")
|
654 684 | .method("POST")
|
655 685 | .header("content-type", "application/json")
|
656 - | .body(::aws_smithy_http_server::body::Body::from(
|
657 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
658 - | "{ \"stringList\" : [\"abc\", \"abc\"] }".as_bytes(),
|
659 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
686 + | .body(::aws_smithy_http_server::body::boxed(
|
687 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
688 + | &::aws_smithy_protocol_test::decode_body_data(
|
689 + | "{ \"stringList\" : [\"abc\", \"abc\"] }".as_bytes(),
|
690 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
691 + | ),
|
660 692 | )),
|
661 693 | ))
|
662 694 | .unwrap();
|
663 695 | #[allow(unused_mut)]
|
664 696 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
665 697 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
666 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
698 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
667 699 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
668 700 | let sender = sender.clone();
|
669 701 | async move {
|
670 702 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
671 703 | sender.send(()).await.expect("receiver dropped early");
|
672 704 | result
|
673 705 | }
|
674 706 | })
|
675 707 | .build_unchecked();
|
676 708 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
677 709 | .await
|
678 710 | .expect("unable to make an HTTP request");
|
679 711 | ::pretty_assertions::assert_eq!(
|
680 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
712 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
681 713 | http_response.status()
|
682 714 | );
|
683 715 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
684 716 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
685 717 | http_response.headers(),
|
686 718 | expected_headers,
|
687 719 | ));
|
688 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
720 + | use ::http_body_util::BodyExt;
|
721 + | let body = http_response
|
722 + | .into_body()
|
723 + | .collect()
|
689 724 | .await
|
690 - | .expect("unable to extract body to bytes");
|
725 + | .expect("unable to collect body")
|
726 + | .to_bytes();
|
691 727 | ::aws_smithy_protocol_test::assert_ok(
|
692 728 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/stringList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/stringList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/stringList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
693 729 | );
|
694 730 | }
|
695 731 | }
|
696 732 |
|
697 733 | /// When a byte list contains non-unique values,
|
698 734 | /// the response should be a 400 ValidationException.
|
699 735 | /// Test ID: RestJsonMalformedUniqueItemsByteList
|
700 736 | #[::tokio::test]
|
701 737 | #[::tracing_test::traced_test]
|
702 738 | #[should_panic]
|
703 739 | async fn rest_json_malformed_unique_items_byte_list_malformed_request() {
|
704 740 | {
|
705 741 | #[allow(unused_mut)]
|
706 - | let mut http_request = http::Request::builder()
|
742 + | let mut http_request = ::http_1x::Request::builder()
|
707 743 | .uri("/MalformedUniqueItems")
|
708 744 | .method("POST")
|
709 745 | .header("content-type", "application/json")
|
710 - | .body(::aws_smithy_http_server::body::Body::from(
|
711 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
712 - | "{ \"byteList\" : [1, 1] }".as_bytes(),
|
713 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
746 + | .body(::aws_smithy_http_server::body::boxed(
|
747 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
748 + | &::aws_smithy_protocol_test::decode_body_data(
|
749 + | "{ \"byteList\" : [1, 1] }".as_bytes(),
|
750 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
751 + | ),
|
714 752 | )),
|
715 753 | ))
|
716 754 | .unwrap();
|
717 755 | #[allow(unused_mut)]
|
718 756 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
719 757 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
720 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
758 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
721 759 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
722 760 | let sender = sender.clone();
|
723 761 | async move {
|
724 762 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
725 763 | sender.send(()).await.expect("receiver dropped early");
|
726 764 | result
|
727 765 | }
|
728 766 | })
|
729 767 | .build_unchecked();
|
730 768 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
731 769 | .await
|
732 770 | .expect("unable to make an HTTP request");
|
733 771 | ::pretty_assertions::assert_eq!(
|
734 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
772 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
735 773 | http_response.status()
|
736 774 | );
|
737 775 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
738 776 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
739 777 | http_response.headers(),
|
740 778 | expected_headers,
|
741 779 | ));
|
742 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
780 + | use ::http_body_util::BodyExt;
|
781 + | let body = http_response
|
782 + | .into_body()
|
783 + | .collect()
|
743 784 | .await
|
744 - | .expect("unable to extract body to bytes");
|
785 + | .expect("unable to collect body")
|
786 + | .to_bytes();
|
745 787 | ::aws_smithy_protocol_test::assert_ok(
|
746 788 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/byteList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/byteList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/byteList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
747 789 | );
|
748 790 | }
|
749 791 | }
|
750 792 |
|
751 793 | /// When a short list contains non-unique values,
|
752 794 | /// the response should be a 400 ValidationException.
|
753 795 | /// Test ID: RestJsonMalformedUniqueItemsShortList
|
754 796 | #[::tokio::test]
|
755 797 | #[::tracing_test::traced_test]
|
756 798 | #[should_panic]
|
757 799 | async fn rest_json_malformed_unique_items_short_list_malformed_request() {
|
758 800 | {
|
759 801 | #[allow(unused_mut)]
|
760 - | let mut http_request = http::Request::builder()
|
802 + | let mut http_request = ::http_1x::Request::builder()
|
761 803 | .uri("/MalformedUniqueItems")
|
762 804 | .method("POST")
|
763 805 | .header("content-type", "application/json")
|
764 - | .body(::aws_smithy_http_server::body::Body::from(
|
765 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
766 - | "{ \"shortList\" : [2, 2] }".as_bytes(),
|
767 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
806 + | .body(::aws_smithy_http_server::body::boxed(
|
807 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
808 + | &::aws_smithy_protocol_test::decode_body_data(
|
809 + | "{ \"shortList\" : [2, 2] }".as_bytes(),
|
810 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
811 + | ),
|
768 812 | )),
|
769 813 | ))
|
770 814 | .unwrap();
|
771 815 | #[allow(unused_mut)]
|
772 816 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
773 817 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
774 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
818 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
775 819 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
776 820 | let sender = sender.clone();
|
777 821 | async move {
|
778 822 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
779 823 | sender.send(()).await.expect("receiver dropped early");
|
780 824 | result
|
781 825 | }
|
782 826 | })
|
783 827 | .build_unchecked();
|
784 828 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
785 829 | .await
|
786 830 | .expect("unable to make an HTTP request");
|
787 831 | ::pretty_assertions::assert_eq!(
|
788 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
832 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
789 833 | http_response.status()
|
790 834 | );
|
791 835 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
792 836 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
793 837 | http_response.headers(),
|
794 838 | expected_headers,
|
795 839 | ));
|
796 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
840 + | use ::http_body_util::BodyExt;
|
841 + | let body = http_response
|
842 + | .into_body()
|
843 + | .collect()
|
797 844 | .await
|
798 - | .expect("unable to extract body to bytes");
|
845 + | .expect("unable to collect body")
|
846 + | .to_bytes();
|
799 847 | ::aws_smithy_protocol_test::assert_ok(
|
800 848 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/shortList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/shortList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/shortList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
801 849 | );
|
802 850 | }
|
803 851 | }
|
804 852 |
|
805 853 | /// When an integer list contains non-unique values,
|
806 854 | /// the response should be a 400 ValidationException.
|
807 855 | /// Test ID: RestJsonMalformedUniqueItemsIntegerList
|
808 856 | #[::tokio::test]
|
809 857 | #[::tracing_test::traced_test]
|
810 858 | #[should_panic]
|
811 859 | async fn rest_json_malformed_unique_items_integer_list_malformed_request() {
|
812 860 | {
|
813 861 | #[allow(unused_mut)]
|
814 - | let mut http_request = http::Request::builder()
|
862 + | let mut http_request = ::http_1x::Request::builder()
|
815 863 | .uri("/MalformedUniqueItems")
|
816 864 | .method("POST")
|
817 865 | .header("content-type", "application/json")
|
818 - | .body(::aws_smithy_http_server::body::Body::from(
|
819 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
820 - | "{ \"integerList\" : [3, 3] }".as_bytes(),
|
821 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
866 + | .body(::aws_smithy_http_server::body::boxed(
|
867 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
868 + | &::aws_smithy_protocol_test::decode_body_data(
|
869 + | "{ \"integerList\" : [3, 3] }".as_bytes(),
|
870 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
871 + | ),
|
822 872 | )),
|
823 873 | ))
|
824 874 | .unwrap();
|
825 875 | #[allow(unused_mut)]
|
826 876 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
827 877 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
828 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
878 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
829 879 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
830 880 | let sender = sender.clone();
|
831 881 | async move {
|
832 882 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
833 883 | sender.send(()).await.expect("receiver dropped early");
|
834 884 | result
|
835 885 | }
|
836 886 | })
|
837 887 | .build_unchecked();
|
838 888 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
839 889 | .await
|
840 890 | .expect("unable to make an HTTP request");
|
841 891 | ::pretty_assertions::assert_eq!(
|
842 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
892 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
843 893 | http_response.status()
|
844 894 | );
|
845 895 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
846 896 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
847 897 | http_response.headers(),
|
848 898 | expected_headers,
|
849 899 | ));
|
850 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
900 + | use ::http_body_util::BodyExt;
|
901 + | let body = http_response
|
902 + | .into_body()
|
903 + | .collect()
|
851 904 | .await
|
852 - | .expect("unable to extract body to bytes");
|
905 + | .expect("unable to collect body")
|
906 + | .to_bytes();
|
853 907 | ::aws_smithy_protocol_test::assert_ok(
|
854 908 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/integerList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/integerList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/integerList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
855 909 | );
|
856 910 | }
|
857 911 | }
|
858 912 |
|
859 913 | /// When an integer list contains non-unique values,
|
860 914 | /// the response should be a 400 ValidationException.
|
861 915 | /// Test ID: RestJsonMalformedUniqueItemsLongList
|
862 916 | #[::tokio::test]
|
863 917 | #[::tracing_test::traced_test]
|
864 918 | #[should_panic]
|
865 919 | async fn rest_json_malformed_unique_items_long_list_malformed_request() {
|
866 920 | {
|
867 921 | #[allow(unused_mut)]
|
868 - | let mut http_request = http::Request::builder()
|
922 + | let mut http_request = ::http_1x::Request::builder()
|
869 923 | .uri("/MalformedUniqueItems")
|
870 924 | .method("POST")
|
871 925 | .header("content-type", "application/json")
|
872 - | .body(::aws_smithy_http_server::body::Body::from(
|
873 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
874 - | "{ \"longList\" : [4, 4] }".as_bytes(),
|
875 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
926 + | .body(::aws_smithy_http_server::body::boxed(
|
927 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
928 + | &::aws_smithy_protocol_test::decode_body_data(
|
929 + | "{ \"longList\" : [4, 4] }".as_bytes(),
|
930 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
931 + | ),
|
876 932 | )),
|
877 933 | ))
|
878 934 | .unwrap();
|
879 935 | #[allow(unused_mut)]
|
880 936 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
881 937 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
882 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
938 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
883 939 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
884 940 | let sender = sender.clone();
|
885 941 | async move {
|
886 942 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
887 943 | sender.send(()).await.expect("receiver dropped early");
|
888 944 | result
|
889 945 | }
|
890 946 | })
|
891 947 | .build_unchecked();
|
892 948 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
893 949 | .await
|
894 950 | .expect("unable to make an HTTP request");
|
895 951 | ::pretty_assertions::assert_eq!(
|
896 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
952 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
897 953 | http_response.status()
|
898 954 | );
|
899 955 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
900 956 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
901 957 | http_response.headers(),
|
902 958 | expected_headers,
|
903 959 | ));
|
904 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
960 + | use ::http_body_util::BodyExt;
|
961 + | let body = http_response
|
962 + | .into_body()
|
963 + | .collect()
|
905 964 | .await
|
906 - | .expect("unable to extract body to bytes");
|
965 + | .expect("unable to collect body")
|
966 + | .to_bytes();
|
907 967 | ::aws_smithy_protocol_test::assert_ok(
|
908 968 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/longList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/longList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/longList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
909 969 | );
|
910 970 | }
|
911 971 | }
|
912 972 |
|
913 973 | /// When a timestamp list contains non-unique values,
|
914 974 | /// the response should be a 400 ValidationException.
|
915 975 | /// Test ID: RestJsonMalformedUniqueItemsTimestampList
|
916 976 | #[::tokio::test]
|
917 977 | #[::tracing_test::traced_test]
|
918 978 | #[should_panic]
|
919 979 | async fn rest_json_malformed_unique_items_timestamp_list_malformed_request() {
|
920 980 | {
|
921 981 | #[allow(unused_mut)]
|
922 - | let mut http_request = http::Request::builder()
|
982 + | let mut http_request = ::http_1x::Request::builder()
|
923 983 | .uri("/MalformedUniqueItems")
|
924 984 | .method("POST")
|
925 985 | .header("content-type", "application/json")
|
926 - | .body(::aws_smithy_http_server::body::Body::from(
|
927 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
928 - | "{ \"timestampList\" : [1676660607, 1676660607] }".as_bytes(),
|
929 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
986 + | .body(::aws_smithy_http_server::body::boxed(
|
987 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
988 + | &::aws_smithy_protocol_test::decode_body_data(
|
989 + | "{ \"timestampList\" : [1676660607, 1676660607] }".as_bytes(),
|
990 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
991 + | ),
|
930 992 | )),
|
931 993 | ))
|
932 994 | .unwrap();
|
933 995 | #[allow(unused_mut)]
|
934 996 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
935 997 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
936 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
998 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
937 999 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
938 1000 | let sender = sender.clone();
|
939 1001 | async move {
|
940 1002 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
941 1003 | sender.send(()).await.expect("receiver dropped early");
|
942 1004 | result
|
943 1005 | }
|
944 1006 | })
|
945 1007 | .build_unchecked();
|
946 1008 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
947 1009 | .await
|
948 1010 | .expect("unable to make an HTTP request");
|
949 1011 | ::pretty_assertions::assert_eq!(
|
950 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1012 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
951 1013 | http_response.status()
|
952 1014 | );
|
953 1015 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
954 1016 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
955 1017 | http_response.headers(),
|
956 1018 | expected_headers,
|
957 1019 | ));
|
958 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1020 + | use ::http_body_util::BodyExt;
|
1021 + | let body = http_response
|
1022 + | .into_body()
|
1023 + | .collect()
|
959 1024 | .await
|
960 - | .expect("unable to extract body to bytes");
|
1025 + | .expect("unable to collect body")
|
1026 + | .to_bytes();
|
961 1027 | ::aws_smithy_protocol_test::assert_ok(
|
962 1028 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/timestampList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/timestampList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/timestampList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
963 1029 | );
|
964 1030 | }
|
965 1031 | }
|
966 1032 |
|
967 1033 | /// When a date-time timestamp list contains non-unique values,
|
968 1034 | /// the response should be a 400 ValidationException.
|
969 1035 | /// Test ID: RestJsonMalformedUniqueItemsDateTimeList
|
970 1036 | #[::tokio::test]
|
971 1037 | #[::tracing_test::traced_test]
|
972 1038 | #[should_panic]
|
973 1039 | async fn rest_json_malformed_unique_items_date_time_list_malformed_request() {
|
974 1040 | {
|
975 1041 | #[allow(unused_mut)]
|
976 - | let mut http_request = http::Request::builder()
|
1042 + | let mut http_request = ::http_1x::Request::builder()
|
977 1043 | .uri("/MalformedUniqueItems")
|
978 1044 | .method("POST")
|
979 1045 | .header("content-type", "application/json")
|
980 - | .body(::aws_smithy_http_server::body::Body::from(
|
981 - | ::bytes::Bytes::copy_from_slice(
|
982 - | &::aws_smithy_protocol_test::decode_body_data("{ \"dateTimeList\" : [\"1985-04-12T23:20:50.52Z\", \"1985-04-12T23:20:50.52Z\"] }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
983 - | )
|
984 - | )).unwrap();
|
1046 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
1047 + | ::bytes::Bytes::copy_from_slice(
|
1048 + | &::aws_smithy_protocol_test::decode_body_data("{ \"dateTimeList\" : [\"1985-04-12T23:20:50.52Z\", \"1985-04-12T23:20:50.52Z\"] }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
1049 + | )
|
1050 + | ))).unwrap();
|
985 1051 | #[allow(unused_mut)]
|
986 1052 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
987 1053 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
988 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1054 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
989 1055 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
990 1056 | let sender = sender.clone();
|
991 1057 | async move {
|
992 1058 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
993 1059 | sender.send(()).await.expect("receiver dropped early");
|
994 1060 | result
|
995 1061 | }
|
996 1062 | })
|
997 1063 | .build_unchecked();
|
998 1064 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
999 1065 | .await
|
1000 1066 | .expect("unable to make an HTTP request");
|
1001 1067 | ::pretty_assertions::assert_eq!(
|
1002 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1068 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1003 1069 | http_response.status()
|
1004 1070 | );
|
1005 1071 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1006 1072 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1007 1073 | http_response.headers(),
|
1008 1074 | expected_headers,
|
1009 1075 | ));
|
1010 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1076 + | use ::http_body_util::BodyExt;
|
1077 + | let body = http_response
|
1078 + | .into_body()
|
1079 + | .collect()
|
1011 1080 | .await
|
1012 - | .expect("unable to extract body to bytes");
|
1081 + | .expect("unable to collect body")
|
1082 + | .to_bytes();
|
1013 1083 | ::aws_smithy_protocol_test::assert_ok(
|
1014 1084 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/dateTimeList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/dateTimeList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/dateTimeList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1015 1085 | );
|
1016 1086 | }
|
1017 1087 | }
|
1018 1088 |
|
1019 1089 | /// When a http-date timestamp list contains non-unique values,
|
1020 1090 | /// the response should be a 400 ValidationException.
|
1021 1091 | /// Test ID: RestJsonMalformedUniqueItemsHttpDateList_case0
|
1022 1092 | #[::tokio::test]
|
1023 1093 | #[::tracing_test::traced_test]
|
1024 1094 | #[should_panic]
|
1025 1095 | async fn rest_json_malformed_unique_items_http_date_list_case0_malformed_request() {
|
1026 1096 | {
|
1027 1097 | #[allow(unused_mut)]
|
1028 - | let mut http_request = http::Request::builder()
|
1098 + | let mut http_request = ::http_1x::Request::builder()
|
1029 1099 | .uri("/MalformedUniqueItems")
|
1030 1100 | .method("POST")
|
1031 1101 | .header("content-type", "application/json")
|
1032 - | .body(::aws_smithy_http_server::body::Body::from(
|
1033 - | ::bytes::Bytes::copy_from_slice(
|
1034 - | &::aws_smithy_protocol_test::decode_body_data("{ \"httpDateList\" : [\"Tue, 29 Apr 2014 18:30:38 GMT\", \"Tue, 29 Apr 2014 18:30:38 GMT\"] }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
1035 - | )
|
1036 - | )).unwrap();
|
1102 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
1103 + | ::bytes::Bytes::copy_from_slice(
|
1104 + | &::aws_smithy_protocol_test::decode_body_data("{ \"httpDateList\" : [\"Tue, 29 Apr 2014 18:30:38 GMT\", \"Tue, 29 Apr 2014 18:30:38 GMT\"] }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
1105 + | )
|
1106 + | ))).unwrap();
|
1037 1107 | #[allow(unused_mut)]
|
1038 1108 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1039 1109 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1040 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1110 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
1041 1111 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1042 1112 | let sender = sender.clone();
|
1043 1113 | async move {
|
1044 1114 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
1045 1115 | sender.send(()).await.expect("receiver dropped early");
|
1046 1116 | result
|
1047 1117 | }
|
1048 1118 | })
|
1049 1119 | .build_unchecked();
|
1050 1120 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1051 1121 | .await
|
1052 1122 | .expect("unable to make an HTTP request");
|
1053 1123 | ::pretty_assertions::assert_eq!(
|
1054 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1124 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1055 1125 | http_response.status()
|
1056 1126 | );
|
1057 1127 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1058 1128 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1059 1129 | http_response.headers(),
|
1060 1130 | expected_headers,
|
1061 1131 | ));
|
1062 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1132 + | use ::http_body_util::BodyExt;
|
1133 + | let body = http_response
|
1134 + | .into_body()
|
1135 + | .collect()
|
1063 1136 | .await
|
1064 - | .expect("unable to extract body to bytes");
|
1137 + | .expect("unable to collect body")
|
1138 + | .to_bytes();
|
1065 1139 | ::aws_smithy_protocol_test::assert_ok(
|
1066 1140 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/httpDateList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/httpDateList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/httpDateList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1067 1141 | );
|
1068 1142 | }
|
1069 1143 | }
|
1070 1144 |
|
1071 1145 | /// When an enum list contains non-unique values,
|
1072 1146 | /// the response should be a 400 ValidationException.
|
1073 1147 | /// Test ID: RestJsonMalformedUniqueItemsEnumList
|
1074 1148 | #[::tokio::test]
|
1075 1149 | #[::tracing_test::traced_test]
|
1076 1150 | #[should_panic]
|
1077 1151 | async fn rest_json_malformed_unique_items_enum_list_malformed_request() {
|
1078 1152 | {
|
1079 1153 | #[allow(unused_mut)]
|
1080 - | let mut http_request = http::Request::builder()
|
1154 + | let mut http_request = ::http_1x::Request::builder()
|
1081 1155 | .uri("/MalformedUniqueItems")
|
1082 1156 | .method("POST")
|
1083 1157 | .header("content-type", "application/json")
|
1084 - | .body(::aws_smithy_http_server::body::Body::from(
|
1085 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1086 - | "{ \"enumList\" : [\"Foo\", \"Foo\"] }".as_bytes(),
|
1087 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1158 + | .body(::aws_smithy_http_server::body::boxed(
|
1159 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1160 + | &::aws_smithy_protocol_test::decode_body_data(
|
1161 + | "{ \"enumList\" : [\"Foo\", \"Foo\"] }".as_bytes(),
|
1162 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1163 + | ),
|
1088 1164 | )),
|
1089 1165 | ))
|
1090 1166 | .unwrap();
|
1091 1167 | #[allow(unused_mut)]
|
1092 1168 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1093 1169 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1094 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1170 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
1095 1171 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1096 1172 | let sender = sender.clone();
|
1097 1173 | async move {
|
1098 1174 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
1099 1175 | sender.send(()).await.expect("receiver dropped early");
|
1100 1176 | result
|
1101 1177 | }
|
1102 1178 | })
|
1103 1179 | .build_unchecked();
|
1104 1180 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1105 1181 | .await
|
1106 1182 | .expect("unable to make an HTTP request");
|
1107 1183 | ::pretty_assertions::assert_eq!(
|
1108 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1184 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1109 1185 | http_response.status()
|
1110 1186 | );
|
1111 1187 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1112 1188 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1113 1189 | http_response.headers(),
|
1114 1190 | expected_headers,
|
1115 1191 | ));
|
1116 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1192 + | use ::http_body_util::BodyExt;
|
1193 + | let body = http_response
|
1194 + | .into_body()
|
1195 + | .collect()
|
1117 1196 | .await
|
1118 - | .expect("unable to extract body to bytes");
|
1197 + | .expect("unable to collect body")
|
1198 + | .to_bytes();
|
1119 1199 | ::aws_smithy_protocol_test::assert_ok(
|
1120 1200 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/enumList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/enumList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/enumList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1121 1201 | );
|
1122 1202 | }
|
1123 1203 | }
|
1124 1204 |
|
1125 1205 | /// When an intEnum list contains non-unique values,
|
1126 1206 | /// the response should be a 400 ValidationException.
|
1127 1207 | /// Test ID: RestJsonMalformedUniqueItemsIntEnumList
|
1128 1208 | #[::tokio::test]
|
1129 1209 | #[::tracing_test::traced_test]
|
1130 1210 | #[should_panic]
|
1131 1211 | async fn rest_json_malformed_unique_items_int_enum_list_malformed_request() {
|
1132 1212 | {
|
1133 1213 | #[allow(unused_mut)]
|
1134 - | let mut http_request = http::Request::builder()
|
1214 + | let mut http_request = ::http_1x::Request::builder()
|
1135 1215 | .uri("/MalformedUniqueItems")
|
1136 1216 | .method("POST")
|
1137 1217 | .header("content-type", "application/json")
|
1138 - | .body(::aws_smithy_http_server::body::Body::from(
|
1139 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1140 - | "{ \"intEnumList\" : [3, 3] }".as_bytes(),
|
1141 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1218 + | .body(::aws_smithy_http_server::body::boxed(
|
1219 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1220 + | &::aws_smithy_protocol_test::decode_body_data(
|
1221 + | "{ \"intEnumList\" : [3, 3] }".as_bytes(),
|
1222 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1223 + | ),
|
1142 1224 | )),
|
1143 1225 | ))
|
1144 1226 | .unwrap();
|
1145 1227 | #[allow(unused_mut)]
|
1146 1228 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1147 1229 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1148 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1230 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
1149 1231 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1150 1232 | let sender = sender.clone();
|
1151 1233 | async move {
|
1152 1234 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
1153 1235 | sender.send(()).await.expect("receiver dropped early");
|
1154 1236 | result
|
1155 1237 | }
|
1156 1238 | })
|
1157 1239 | .build_unchecked();
|
1158 1240 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1159 1241 | .await
|
1160 1242 | .expect("unable to make an HTTP request");
|
1161 1243 | ::pretty_assertions::assert_eq!(
|
1162 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1244 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1163 1245 | http_response.status()
|
1164 1246 | );
|
1165 1247 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1166 1248 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1167 1249 | http_response.headers(),
|
1168 1250 | expected_headers,
|
1169 1251 | ));
|
1170 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1252 + | use ::http_body_util::BodyExt;
|
1253 + | let body = http_response
|
1254 + | .into_body()
|
1255 + | .collect()
|
1171 1256 | .await
|
1172 - | .expect("unable to extract body to bytes");
|
1257 + | .expect("unable to collect body")
|
1258 + | .to_bytes();
|
1173 1259 | ::aws_smithy_protocol_test::assert_ok(
|
1174 1260 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/intEnumList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/intEnumList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/intEnumList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1175 1261 | );
|
1176 1262 | }
|
1177 1263 | }
|
1178 1264 |
|
1179 1265 | /// When an list of lists contains non-unique values,
|
1180 1266 | /// the response should be a 400 ValidationException.
|
1181 1267 | /// Test ID: RestJsonMalformedUniqueItemsListList
|
1182 1268 | #[::tokio::test]
|
1183 1269 | #[::tracing_test::traced_test]
|
1184 1270 | #[should_panic]
|
1185 1271 | async fn rest_json_malformed_unique_items_list_list_malformed_request() {
|
1186 1272 | {
|
1187 1273 | #[allow(unused_mut)]
|
1188 - | let mut http_request = http::Request::builder()
|
1274 + | let mut http_request = ::http_1x::Request::builder()
|
1189 1275 | .uri("/MalformedUniqueItems")
|
1190 1276 | .method("POST")
|
1191 1277 | .header("content-type", "application/json")
|
1192 - | .body(::aws_smithy_http_server::body::Body::from(
|
1193 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1194 - | "{ \"listList\" : [[\"foo\",\"bar\"], [\"foo\",\"bar\"]] }".as_bytes(),
|
1195 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1278 + | .body(::aws_smithy_http_server::body::boxed(
|
1279 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1280 + | &::aws_smithy_protocol_test::decode_body_data(
|
1281 + | "{ \"listList\" : [[\"foo\",\"bar\"], [\"foo\",\"bar\"]] }".as_bytes(),
|
1282 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1283 + | ),
|
1196 1284 | )),
|
1197 1285 | ))
|
1198 1286 | .unwrap();
|
1199 1287 | #[allow(unused_mut)]
|
1200 1288 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1201 1289 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1202 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1290 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
1203 1291 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1204 1292 | let sender = sender.clone();
|
1205 1293 | async move {
|
1206 1294 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
1207 1295 | sender.send(()).await.expect("receiver dropped early");
|
1208 1296 | result
|
1209 1297 | }
|
1210 1298 | })
|
1211 1299 | .build_unchecked();
|
1212 1300 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1213 1301 | .await
|
1214 1302 | .expect("unable to make an HTTP request");
|
1215 1303 | ::pretty_assertions::assert_eq!(
|
1216 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1304 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1217 1305 | http_response.status()
|
1218 1306 | );
|
1219 1307 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1220 1308 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1221 1309 | http_response.headers(),
|
1222 1310 | expected_headers,
|
1223 1311 | ));
|
1224 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1312 + | use ::http_body_util::BodyExt;
|
1313 + | let body = http_response
|
1314 + | .into_body()
|
1315 + | .collect()
|
1225 1316 | .await
|
1226 - | .expect("unable to extract body to bytes");
|
1317 + | .expect("unable to collect body")
|
1318 + | .to_bytes();
|
1227 1319 | ::aws_smithy_protocol_test::assert_ok(
|
1228 1320 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/listList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/listList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/listList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1229 1321 | );
|
1230 1322 | }
|
1231 1323 | }
|
1232 1324 |
|
1233 1325 | /// When an list of structures contains non-unique values,
|
1234 1326 | /// the response should be a 400 ValidationException.
|
1235 1327 | /// Test ID: RestJsonMalformedUniqueItemsStructureList
|
1236 1328 | #[::tokio::test]
|
1237 1329 | #[::tracing_test::traced_test]
|
1238 1330 | #[should_panic]
|
1239 1331 | async fn rest_json_malformed_unique_items_structure_list_malformed_request() {
|
1240 1332 | {
|
1241 1333 | #[allow(unused_mut)]
|
1242 - | let mut http_request = http::Request::builder()
|
1334 + | let mut http_request = ::http_1x::Request::builder()
|
1243 1335 | .uri("/MalformedUniqueItems")
|
1244 1336 | .method("POST")
|
1245 1337 | .header("content-type", "application/json")
|
1246 - | .body(::aws_smithy_http_server::body::Body::from(
|
1247 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1248 - | "{ \"structureList\" : [{\"hi\": \"hello\"}, {\"hi\": \"hello\"}] }"
|
1249 - | .as_bytes(),
|
1250 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1338 + | .body(::aws_smithy_http_server::body::boxed(
|
1339 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1340 + | &::aws_smithy_protocol_test::decode_body_data(
|
1341 + | "{ \"structureList\" : [{\"hi\": \"hello\"}, {\"hi\": \"hello\"}] }"
|
1342 + | .as_bytes(),
|
1343 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1344 + | ),
|
1251 1345 | )),
|
1252 1346 | ))
|
1253 1347 | .unwrap();
|
1254 1348 | #[allow(unused_mut)]
|
1255 1349 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1256 1350 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1257 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1351 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
1258 1352 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1259 1353 | let sender = sender.clone();
|
1260 1354 | async move {
|
1261 1355 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
1262 1356 | sender.send(()).await.expect("receiver dropped early");
|
1263 1357 | result
|
1264 1358 | }
|
1265 1359 | })
|
1266 1360 | .build_unchecked();
|
1267 1361 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1268 1362 | .await
|
1269 1363 | .expect("unable to make an HTTP request");
|
1270 1364 | ::pretty_assertions::assert_eq!(
|
1271 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1365 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1272 1366 | http_response.status()
|
1273 1367 | );
|
1274 1368 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1275 1369 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1276 1370 | http_response.headers(),
|
1277 1371 | expected_headers,
|
1278 1372 | ));
|
1279 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1373 + | use ::http_body_util::BodyExt;
|
1374 + | let body = http_response
|
1375 + | .into_body()
|
1376 + | .collect()
|
1280 1377 | .await
|
1281 - | .expect("unable to extract body to bytes");
|
1378 + | .expect("unable to collect body")
|
1379 + | .to_bytes();
|
1282 1380 | ::aws_smithy_protocol_test::assert_ok(
|
1283 1381 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/structureList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/structureList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/structureList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1284 1382 | );
|
1285 1383 | }
|
1286 1384 | }
|
1287 1385 |
|
1288 1386 | /// When a list of structures does not contain required keys,
|
1289 1387 | /// the response should be a 400 ValidationException and not
|
1290 1388 | /// a 500 error.
|
1291 1389 | /// Test ID: RestJsonMalformedUniqueItemsStructureMissingKeyList
|
1292 1390 | #[::tokio::test]
|
1293 1391 | #[::tracing_test::traced_test]
|
1294 1392 | async fn rest_json_malformed_unique_items_structure_missing_key_list_malformed_request() {
|
1295 1393 | {
|
1296 1394 | #[allow(unused_mut)]
|
1297 - | let mut http_request = http::Request::builder()
|
1395 + | let mut http_request = ::http_1x::Request::builder()
|
1298 1396 | .uri("/MalformedUniqueItems")
|
1299 1397 | .method("POST")
|
1300 1398 | .header("content-type", "application/json")
|
1301 - | .body(::aws_smithy_http_server::body::Body::from(
|
1302 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1303 - | "{ \"structureListWithNoKey\" : [{\"hi2\": \"bar\"}] }".as_bytes(),
|
1304 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1399 + | .body(::aws_smithy_http_server::body::boxed(
|
1400 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1401 + | &::aws_smithy_protocol_test::decode_body_data(
|
1402 + | "{ \"structureListWithNoKey\" : [{\"hi2\": \"bar\"}] }".as_bytes(),
|
1403 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1404 + | ),
|
1305 1405 | )),
|
1306 1406 | ))
|
1307 1407 | .unwrap();
|
1308 1408 | #[allow(unused_mut)]
|
1309 1409 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1310 1410 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1311 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1411 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
1312 1412 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1313 1413 | let sender = sender.clone();
|
1314 1414 | async move {
|
1315 1415 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
1316 1416 | sender.send(()).await.expect("receiver dropped early");
|
1317 1417 | result
|
1318 1418 | }
|
1319 1419 | })
|
1320 1420 | .build_unchecked();
|
1321 1421 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1322 1422 | .await
|
1323 1423 | .expect("unable to make an HTTP request");
|
1324 1424 | ::pretty_assertions::assert_eq!(
|
1325 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1425 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1326 1426 | http_response.status()
|
1327 1427 | );
|
1328 1428 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1329 1429 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1330 1430 | http_response.headers(),
|
1331 1431 | expected_headers,
|
1332 1432 | ));
|
1333 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1433 + | use ::http_body_util::BodyExt;
|
1434 + | let body = http_response
|
1435 + | .into_body()
|
1436 + | .collect()
|
1334 1437 | .await
|
1335 - | .expect("unable to extract body to bytes");
|
1438 + | .expect("unable to collect body")
|
1439 + | .to_bytes();
|
1336 1440 | ::aws_smithy_protocol_test::assert_ok(
|
1337 1441 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/structureListWithNoKey/0/hi' failed to satisfy constraint: Member must not be null\",\n \"fieldList\" : [{\"message\": \"Value at '/structureListWithNoKey/0/hi' failed to satisfy constraint: Member must not be null\", \"path\": \"/structureListWithNoKey/0/hi\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1338 1442 | );
|
1339 1443 | }
|
1340 1444 | }
|
1341 1445 |
|
1342 1446 | /// When an list of unions contains non-unique values,
|
1343 1447 | /// the response should be a 400 ValidationException.
|
1344 1448 | /// Test ID: RestJsonMalformedUniqueItemsUnionList_case0
|
1345 1449 | #[::tokio::test]
|
1346 1450 | #[::tracing_test::traced_test]
|
1347 1451 | #[should_panic]
|
1348 1452 | async fn rest_json_malformed_unique_items_union_list_case0_malformed_request() {
|
1349 1453 | {
|
1350 1454 | #[allow(unused_mut)]
|
1351 - | let mut http_request = http::Request::builder()
|
1455 + | let mut http_request = ::http_1x::Request::builder()
|
1352 1456 | .uri("/MalformedUniqueItems")
|
1353 1457 | .method("POST")
|
1354 1458 | .header("content-type", "application/json")
|
1355 - | .body(::aws_smithy_http_server::body::Body::from(
|
1356 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1357 - | "{ \"unionList\" : [{\"string\": \"foo\"}, {\"string\": \"foo\"}] }"
|
1358 - | .as_bytes(),
|
1359 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1459 + | .body(::aws_smithy_http_server::body::boxed(
|
1460 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1461 + | &::aws_smithy_protocol_test::decode_body_data(
|
1462 + | "{ \"unionList\" : [{\"string\": \"foo\"}, {\"string\": \"foo\"}] }"
|
1463 + | .as_bytes(),
|
1464 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1465 + | ),
|
1360 1466 | )),
|
1361 1467 | ))
|
1362 1468 | .unwrap();
|
1363 1469 | #[allow(unused_mut)]
|
1364 1470 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1365 1471 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1366 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1472 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
1367 1473 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1368 1474 | let sender = sender.clone();
|
1369 1475 | async move {
|
1370 1476 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
1371 1477 | sender.send(()).await.expect("receiver dropped early");
|
1372 1478 | result
|
1373 1479 | }
|
1374 1480 | })
|
1375 1481 | .build_unchecked();
|
1376 1482 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1377 1483 | .await
|
1378 1484 | .expect("unable to make an HTTP request");
|
1379 1485 | ::pretty_assertions::assert_eq!(
|
1380 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1486 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1381 1487 | http_response.status()
|
1382 1488 | );
|
1383 1489 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1384 1490 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1385 1491 | http_response.headers(),
|
1386 1492 | expected_headers,
|
1387 1493 | ));
|
1388 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1494 + | use ::http_body_util::BodyExt;
|
1495 + | let body = http_response
|
1496 + | .into_body()
|
1497 + | .collect()
|
1389 1498 | .await
|
1390 - | .expect("unable to extract body to bytes");
|
1499 + | .expect("unable to collect body")
|
1500 + | .to_bytes();
|
1391 1501 | ::aws_smithy_protocol_test::assert_ok(
|
1392 1502 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/unionList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/unionList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/unionList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1393 1503 | );
|
1394 1504 | }
|
1395 1505 | }
|
1396 1506 |
|
1397 1507 | /// When an list of unions contains non-unique values,
|
1398 1508 | /// the response should be a 400 ValidationException.
|
1399 1509 | /// Test ID: RestJsonMalformedUniqueItemsUnionList_case1
|
1400 1510 | #[::tokio::test]
|
1401 1511 | #[::tracing_test::traced_test]
|
1402 1512 | #[should_panic]
|
1403 1513 | async fn rest_json_malformed_unique_items_union_list_case1_malformed_request() {
|
1404 1514 | {
|
1405 1515 | #[allow(unused_mut)]
|
1406 - | let mut http_request = http::Request::builder()
|
1516 + | let mut http_request = ::http_1x::Request::builder()
|
1407 1517 | .uri("/MalformedUniqueItems")
|
1408 1518 | .method("POST")
|
1409 1519 | .header("content-type", "application/json")
|
1410 - | .body(::aws_smithy_http_server::body::Body::from(
|
1411 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1412 - | "{ \"unionList\" : [{\"integer\": 1}, {\"integer\": 1}] }".as_bytes(),
|
1413 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1520 + | .body(::aws_smithy_http_server::body::boxed(
|
1521 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1522 + | &::aws_smithy_protocol_test::decode_body_data(
|
1523 + | "{ \"unionList\" : [{\"integer\": 1}, {\"integer\": 1}] }".as_bytes(),
|
1524 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1525 + | ),
|
1414 1526 | )),
|
1415 1527 | ))
|
1416 1528 | .unwrap();
|
1417 1529 | #[allow(unused_mut)]
|
1418 1530 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1419 1531 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1420 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1532 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
1421 1533 | .malformed_unique_items(move |input: crate::input::MalformedUniqueItemsInput| {
|
1422 1534 | let sender = sender.clone();
|
1423 1535 | async move {
|
1424 1536 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedUniqueItemsOutput, crate::error::MalformedUniqueItemsError> };
|
1425 1537 | sender.send(()).await.expect("receiver dropped early");
|
1426 1538 | result
|
1427 1539 | }
|
1428 1540 | })
|
1429 1541 | .build_unchecked();
|
1430 1542 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1431 1543 | .await
|
1432 1544 | .expect("unable to make an HTTP request");
|
1433 1545 | ::pretty_assertions::assert_eq!(
|
1434 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1546 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1435 1547 | http_response.status()
|
1436 1548 | );
|
1437 1549 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1438 1550 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1439 1551 | http_response.headers(),
|
1440 1552 | expected_headers,
|
1441 1553 | ));
|
1442 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1554 + | use ::http_body_util::BodyExt;
|
1555 + | let body = http_response
|
1556 + | .into_body()
|
1557 + | .collect()
|
1443 1558 | .await
|
1444 - | .expect("unable to extract body to bytes");
|
1559 + | .expect("unable to collect body")
|
1560 + | .to_bytes();
|
1445 1561 | ::aws_smithy_protocol_test::assert_ok(
|
1446 1562 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/unionList' failed to satisfy constraint: Member must have unique values\",\n \"fieldList\" : [{\"message\": \"Value at '/unionList' failed to satisfy constraint: Member must have unique values\", \"path\": \"/unionList\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1447 1563 | );
|
1448 1564 | }
|
1449 1565 | }
|
1450 1566 | }
|
1451 1567 |
|
1452 1568 | ::pin_project_lite::pin_project! {
|
1453 1569 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1454 1570 | /// [`MalformedRequiredInput`](crate::input::MalformedRequiredInput) using modelled bindings.
|
1455 1571 | pub struct MalformedRequiredInputFuture {
|
1456 1572 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedRequiredInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
1457 1573 | }
|
1458 1574 | }
|
1459 1575 |
|
1460 1576 | impl std::future::Future for MalformedRequiredInputFuture {
|
1461 1577 | type Output = Result<
|
1462 1578 | crate::input::MalformedRequiredInput,
|
1463 1579 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
1464 1580 | >;
|
1465 1581 |
|
1466 1582 | fn poll(
|
1467 1583 | self: std::pin::Pin<&mut Self>,
|
1468 1584 | cx: &mut std::task::Context<'_>,
|
1469 1585 | ) -> std::task::Poll<Self::Output> {
|
1470 1586 | let this = self.project();
|
1471 1587 | this.inner.as_mut().poll(cx)
|
1472 1588 | }
|
1473 1589 | }
|
1474 1590 |
|
1475 1591 | impl<B>
|
1476 1592 | ::aws_smithy_http_server::request::FromRequest<
|
1477 1593 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1478 1594 | B,
|
1479 1595 | > for crate::input::MalformedRequiredInput
|
1480 1596 | where
|
1481 1597 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1482 1598 | B: 'static,
|
1483 1599 |
|
1484 1600 | B::Data: Send,
|
1485 1601 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
1486 1602 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1487 1603 | {
|
1488 1604 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
1489 1605 | type Future = MalformedRequiredInputFuture;
|
1490 1606 |
|
1491 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1607 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
1492 1608 | let fut = async move {
|
1493 1609 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
1494 1610 | request.headers(),
|
1495 1611 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
1496 1612 | ) {
|
1497 1613 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
1498 1614 | }
|
1499 1615 | crate::protocol_serde::shape_malformed_required::de_malformed_required_http_request(
|
1500 1616 | request,
|
1501 1617 | )
|
1827 1961 | mod malformed_range_override_test {
|
1828 1962 |
|
1829 1963 | /// When a byte member does not fit within range bounds,
|
1830 1964 | /// the response should be a 400 ValidationException.
|
1831 1965 | /// Test ID: RestJsonMalformedRangeByteOverride_case0
|
1832 1966 | #[::tokio::test]
|
1833 1967 | #[::tracing_test::traced_test]
|
1834 1968 | async fn rest_json_malformed_range_byte_override_case0_malformed_request() {
|
1835 1969 | {
|
1836 1970 | #[allow(unused_mut)]
|
1837 - | let mut http_request = http::Request::builder()
|
1971 + | let mut http_request = ::http_1x::Request::builder()
|
1838 1972 | .uri("/MalformedRangeOverride")
|
1839 1973 | .method("POST")
|
1840 1974 | .header("content-type", "application/json")
|
1841 - | .body(::aws_smithy_http_server::body::Body::from(
|
1842 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1843 - | "{ \"byte\" : 3 }".as_bytes(),
|
1844 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1975 + | .body(::aws_smithy_http_server::body::boxed(
|
1976 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1977 + | &::aws_smithy_protocol_test::decode_body_data(
|
1978 + | "{ \"byte\" : 3 }".as_bytes(),
|
1979 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1980 + | ),
|
1845 1981 | )),
|
1846 1982 | ))
|
1847 1983 | .unwrap();
|
1848 1984 | #[allow(unused_mut)]
|
1849 1985 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1850 1986 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1851 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
1987 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
1852 1988 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1853 1989 | let sender = sender.clone();
|
1854 1990 | async move {
|
1855 1991 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
1856 1992 | sender.send(()).await.expect("receiver dropped early");
|
1857 1993 | result
|
1858 1994 | }
|
1859 1995 | })
|
1860 1996 | .build_unchecked();
|
1861 1997 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1862 1998 | .await
|
1863 1999 | .expect("unable to make an HTTP request");
|
1864 2000 | ::pretty_assertions::assert_eq!(
|
1865 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2001 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1866 2002 | http_response.status()
|
1867 2003 | );
|
1868 2004 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1869 2005 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1870 2006 | http_response.headers(),
|
1871 2007 | expected_headers,
|
1872 2008 | ));
|
1873 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2009 + | use ::http_body_util::BodyExt;
|
2010 + | let body = http_response
|
2011 + | .into_body()
|
2012 + | .collect()
|
1874 2013 | .await
|
1875 - | .expect("unable to extract body to bytes");
|
2014 + | .expect("unable to collect body")
|
2015 + | .to_bytes();
|
1876 2016 | ::aws_smithy_protocol_test::assert_ok(
|
1877 2017 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/byte' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/byte' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/byte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1878 2018 | );
|
1879 2019 | }
|
1880 2020 | }
|
1881 2021 |
|
1882 2022 | /// When a byte member does not fit within range bounds,
|
1883 2023 | /// the response should be a 400 ValidationException.
|
1884 2024 | /// Test ID: RestJsonMalformedRangeByteOverride_case1
|
1885 2025 | #[::tokio::test]
|
1886 2026 | #[::tracing_test::traced_test]
|
1887 2027 | async fn rest_json_malformed_range_byte_override_case1_malformed_request() {
|
1888 2028 | {
|
1889 2029 | #[allow(unused_mut)]
|
1890 - | let mut http_request = http::Request::builder()
|
2030 + | let mut http_request = ::http_1x::Request::builder()
|
1891 2031 | .uri("/MalformedRangeOverride")
|
1892 2032 | .method("POST")
|
1893 2033 | .header("content-type", "application/json")
|
1894 - | .body(::aws_smithy_http_server::body::Body::from(
|
1895 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1896 - | "{ \"byte\" : 7 }".as_bytes(),
|
1897 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2034 + | .body(::aws_smithy_http_server::body::boxed(
|
2035 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2036 + | &::aws_smithy_protocol_test::decode_body_data(
|
2037 + | "{ \"byte\" : 7 }".as_bytes(),
|
2038 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2039 + | ),
|
1898 2040 | )),
|
1899 2041 | ))
|
1900 2042 | .unwrap();
|
1901 2043 | #[allow(unused_mut)]
|
1902 2044 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1903 2045 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1904 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2046 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
1905 2047 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1906 2048 | let sender = sender.clone();
|
1907 2049 | async move {
|
1908 2050 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
1909 2051 | sender.send(()).await.expect("receiver dropped early");
|
1910 2052 | result
|
1911 2053 | }
|
1912 2054 | })
|
1913 2055 | .build_unchecked();
|
1914 2056 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1915 2057 | .await
|
1916 2058 | .expect("unable to make an HTTP request");
|
1917 2059 | ::pretty_assertions::assert_eq!(
|
1918 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2060 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1919 2061 | http_response.status()
|
1920 2062 | );
|
1921 2063 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1922 2064 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1923 2065 | http_response.headers(),
|
1924 2066 | expected_headers,
|
1925 2067 | ));
|
1926 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2068 + | use ::http_body_util::BodyExt;
|
2069 + | let body = http_response
|
2070 + | .into_body()
|
2071 + | .collect()
|
1927 2072 | .await
|
1928 - | .expect("unable to extract body to bytes");
|
2073 + | .expect("unable to collect body")
|
2074 + | .to_bytes();
|
1929 2075 | ::aws_smithy_protocol_test::assert_ok(
|
1930 2076 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/byte' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/byte' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/byte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1931 2077 | );
|
1932 2078 | }
|
1933 2079 | }
|
1934 2080 |
|
1935 2081 | /// When a byte member does not fit within range bounds,
|
1936 2082 | /// the response should be a 400 ValidationException.
|
1937 2083 | /// Test ID: RestJsonMalformedRangeMinByteOverride
|
1938 2084 | #[::tokio::test]
|
1939 2085 | #[::tracing_test::traced_test]
|
1940 2086 | async fn rest_json_malformed_range_min_byte_override_malformed_request() {
|
1941 2087 | {
|
1942 2088 | #[allow(unused_mut)]
|
1943 - | let mut http_request = http::Request::builder()
|
2089 + | let mut http_request = ::http_1x::Request::builder()
|
1944 2090 | .uri("/MalformedRangeOverride")
|
1945 2091 | .method("POST")
|
1946 2092 | .header("content-type", "application/json")
|
1947 - | .body(::aws_smithy_http_server::body::Body::from(
|
1948 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1949 - | "{ \"minByte\" : 3 }".as_bytes(),
|
1950 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2093 + | .body(::aws_smithy_http_server::body::boxed(
|
2094 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2095 + | &::aws_smithy_protocol_test::decode_body_data(
|
2096 + | "{ \"minByte\" : 3 }".as_bytes(),
|
2097 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2098 + | ),
|
1951 2099 | )),
|
1952 2100 | ))
|
1953 2101 | .unwrap();
|
1954 2102 | #[allow(unused_mut)]
|
1955 2103 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1956 2104 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
1957 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2105 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
1958 2106 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
1959 2107 | let sender = sender.clone();
|
1960 2108 | async move {
|
1961 2109 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
1962 2110 | sender.send(()).await.expect("receiver dropped early");
|
1963 2111 | result
|
1964 2112 | }
|
1965 2113 | })
|
1966 2114 | .build_unchecked();
|
1967 2115 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1968 2116 | .await
|
1969 2117 | .expect("unable to make an HTTP request");
|
1970 2118 | ::pretty_assertions::assert_eq!(
|
1971 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2119 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1972 2120 | http_response.status()
|
1973 2121 | );
|
1974 2122 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
1975 2123 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1976 2124 | http_response.headers(),
|
1977 2125 | expected_headers,
|
1978 2126 | ));
|
1979 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2127 + | use ::http_body_util::BodyExt;
|
2128 + | let body = http_response
|
2129 + | .into_body()
|
2130 + | .collect()
|
1980 2131 | .await
|
1981 - | .expect("unable to extract body to bytes");
|
2132 + | .expect("unable to collect body")
|
2133 + | .to_bytes();
|
1982 2134 | ::aws_smithy_protocol_test::assert_ok(
|
1983 2135 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minByte' failed to satisfy constraint: Member must be greater than or equal to 4\",\n \"fieldList\" : [{\"message\": \"Value at '/minByte' failed to satisfy constraint: Member must be greater than or equal to 4\", \"path\": \"/minByte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1984 2136 | );
|
1985 2137 | }
|
1986 2138 | }
|
1987 2139 |
|
1988 2140 | /// When a byte member does not fit within range bounds,
|
1989 2141 | /// the response should be a 400 ValidationException.
|
1990 2142 | /// Test ID: RestJsonMalformedRangeMaxByteOverride
|
1991 2143 | #[::tokio::test]
|
1992 2144 | #[::tracing_test::traced_test]
|
1993 2145 | async fn rest_json_malformed_range_max_byte_override_malformed_request() {
|
1994 2146 | {
|
1995 2147 | #[allow(unused_mut)]
|
1996 - | let mut http_request = http::Request::builder()
|
2148 + | let mut http_request = ::http_1x::Request::builder()
|
1997 2149 | .uri("/MalformedRangeOverride")
|
1998 2150 | .method("POST")
|
1999 2151 | .header("content-type", "application/json")
|
2000 - | .body(::aws_smithy_http_server::body::Body::from(
|
2001 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2002 - | "{ \"maxByte\" : 7 }".as_bytes(),
|
2003 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2152 + | .body(::aws_smithy_http_server::body::boxed(
|
2153 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2154 + | &::aws_smithy_protocol_test::decode_body_data(
|
2155 + | "{ \"maxByte\" : 7 }".as_bytes(),
|
2156 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2157 + | ),
|
2004 2158 | )),
|
2005 2159 | ))
|
2006 2160 | .unwrap();
|
2007 2161 | #[allow(unused_mut)]
|
2008 2162 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2009 2163 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2010 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2164 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2011 2165 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2012 2166 | let sender = sender.clone();
|
2013 2167 | async move {
|
2014 2168 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2015 2169 | sender.send(()).await.expect("receiver dropped early");
|
2016 2170 | result
|
2017 2171 | }
|
2018 2172 | })
|
2019 2173 | .build_unchecked();
|
2020 2174 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2021 2175 | .await
|
2022 2176 | .expect("unable to make an HTTP request");
|
2023 2177 | ::pretty_assertions::assert_eq!(
|
2024 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2178 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2025 2179 | http_response.status()
|
2026 2180 | );
|
2027 2181 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2028 2182 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2029 2183 | http_response.headers(),
|
2030 2184 | expected_headers,
|
2031 2185 | ));
|
2032 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2186 + | use ::http_body_util::BodyExt;
|
2187 + | let body = http_response
|
2188 + | .into_body()
|
2189 + | .collect()
|
2033 2190 | .await
|
2034 - | .expect("unable to extract body to bytes");
|
2191 + | .expect("unable to collect body")
|
2192 + | .to_bytes();
|
2035 2193 | ::aws_smithy_protocol_test::assert_ok(
|
2036 2194 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxByte' failed to satisfy constraint: Member must be less than or equal to 6\",\n \"fieldList\" : [{\"message\": \"Value at '/maxByte' failed to satisfy constraint: Member must be less than or equal to 6\", \"path\": \"/maxByte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2037 2195 | );
|
2038 2196 | }
|
2039 2197 | }
|
2040 2198 |
|
2041 2199 | /// When a float member does not fit within range bounds,
|
2042 2200 | /// the response should be a 400 ValidationException.
|
2043 2201 | /// Test ID: RestJsonMalformedRangeFloatOverride_case0
|
2044 2202 | #[::tokio::test]
|
2045 2203 | #[::tracing_test::traced_test]
|
2046 2204 | #[should_panic]
|
2047 2205 | async fn rest_json_malformed_range_float_override_case0_malformed_request() {
|
2048 2206 | {
|
2049 2207 | #[allow(unused_mut)]
|
2050 - | let mut http_request = http::Request::builder()
|
2208 + | let mut http_request = ::http_1x::Request::builder()
|
2051 2209 | .uri("/MalformedRangeOverride")
|
2052 2210 | .method("POST")
|
2053 2211 | .header("content-type", "application/json")
|
2054 - | .body(::aws_smithy_http_server::body::Body::from(
|
2055 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2056 - | "{ \"float\" : 4.3 }".as_bytes(),
|
2057 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2212 + | .body(::aws_smithy_http_server::body::boxed(
|
2213 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2214 + | &::aws_smithy_protocol_test::decode_body_data(
|
2215 + | "{ \"float\" : 4.3 }".as_bytes(),
|
2216 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2217 + | ),
|
2058 2218 | )),
|
2059 2219 | ))
|
2060 2220 | .unwrap();
|
2061 2221 | #[allow(unused_mut)]
|
2062 2222 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2063 2223 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2064 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2224 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2065 2225 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2066 2226 | let sender = sender.clone();
|
2067 2227 | async move {
|
2068 2228 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2069 2229 | sender.send(()).await.expect("receiver dropped early");
|
2070 2230 | result
|
2071 2231 | }
|
2072 2232 | })
|
2073 2233 | .build_unchecked();
|
2074 2234 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2075 2235 | .await
|
2076 2236 | .expect("unable to make an HTTP request");
|
2077 2237 | ::pretty_assertions::assert_eq!(
|
2078 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2238 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2079 2239 | http_response.status()
|
2080 2240 | );
|
2081 2241 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2082 2242 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2083 2243 | http_response.headers(),
|
2084 2244 | expected_headers,
|
2085 2245 | ));
|
2086 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2246 + | use ::http_body_util::BodyExt;
|
2247 + | let body = http_response
|
2248 + | .into_body()
|
2249 + | .collect()
|
2087 2250 | .await
|
2088 - | .expect("unable to extract body to bytes");
|
2251 + | .expect("unable to collect body")
|
2252 + | .to_bytes();
|
2089 2253 | ::aws_smithy_protocol_test::assert_ok(
|
2090 2254 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/float' failed to satisfy constraint: Member must be between 4.4 and 6.6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/float' failed to satisfy constraint: Member must be between 4.4 and 6.6, inclusive\", \"path\": \"/float\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2091 2255 | );
|
2092 2256 | }
|
2093 2257 | }
|
2094 2258 |
|
2095 2259 | /// When a float member does not fit within range bounds,
|
2096 2260 | /// the response should be a 400 ValidationException.
|
2097 2261 | /// Test ID: RestJsonMalformedRangeFloatOverride_case1
|
2098 2262 | #[::tokio::test]
|
2099 2263 | #[::tracing_test::traced_test]
|
2100 2264 | #[should_panic]
|
2101 2265 | async fn rest_json_malformed_range_float_override_case1_malformed_request() {
|
2102 2266 | {
|
2103 2267 | #[allow(unused_mut)]
|
2104 - | let mut http_request = http::Request::builder()
|
2268 + | let mut http_request = ::http_1x::Request::builder()
|
2105 2269 | .uri("/MalformedRangeOverride")
|
2106 2270 | .method("POST")
|
2107 2271 | .header("content-type", "application/json")
|
2108 - | .body(::aws_smithy_http_server::body::Body::from(
|
2109 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2110 - | "{ \"float\" : 6.7 }".as_bytes(),
|
2111 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2272 + | .body(::aws_smithy_http_server::body::boxed(
|
2273 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2274 + | &::aws_smithy_protocol_test::decode_body_data(
|
2275 + | "{ \"float\" : 6.7 }".as_bytes(),
|
2276 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2277 + | ),
|
2112 2278 | )),
|
2113 2279 | ))
|
2114 2280 | .unwrap();
|
2115 2281 | #[allow(unused_mut)]
|
2116 2282 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2117 2283 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2118 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2284 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2119 2285 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2120 2286 | let sender = sender.clone();
|
2121 2287 | async move {
|
2122 2288 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2123 2289 | sender.send(()).await.expect("receiver dropped early");
|
2124 2290 | result
|
2125 2291 | }
|
2126 2292 | })
|
2127 2293 | .build_unchecked();
|
2128 2294 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2129 2295 | .await
|
2130 2296 | .expect("unable to make an HTTP request");
|
2131 2297 | ::pretty_assertions::assert_eq!(
|
2132 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2298 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2133 2299 | http_response.status()
|
2134 2300 | );
|
2135 2301 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2136 2302 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2137 2303 | http_response.headers(),
|
2138 2304 | expected_headers,
|
2139 2305 | ));
|
2140 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2306 + | use ::http_body_util::BodyExt;
|
2307 + | let body = http_response
|
2308 + | .into_body()
|
2309 + | .collect()
|
2141 2310 | .await
|
2142 - | .expect("unable to extract body to bytes");
|
2311 + | .expect("unable to collect body")
|
2312 + | .to_bytes();
|
2143 2313 | ::aws_smithy_protocol_test::assert_ok(
|
2144 2314 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/float' failed to satisfy constraint: Member must be between 4.4 and 6.6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/float' failed to satisfy constraint: Member must be between 4.4 and 6.6, inclusive\", \"path\": \"/float\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2145 2315 | );
|
2146 2316 | }
|
2147 2317 | }
|
2148 2318 |
|
2149 2319 | /// When a float member does not fit within range bounds,
|
2150 2320 | /// the response should be a 400 ValidationException.
|
2151 2321 | /// Test ID: RestJsonMalformedRangeMinFloatOverride
|
2152 2322 | #[::tokio::test]
|
2153 2323 | #[::tracing_test::traced_test]
|
2154 2324 | #[should_panic]
|
2155 2325 | async fn rest_json_malformed_range_min_float_override_malformed_request() {
|
2156 2326 | {
|
2157 2327 | #[allow(unused_mut)]
|
2158 - | let mut http_request = http::Request::builder()
|
2328 + | let mut http_request = ::http_1x::Request::builder()
|
2159 2329 | .uri("/MalformedRangeOverride")
|
2160 2330 | .method("POST")
|
2161 2331 | .header("content-type", "application/json")
|
2162 - | .body(::aws_smithy_http_server::body::Body::from(
|
2163 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2164 - | "{ \"minFloat\" : 4.3 }".as_bytes(),
|
2165 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2332 + | .body(::aws_smithy_http_server::body::boxed(
|
2333 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2334 + | &::aws_smithy_protocol_test::decode_body_data(
|
2335 + | "{ \"minFloat\" : 4.3 }".as_bytes(),
|
2336 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2337 + | ),
|
2166 2338 | )),
|
2167 2339 | ))
|
2168 2340 | .unwrap();
|
2169 2341 | #[allow(unused_mut)]
|
2170 2342 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2171 2343 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2172 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2344 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2173 2345 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2174 2346 | let sender = sender.clone();
|
2175 2347 | async move {
|
2176 2348 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2177 2349 | sender.send(()).await.expect("receiver dropped early");
|
2178 2350 | result
|
2179 2351 | }
|
2180 2352 | })
|
2181 2353 | .build_unchecked();
|
2182 2354 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2183 2355 | .await
|
2184 2356 | .expect("unable to make an HTTP request");
|
2185 2357 | ::pretty_assertions::assert_eq!(
|
2186 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2358 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2187 2359 | http_response.status()
|
2188 2360 | );
|
2189 2361 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2190 2362 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2191 2363 | http_response.headers(),
|
2192 2364 | expected_headers,
|
2193 2365 | ));
|
2194 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2366 + | use ::http_body_util::BodyExt;
|
2367 + | let body = http_response
|
2368 + | .into_body()
|
2369 + | .collect()
|
2195 2370 | .await
|
2196 - | .expect("unable to extract body to bytes");
|
2371 + | .expect("unable to collect body")
|
2372 + | .to_bytes();
|
2197 2373 | ::aws_smithy_protocol_test::assert_ok(
|
2198 2374 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minFloat' failed to satisfy constraint: Member must be greater than or equal to 4.4\",\n \"fieldList\" : [{\"message\": \"Value at '/minFloat' failed to satisfy constraint: Member must be greater than or equal to 4.4\", \"path\": \"/minFloat\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2199 2375 | );
|
2200 2376 | }
|
2201 2377 | }
|
2202 2378 |
|
2203 2379 | /// When a float member does not fit within range bounds,
|
2204 2380 | /// the response should be a 400 ValidationException.
|
2205 2381 | /// Test ID: RestJsonMalformedRangeMaxFloatOverride
|
2206 2382 | #[::tokio::test]
|
2207 2383 | #[::tracing_test::traced_test]
|
2208 2384 | #[should_panic]
|
2209 2385 | async fn rest_json_malformed_range_max_float_override_malformed_request() {
|
2210 2386 | {
|
2211 2387 | #[allow(unused_mut)]
|
2212 - | let mut http_request = http::Request::builder()
|
2388 + | let mut http_request = ::http_1x::Request::builder()
|
2213 2389 | .uri("/MalformedRangeOverride")
|
2214 2390 | .method("POST")
|
2215 2391 | .header("content-type", "application/json")
|
2216 - | .body(::aws_smithy_http_server::body::Body::from(
|
2217 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2218 - | "{ \"maxFloat\" : 6.7 }".as_bytes(),
|
2219 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2392 + | .body(::aws_smithy_http_server::body::boxed(
|
2393 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2394 + | &::aws_smithy_protocol_test::decode_body_data(
|
2395 + | "{ \"maxFloat\" : 6.7 }".as_bytes(),
|
2396 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2397 + | ),
|
2220 2398 | )),
|
2221 2399 | ))
|
2222 2400 | .unwrap();
|
2223 2401 | #[allow(unused_mut)]
|
2224 2402 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2225 2403 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2226 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2404 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2227 2405 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2228 2406 | let sender = sender.clone();
|
2229 2407 | async move {
|
2230 2408 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2231 2409 | sender.send(()).await.expect("receiver dropped early");
|
2232 2410 | result
|
2233 2411 | }
|
2234 2412 | })
|
2235 2413 | .build_unchecked();
|
2236 2414 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2237 2415 | .await
|
2238 2416 | .expect("unable to make an HTTP request");
|
2239 2417 | ::pretty_assertions::assert_eq!(
|
2240 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2418 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2241 2419 | http_response.status()
|
2242 2420 | );
|
2243 2421 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2244 2422 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2245 2423 | http_response.headers(),
|
2246 2424 | expected_headers,
|
2247 2425 | ));
|
2248 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2426 + | use ::http_body_util::BodyExt;
|
2427 + | let body = http_response
|
2428 + | .into_body()
|
2429 + | .collect()
|
2249 2430 | .await
|
2250 - | .expect("unable to extract body to bytes");
|
2431 + | .expect("unable to collect body")
|
2432 + | .to_bytes();
|
2251 2433 | ::aws_smithy_protocol_test::assert_ok(
|
2252 2434 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxFloat' failed to satisfy constraint: Member must be less than or equal to 6.6\",\n \"fieldList\" : [{\"message\": \"Value at '/maxFloat' failed to satisfy constraint: Member must be less than or equal to 6.6\", \"path\": \"/maxFloat\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2253 2435 | );
|
2254 2436 | }
|
2255 2437 | }
|
2256 2438 |
|
2257 2439 | /// When a short member does not fit within range bounds,
|
2258 2440 | /// the response should be a 400 ValidationException.
|
2259 2441 | /// Test ID: RestJsonMalformedRangeShortOverride_case0
|
2260 2442 | #[::tokio::test]
|
2261 2443 | #[::tracing_test::traced_test]
|
2262 2444 | async fn rest_json_malformed_range_short_override_case0_malformed_request() {
|
2263 2445 | {
|
2264 2446 | #[allow(unused_mut)]
|
2265 - | let mut http_request = http::Request::builder()
|
2447 + | let mut http_request = ::http_1x::Request::builder()
|
2266 2448 | .uri("/MalformedRangeOverride")
|
2267 2449 | .method("POST")
|
2268 2450 | .header("content-type", "application/json")
|
2269 - | .body(::aws_smithy_http_server::body::Body::from(
|
2270 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2271 - | "{ \"short\" : 3 }".as_bytes(),
|
2272 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2451 + | .body(::aws_smithy_http_server::body::boxed(
|
2452 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2453 + | &::aws_smithy_protocol_test::decode_body_data(
|
2454 + | "{ \"short\" : 3 }".as_bytes(),
|
2455 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2456 + | ),
|
2273 2457 | )),
|
2274 2458 | ))
|
2275 2459 | .unwrap();
|
2276 2460 | #[allow(unused_mut)]
|
2277 2461 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2278 2462 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2279 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2463 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2280 2464 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2281 2465 | let sender = sender.clone();
|
2282 2466 | async move {
|
2283 2467 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2284 2468 | sender.send(()).await.expect("receiver dropped early");
|
2285 2469 | result
|
2286 2470 | }
|
2287 2471 | })
|
2288 2472 | .build_unchecked();
|
2289 2473 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2290 2474 | .await
|
2291 2475 | .expect("unable to make an HTTP request");
|
2292 2476 | ::pretty_assertions::assert_eq!(
|
2293 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2477 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2294 2478 | http_response.status()
|
2295 2479 | );
|
2296 2480 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2297 2481 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2298 2482 | http_response.headers(),
|
2299 2483 | expected_headers,
|
2300 2484 | ));
|
2301 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2485 + | use ::http_body_util::BodyExt;
|
2486 + | let body = http_response
|
2487 + | .into_body()
|
2488 + | .collect()
|
2302 2489 | .await
|
2303 - | .expect("unable to extract body to bytes");
|
2490 + | .expect("unable to collect body")
|
2491 + | .to_bytes();
|
2304 2492 | ::aws_smithy_protocol_test::assert_ok(
|
2305 2493 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/short' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/short' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/short\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2306 2494 | );
|
2307 2495 | }
|
2308 2496 | }
|
2309 2497 |
|
2310 2498 | /// When a short member does not fit within range bounds,
|
2311 2499 | /// the response should be a 400 ValidationException.
|
2312 2500 | /// Test ID: RestJsonMalformedRangeShortOverride_case1
|
2313 2501 | #[::tokio::test]
|
2314 2502 | #[::tracing_test::traced_test]
|
2315 2503 | async fn rest_json_malformed_range_short_override_case1_malformed_request() {
|
2316 2504 | {
|
2317 2505 | #[allow(unused_mut)]
|
2318 - | let mut http_request = http::Request::builder()
|
2506 + | let mut http_request = ::http_1x::Request::builder()
|
2319 2507 | .uri("/MalformedRangeOverride")
|
2320 2508 | .method("POST")
|
2321 2509 | .header("content-type", "application/json")
|
2322 - | .body(::aws_smithy_http_server::body::Body::from(
|
2323 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2324 - | "{ \"short\" : 7 }".as_bytes(),
|
2325 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2510 + | .body(::aws_smithy_http_server::body::boxed(
|
2511 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2512 + | &::aws_smithy_protocol_test::decode_body_data(
|
2513 + | "{ \"short\" : 7 }".as_bytes(),
|
2514 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2515 + | ),
|
2326 2516 | )),
|
2327 2517 | ))
|
2328 2518 | .unwrap();
|
2329 2519 | #[allow(unused_mut)]
|
2330 2520 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2331 2521 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2332 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2522 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2333 2523 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2334 2524 | let sender = sender.clone();
|
2335 2525 | async move {
|
2336 2526 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2337 2527 | sender.send(()).await.expect("receiver dropped early");
|
2338 2528 | result
|
2339 2529 | }
|
2340 2530 | })
|
2341 2531 | .build_unchecked();
|
2342 2532 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2343 2533 | .await
|
2344 2534 | .expect("unable to make an HTTP request");
|
2345 2535 | ::pretty_assertions::assert_eq!(
|
2346 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2536 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2347 2537 | http_response.status()
|
2348 2538 | );
|
2349 2539 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2350 2540 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2351 2541 | http_response.headers(),
|
2352 2542 | expected_headers,
|
2353 2543 | ));
|
2354 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2544 + | use ::http_body_util::BodyExt;
|
2545 + | let body = http_response
|
2546 + | .into_body()
|
2547 + | .collect()
|
2355 2548 | .await
|
2356 - | .expect("unable to extract body to bytes");
|
2549 + | .expect("unable to collect body")
|
2550 + | .to_bytes();
|
2357 2551 | ::aws_smithy_protocol_test::assert_ok(
|
2358 2552 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/short' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/short' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/short\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2359 2553 | );
|
2360 2554 | }
|
2361 2555 | }
|
2362 2556 |
|
2363 2557 | /// When a short member does not fit within range bounds,
|
2364 2558 | /// the response should be a 400 ValidationException.
|
2365 2559 | /// Test ID: RestJsonMalformedRangeMinShortOverride
|
2366 2560 | #[::tokio::test]
|
2367 2561 | #[::tracing_test::traced_test]
|
2368 2562 | async fn rest_json_malformed_range_min_short_override_malformed_request() {
|
2369 2563 | {
|
2370 2564 | #[allow(unused_mut)]
|
2371 - | let mut http_request = http::Request::builder()
|
2565 + | let mut http_request = ::http_1x::Request::builder()
|
2372 2566 | .uri("/MalformedRangeOverride")
|
2373 2567 | .method("POST")
|
2374 2568 | .header("content-type", "application/json")
|
2375 - | .body(::aws_smithy_http_server::body::Body::from(
|
2376 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2377 - | "{ \"minShort\" : 3 }".as_bytes(),
|
2378 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2569 + | .body(::aws_smithy_http_server::body::boxed(
|
2570 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2571 + | &::aws_smithy_protocol_test::decode_body_data(
|
2572 + | "{ \"minShort\" : 3 }".as_bytes(),
|
2573 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2574 + | ),
|
2379 2575 | )),
|
2380 2576 | ))
|
2381 2577 | .unwrap();
|
2382 2578 | #[allow(unused_mut)]
|
2383 2579 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2384 2580 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2385 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2581 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2386 2582 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2387 2583 | let sender = sender.clone();
|
2388 2584 | async move {
|
2389 2585 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2390 2586 | sender.send(()).await.expect("receiver dropped early");
|
2391 2587 | result
|
2392 2588 | }
|
2393 2589 | })
|
2394 2590 | .build_unchecked();
|
2395 2591 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2396 2592 | .await
|
2397 2593 | .expect("unable to make an HTTP request");
|
2398 2594 | ::pretty_assertions::assert_eq!(
|
2399 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2595 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2400 2596 | http_response.status()
|
2401 2597 | );
|
2402 2598 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2403 2599 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2404 2600 | http_response.headers(),
|
2405 2601 | expected_headers,
|
2406 2602 | ));
|
2407 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2603 + | use ::http_body_util::BodyExt;
|
2604 + | let body = http_response
|
2605 + | .into_body()
|
2606 + | .collect()
|
2408 2607 | .await
|
2409 - | .expect("unable to extract body to bytes");
|
2608 + | .expect("unable to collect body")
|
2609 + | .to_bytes();
|
2410 2610 | ::aws_smithy_protocol_test::assert_ok(
|
2411 2611 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minShort' failed to satisfy constraint: Member must be greater than or equal to 4\",\n \"fieldList\" : [{\"message\": \"Value at '/minShort' failed to satisfy constraint: Member must be greater than or equal to 4\", \"path\": \"/minShort\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2412 2612 | );
|
2413 2613 | }
|
2414 2614 | }
|
2415 2615 |
|
2416 2616 | /// When a short member does not fit within range bounds,
|
2417 2617 | /// the response should be a 400 ValidationException.
|
2418 2618 | /// Test ID: RestJsonMalformedRangeMaxShortOverride
|
2419 2619 | #[::tokio::test]
|
2420 2620 | #[::tracing_test::traced_test]
|
2421 2621 | async fn rest_json_malformed_range_max_short_override_malformed_request() {
|
2422 2622 | {
|
2423 2623 | #[allow(unused_mut)]
|
2424 - | let mut http_request = http::Request::builder()
|
2624 + | let mut http_request = ::http_1x::Request::builder()
|
2425 2625 | .uri("/MalformedRangeOverride")
|
2426 2626 | .method("POST")
|
2427 2627 | .header("content-type", "application/json")
|
2428 - | .body(::aws_smithy_http_server::body::Body::from(
|
2429 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2430 - | "{ \"maxShort\" : 7 }".as_bytes(),
|
2431 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2628 + | .body(::aws_smithy_http_server::body::boxed(
|
2629 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2630 + | &::aws_smithy_protocol_test::decode_body_data(
|
2631 + | "{ \"maxShort\" : 7 }".as_bytes(),
|
2632 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2633 + | ),
|
2432 2634 | )),
|
2433 2635 | ))
|
2434 2636 | .unwrap();
|
2435 2637 | #[allow(unused_mut)]
|
2436 2638 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2437 2639 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2438 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2640 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2439 2641 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2440 2642 | let sender = sender.clone();
|
2441 2643 | async move {
|
2442 2644 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2443 2645 | sender.send(()).await.expect("receiver dropped early");
|
2444 2646 | result
|
2445 2647 | }
|
2446 2648 | })
|
2447 2649 | .build_unchecked();
|
2448 2650 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2449 2651 | .await
|
2450 2652 | .expect("unable to make an HTTP request");
|
2451 2653 | ::pretty_assertions::assert_eq!(
|
2452 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2654 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2453 2655 | http_response.status()
|
2454 2656 | );
|
2455 2657 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2456 2658 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2457 2659 | http_response.headers(),
|
2458 2660 | expected_headers,
|
2459 2661 | ));
|
2460 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2662 + | use ::http_body_util::BodyExt;
|
2663 + | let body = http_response
|
2664 + | .into_body()
|
2665 + | .collect()
|
2461 2666 | .await
|
2462 - | .expect("unable to extract body to bytes");
|
2667 + | .expect("unable to collect body")
|
2668 + | .to_bytes();
|
2463 2669 | ::aws_smithy_protocol_test::assert_ok(
|
2464 2670 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxShort' failed to satisfy constraint: Member must be less than or equal to 6\",\n \"fieldList\" : [{\"message\": \"Value at '/maxShort' failed to satisfy constraint: Member must be less than or equal to 6\", \"path\": \"/maxShort\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2465 2671 | );
|
2466 2672 | }
|
2467 2673 | }
|
2468 2674 |
|
2469 2675 | /// When a integer member does not fit within range bounds,
|
2470 2676 | /// the response should be a 400 ValidationException.
|
2471 2677 | /// Test ID: RestJsonMalformedRangeIntegerOverride_case0
|
2472 2678 | #[::tokio::test]
|
2473 2679 | #[::tracing_test::traced_test]
|
2474 2680 | async fn rest_json_malformed_range_integer_override_case0_malformed_request() {
|
2475 2681 | {
|
2476 2682 | #[allow(unused_mut)]
|
2477 - | let mut http_request = http::Request::builder()
|
2683 + | let mut http_request = ::http_1x::Request::builder()
|
2478 2684 | .uri("/MalformedRangeOverride")
|
2479 2685 | .method("POST")
|
2480 2686 | .header("content-type", "application/json")
|
2481 - | .body(::aws_smithy_http_server::body::Body::from(
|
2482 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2483 - | "{ \"integer\" : 3 }".as_bytes(),
|
2484 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2687 + | .body(::aws_smithy_http_server::body::boxed(
|
2688 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2689 + | &::aws_smithy_protocol_test::decode_body_data(
|
2690 + | "{ \"integer\" : 3 }".as_bytes(),
|
2691 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2692 + | ),
|
2485 2693 | )),
|
2486 2694 | ))
|
2487 2695 | .unwrap();
|
2488 2696 | #[allow(unused_mut)]
|
2489 2697 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2490 2698 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2491 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2699 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2492 2700 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2493 2701 | let sender = sender.clone();
|
2494 2702 | async move {
|
2495 2703 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2496 2704 | sender.send(()).await.expect("receiver dropped early");
|
2497 2705 | result
|
2498 2706 | }
|
2499 2707 | })
|
2500 2708 | .build_unchecked();
|
2501 2709 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2502 2710 | .await
|
2503 2711 | .expect("unable to make an HTTP request");
|
2504 2712 | ::pretty_assertions::assert_eq!(
|
2505 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2713 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2506 2714 | http_response.status()
|
2507 2715 | );
|
2508 2716 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2509 2717 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2510 2718 | http_response.headers(),
|
2511 2719 | expected_headers,
|
2512 2720 | ));
|
2513 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2721 + | use ::http_body_util::BodyExt;
|
2722 + | let body = http_response
|
2723 + | .into_body()
|
2724 + | .collect()
|
2514 2725 | .await
|
2515 - | .expect("unable to extract body to bytes");
|
2726 + | .expect("unable to collect body")
|
2727 + | .to_bytes();
|
2516 2728 | ::aws_smithy_protocol_test::assert_ok(
|
2517 2729 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/integer' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/integer' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/integer\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2518 2730 | );
|
2519 2731 | }
|
2520 2732 | }
|
2521 2733 |
|
2522 2734 | /// When a integer member does not fit within range bounds,
|
2523 2735 | /// the response should be a 400 ValidationException.
|
2524 2736 | /// Test ID: RestJsonMalformedRangeIntegerOverride_case1
|
2525 2737 | #[::tokio::test]
|
2526 2738 | #[::tracing_test::traced_test]
|
2527 2739 | async fn rest_json_malformed_range_integer_override_case1_malformed_request() {
|
2528 2740 | {
|
2529 2741 | #[allow(unused_mut)]
|
2530 - | let mut http_request = http::Request::builder()
|
2742 + | let mut http_request = ::http_1x::Request::builder()
|
2531 2743 | .uri("/MalformedRangeOverride")
|
2532 2744 | .method("POST")
|
2533 2745 | .header("content-type", "application/json")
|
2534 - | .body(::aws_smithy_http_server::body::Body::from(
|
2535 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2536 - | "{ \"integer\" : 7 }".as_bytes(),
|
2537 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2746 + | .body(::aws_smithy_http_server::body::boxed(
|
2747 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2748 + | &::aws_smithy_protocol_test::decode_body_data(
|
2749 + | "{ \"integer\" : 7 }".as_bytes(),
|
2750 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2751 + | ),
|
2538 2752 | )),
|
2539 2753 | ))
|
2540 2754 | .unwrap();
|
2541 2755 | #[allow(unused_mut)]
|
2542 2756 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2543 2757 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2544 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2758 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2545 2759 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2546 2760 | let sender = sender.clone();
|
2547 2761 | async move {
|
2548 2762 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2549 2763 | sender.send(()).await.expect("receiver dropped early");
|
2550 2764 | result
|
2551 2765 | }
|
2552 2766 | })
|
2553 2767 | .build_unchecked();
|
2554 2768 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2555 2769 | .await
|
2556 2770 | .expect("unable to make an HTTP request");
|
2557 2771 | ::pretty_assertions::assert_eq!(
|
2558 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2772 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2559 2773 | http_response.status()
|
2560 2774 | );
|
2561 2775 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2562 2776 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2563 2777 | http_response.headers(),
|
2564 2778 | expected_headers,
|
2565 2779 | ));
|
2566 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2780 + | use ::http_body_util::BodyExt;
|
2781 + | let body = http_response
|
2782 + | .into_body()
|
2783 + | .collect()
|
2567 2784 | .await
|
2568 - | .expect("unable to extract body to bytes");
|
2785 + | .expect("unable to collect body")
|
2786 + | .to_bytes();
|
2569 2787 | ::aws_smithy_protocol_test::assert_ok(
|
2570 2788 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/integer' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/integer' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/integer\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2571 2789 | );
|
2572 2790 | }
|
2573 2791 | }
|
2574 2792 |
|
2575 2793 | /// When a integer member does not fit within range bounds,
|
2576 2794 | /// the response should be a 400 ValidationException.
|
2577 2795 | /// Test ID: RestJsonMalformedRangeMinIntegerOverride
|
2578 2796 | #[::tokio::test]
|
2579 2797 | #[::tracing_test::traced_test]
|
2580 2798 | async fn rest_json_malformed_range_min_integer_override_malformed_request() {
|
2581 2799 | {
|
2582 2800 | #[allow(unused_mut)]
|
2583 - | let mut http_request = http::Request::builder()
|
2801 + | let mut http_request = ::http_1x::Request::builder()
|
2584 2802 | .uri("/MalformedRangeOverride")
|
2585 2803 | .method("POST")
|
2586 2804 | .header("content-type", "application/json")
|
2587 - | .body(::aws_smithy_http_server::body::Body::from(
|
2588 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2589 - | "{ \"minInteger\" : 3 }".as_bytes(),
|
2590 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2805 + | .body(::aws_smithy_http_server::body::boxed(
|
2806 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2807 + | &::aws_smithy_protocol_test::decode_body_data(
|
2808 + | "{ \"minInteger\" : 3 }".as_bytes(),
|
2809 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2810 + | ),
|
2591 2811 | )),
|
2592 2812 | ))
|
2593 2813 | .unwrap();
|
2594 2814 | #[allow(unused_mut)]
|
2595 2815 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2596 2816 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2597 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2817 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2598 2818 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2599 2819 | let sender = sender.clone();
|
2600 2820 | async move {
|
2601 2821 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2602 2822 | sender.send(()).await.expect("receiver dropped early");
|
2603 2823 | result
|
2604 2824 | }
|
2605 2825 | })
|
2606 2826 | .build_unchecked();
|
2607 2827 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2608 2828 | .await
|
2609 2829 | .expect("unable to make an HTTP request");
|
2610 2830 | ::pretty_assertions::assert_eq!(
|
2611 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2831 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2612 2832 | http_response.status()
|
2613 2833 | );
|
2614 2834 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2615 2835 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2616 2836 | http_response.headers(),
|
2617 2837 | expected_headers,
|
2618 2838 | ));
|
2619 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2839 + | use ::http_body_util::BodyExt;
|
2840 + | let body = http_response
|
2841 + | .into_body()
|
2842 + | .collect()
|
2620 2843 | .await
|
2621 - | .expect("unable to extract body to bytes");
|
2844 + | .expect("unable to collect body")
|
2845 + | .to_bytes();
|
2622 2846 | ::aws_smithy_protocol_test::assert_ok(
|
2623 2847 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minInteger' failed to satisfy constraint: Member must be greater than or equal to 4\",\n \"fieldList\" : [{\"message\": \"Value at '/minInteger' failed to satisfy constraint: Member must be greater than or equal to 4\", \"path\": \"/minInteger\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2624 2848 | );
|
2625 2849 | }
|
2626 2850 | }
|
2627 2851 |
|
2628 2852 | /// When a integer member does not fit within range bounds,
|
2629 2853 | /// the response should be a 400 ValidationException.
|
2630 2854 | /// Test ID: RestJsonMalformedRangeMaxIntegerOverride
|
2631 2855 | #[::tokio::test]
|
2632 2856 | #[::tracing_test::traced_test]
|
2633 2857 | async fn rest_json_malformed_range_max_integer_override_malformed_request() {
|
2634 2858 | {
|
2635 2859 | #[allow(unused_mut)]
|
2636 - | let mut http_request = http::Request::builder()
|
2860 + | let mut http_request = ::http_1x::Request::builder()
|
2637 2861 | .uri("/MalformedRangeOverride")
|
2638 2862 | .method("POST")
|
2639 2863 | .header("content-type", "application/json")
|
2640 - | .body(::aws_smithy_http_server::body::Body::from(
|
2641 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2642 - | "{ \"maxInteger\" : 7 }".as_bytes(),
|
2643 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2864 + | .body(::aws_smithy_http_server::body::boxed(
|
2865 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2866 + | &::aws_smithy_protocol_test::decode_body_data(
|
2867 + | "{ \"maxInteger\" : 7 }".as_bytes(),
|
2868 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2869 + | ),
|
2644 2870 | )),
|
2645 2871 | ))
|
2646 2872 | .unwrap();
|
2647 2873 | #[allow(unused_mut)]
|
2648 2874 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2649 2875 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2650 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2876 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2651 2877 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2652 2878 | let sender = sender.clone();
|
2653 2879 | async move {
|
2654 2880 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2655 2881 | sender.send(()).await.expect("receiver dropped early");
|
2656 2882 | result
|
2657 2883 | }
|
2658 2884 | })
|
2659 2885 | .build_unchecked();
|
2660 2886 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2661 2887 | .await
|
2662 2888 | .expect("unable to make an HTTP request");
|
2663 2889 | ::pretty_assertions::assert_eq!(
|
2664 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2890 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2665 2891 | http_response.status()
|
2666 2892 | );
|
2667 2893 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2668 2894 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2669 2895 | http_response.headers(),
|
2670 2896 | expected_headers,
|
2671 2897 | ));
|
2672 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2898 + | use ::http_body_util::BodyExt;
|
2899 + | let body = http_response
|
2900 + | .into_body()
|
2901 + | .collect()
|
2673 2902 | .await
|
2674 - | .expect("unable to extract body to bytes");
|
2903 + | .expect("unable to collect body")
|
2904 + | .to_bytes();
|
2675 2905 | ::aws_smithy_protocol_test::assert_ok(
|
2676 2906 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxInteger' failed to satisfy constraint: Member must be less than or equal to 6\",\n \"fieldList\" : [{\"message\": \"Value at '/maxInteger' failed to satisfy constraint: Member must be less than or equal to 6\", \"path\": \"/maxInteger\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2677 2907 | );
|
2678 2908 | }
|
2679 2909 | }
|
2680 2910 |
|
2681 2911 | /// When a long member does not fit within range bounds,
|
2682 2912 | /// the response should be a 400 ValidationException.
|
2683 2913 | /// Test ID: RestJsonMalformedRangeLongOverride_case0
|
2684 2914 | #[::tokio::test]
|
2685 2915 | #[::tracing_test::traced_test]
|
2686 2916 | async fn rest_json_malformed_range_long_override_case0_malformed_request() {
|
2687 2917 | {
|
2688 2918 | #[allow(unused_mut)]
|
2689 - | let mut http_request = http::Request::builder()
|
2919 + | let mut http_request = ::http_1x::Request::builder()
|
2690 2920 | .uri("/MalformedRangeOverride")
|
2691 2921 | .method("POST")
|
2692 2922 | .header("content-type", "application/json")
|
2693 - | .body(::aws_smithy_http_server::body::Body::from(
|
2694 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2695 - | "{ \"long\" : 3 }".as_bytes(),
|
2696 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2923 + | .body(::aws_smithy_http_server::body::boxed(
|
2924 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2925 + | &::aws_smithy_protocol_test::decode_body_data(
|
2926 + | "{ \"long\" : 3 }".as_bytes(),
|
2927 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2928 + | ),
|
2697 2929 | )),
|
2698 2930 | ))
|
2699 2931 | .unwrap();
|
2700 2932 | #[allow(unused_mut)]
|
2701 2933 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2702 2934 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2703 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2935 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2704 2936 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2705 2937 | let sender = sender.clone();
|
2706 2938 | async move {
|
2707 2939 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2708 2940 | sender.send(()).await.expect("receiver dropped early");
|
2709 2941 | result
|
2710 2942 | }
|
2711 2943 | })
|
2712 2944 | .build_unchecked();
|
2713 2945 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2714 2946 | .await
|
2715 2947 | .expect("unable to make an HTTP request");
|
2716 2948 | ::pretty_assertions::assert_eq!(
|
2717 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2949 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2718 2950 | http_response.status()
|
2719 2951 | );
|
2720 2952 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2721 2953 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2722 2954 | http_response.headers(),
|
2723 2955 | expected_headers,
|
2724 2956 | ));
|
2725 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2957 + | use ::http_body_util::BodyExt;
|
2958 + | let body = http_response
|
2959 + | .into_body()
|
2960 + | .collect()
|
2726 2961 | .await
|
2727 - | .expect("unable to extract body to bytes");
|
2962 + | .expect("unable to collect body")
|
2963 + | .to_bytes();
|
2728 2964 | ::aws_smithy_protocol_test::assert_ok(
|
2729 2965 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/long' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/long' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/long\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2730 2966 | );
|
2731 2967 | }
|
2732 2968 | }
|
2733 2969 |
|
2734 2970 | /// When a long member does not fit within range bounds,
|
2735 2971 | /// the response should be a 400 ValidationException.
|
2736 2972 | /// Test ID: RestJsonMalformedRangeLongOverride_case1
|
2737 2973 | #[::tokio::test]
|
2738 2974 | #[::tracing_test::traced_test]
|
2739 2975 | async fn rest_json_malformed_range_long_override_case1_malformed_request() {
|
2740 2976 | {
|
2741 2977 | #[allow(unused_mut)]
|
2742 - | let mut http_request = http::Request::builder()
|
2978 + | let mut http_request = ::http_1x::Request::builder()
|
2743 2979 | .uri("/MalformedRangeOverride")
|
2744 2980 | .method("POST")
|
2745 2981 | .header("content-type", "application/json")
|
2746 - | .body(::aws_smithy_http_server::body::Body::from(
|
2747 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2748 - | "{ \"long\" : 7 }".as_bytes(),
|
2749 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2982 + | .body(::aws_smithy_http_server::body::boxed(
|
2983 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2984 + | &::aws_smithy_protocol_test::decode_body_data(
|
2985 + | "{ \"long\" : 7 }".as_bytes(),
|
2986 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
2987 + | ),
|
2750 2988 | )),
|
2751 2989 | ))
|
2752 2990 | .unwrap();
|
2753 2991 | #[allow(unused_mut)]
|
2754 2992 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2755 2993 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2756 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
2994 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2757 2995 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2758 2996 | let sender = sender.clone();
|
2759 2997 | async move {
|
2760 2998 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2761 2999 | sender.send(()).await.expect("receiver dropped early");
|
2762 3000 | result
|
2763 3001 | }
|
2764 3002 | })
|
2765 3003 | .build_unchecked();
|
2766 3004 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2767 3005 | .await
|
2768 3006 | .expect("unable to make an HTTP request");
|
2769 3007 | ::pretty_assertions::assert_eq!(
|
2770 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3008 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2771 3009 | http_response.status()
|
2772 3010 | );
|
2773 3011 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2774 3012 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2775 3013 | http_response.headers(),
|
2776 3014 | expected_headers,
|
2777 3015 | ));
|
2778 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3016 + | use ::http_body_util::BodyExt;
|
3017 + | let body = http_response
|
3018 + | .into_body()
|
3019 + | .collect()
|
2779 3020 | .await
|
2780 - | .expect("unable to extract body to bytes");
|
3021 + | .expect("unable to collect body")
|
3022 + | .to_bytes();
|
2781 3023 | ::aws_smithy_protocol_test::assert_ok(
|
2782 3024 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/long' failed to satisfy constraint: Member must be between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/long' failed to satisfy constraint: Member must be between 4 and 6, inclusive\", \"path\": \"/long\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2783 3025 | );
|
2784 3026 | }
|
2785 3027 | }
|
2786 3028 |
|
2787 3029 | /// When a long member does not fit within range bounds,
|
2788 3030 | /// the response should be a 400 ValidationException.
|
2789 3031 | /// Test ID: RestJsonMalformedRangeMinLongOverride
|
2790 3032 | #[::tokio::test]
|
2791 3033 | #[::tracing_test::traced_test]
|
2792 3034 | async fn rest_json_malformed_range_min_long_override_malformed_request() {
|
2793 3035 | {
|
2794 3036 | #[allow(unused_mut)]
|
2795 - | let mut http_request = http::Request::builder()
|
3037 + | let mut http_request = ::http_1x::Request::builder()
|
2796 3038 | .uri("/MalformedRangeOverride")
|
2797 3039 | .method("POST")
|
2798 3040 | .header("content-type", "application/json")
|
2799 - | .body(::aws_smithy_http_server::body::Body::from(
|
2800 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2801 - | "{ \"minLong\" : 3 }".as_bytes(),
|
2802 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3041 + | .body(::aws_smithy_http_server::body::boxed(
|
3042 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3043 + | &::aws_smithy_protocol_test::decode_body_data(
|
3044 + | "{ \"minLong\" : 3 }".as_bytes(),
|
3045 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3046 + | ),
|
2803 3047 | )),
|
2804 3048 | ))
|
2805 3049 | .unwrap();
|
2806 3050 | #[allow(unused_mut)]
|
2807 3051 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2808 3052 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2809 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3053 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2810 3054 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2811 3055 | let sender = sender.clone();
|
2812 3056 | async move {
|
2813 3057 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2814 3058 | sender.send(()).await.expect("receiver dropped early");
|
2815 3059 | result
|
2816 3060 | }
|
2817 3061 | })
|
2818 3062 | .build_unchecked();
|
2819 3063 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2820 3064 | .await
|
2821 3065 | .expect("unable to make an HTTP request");
|
2822 3066 | ::pretty_assertions::assert_eq!(
|
2823 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3067 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2824 3068 | http_response.status()
|
2825 3069 | );
|
2826 3070 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2827 3071 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2828 3072 | http_response.headers(),
|
2829 3073 | expected_headers,
|
2830 3074 | ));
|
2831 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3075 + | use ::http_body_util::BodyExt;
|
3076 + | let body = http_response
|
3077 + | .into_body()
|
3078 + | .collect()
|
2832 3079 | .await
|
2833 - | .expect("unable to extract body to bytes");
|
3080 + | .expect("unable to collect body")
|
3081 + | .to_bytes();
|
2834 3082 | ::aws_smithy_protocol_test::assert_ok(
|
2835 3083 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minLong' failed to satisfy constraint: Member must be greater than or equal to 4\",\n \"fieldList\" : [{\"message\": \"Value at '/minLong' failed to satisfy constraint: Member must be greater than or equal to 4\", \"path\": \"/minLong\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2836 3084 | );
|
2837 3085 | }
|
2838 3086 | }
|
2839 3087 |
|
2840 3088 | /// When a long member does not fit within range bounds,
|
2841 3089 | /// the response should be a 400 ValidationException.
|
2842 3090 | /// Test ID: RestJsonMalformedRangeMaxLongOverride
|
2843 3091 | #[::tokio::test]
|
2844 3092 | #[::tracing_test::traced_test]
|
2845 3093 | async fn rest_json_malformed_range_max_long_override_malformed_request() {
|
2846 3094 | {
|
2847 3095 | #[allow(unused_mut)]
|
2848 - | let mut http_request = http::Request::builder()
|
3096 + | let mut http_request = ::http_1x::Request::builder()
|
2849 3097 | .uri("/MalformedRangeOverride")
|
2850 3098 | .method("POST")
|
2851 3099 | .header("content-type", "application/json")
|
2852 - | .body(::aws_smithy_http_server::body::Body::from(
|
2853 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2854 - | "{ \"maxLong\" : 7 }".as_bytes(),
|
2855 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3100 + | .body(::aws_smithy_http_server::body::boxed(
|
3101 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3102 + | &::aws_smithy_protocol_test::decode_body_data(
|
3103 + | "{ \"maxLong\" : 7 }".as_bytes(),
|
3104 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3105 + | ),
|
2856 3106 | )),
|
2857 3107 | ))
|
2858 3108 | .unwrap();
|
2859 3109 | #[allow(unused_mut)]
|
2860 3110 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2861 3111 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
2862 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3112 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2863 3113 | .malformed_range_override(move |input: crate::input::MalformedRangeOverrideInput| {
|
2864 3114 | let sender = sender.clone();
|
2865 3115 | async move {
|
2866 3116 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOverrideOutput, crate::error::MalformedRangeOverrideError> };
|
2867 3117 | sender.send(()).await.expect("receiver dropped early");
|
2868 3118 | result
|
2869 3119 | }
|
2870 3120 | })
|
2871 3121 | .build_unchecked();
|
2872 3122 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2873 3123 | .await
|
2874 3124 | .expect("unable to make an HTTP request");
|
2875 3125 | ::pretty_assertions::assert_eq!(
|
2876 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3126 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
2877 3127 | http_response.status()
|
2878 3128 | );
|
2879 3129 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
2880 3130 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2881 3131 | http_response.headers(),
|
2882 3132 | expected_headers,
|
2883 3133 | ));
|
2884 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3134 + | use ::http_body_util::BodyExt;
|
3135 + | let body = http_response
|
3136 + | .into_body()
|
3137 + | .collect()
|
2885 3138 | .await
|
2886 - | .expect("unable to extract body to bytes");
|
3139 + | .expect("unable to collect body")
|
3140 + | .to_bytes();
|
2887 3141 | ::aws_smithy_protocol_test::assert_ok(
|
2888 3142 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxLong' failed to satisfy constraint: Member must be less than or equal to 6\",\n \"fieldList\" : [{\"message\": \"Value at '/maxLong' failed to satisfy constraint: Member must be less than or equal to 6\", \"path\": \"/maxLong\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2889 3143 | );
|
2890 3144 | }
|
2891 3145 | }
|
2892 3146 | }
|
2893 3147 |
|
2894 3148 | ::pin_project_lite::pin_project! {
|
2895 3149 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2896 3150 | /// [`MalformedRangeInput`](crate::input::MalformedRangeInput) using modelled bindings.
|
2897 3151 | pub struct MalformedRangeInputFuture {
|
2898 3152 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedRangeInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
2899 3153 | }
|
2900 3154 | }
|
2901 3155 |
|
2902 3156 | impl std::future::Future for MalformedRangeInputFuture {
|
2903 3157 | type Output = Result<
|
2904 3158 | crate::input::MalformedRangeInput,
|
2905 3159 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
2906 3160 | >;
|
2907 3161 |
|
2908 3162 | fn poll(
|
2909 3163 | self: std::pin::Pin<&mut Self>,
|
2910 3164 | cx: &mut std::task::Context<'_>,
|
2911 3165 | ) -> std::task::Poll<Self::Output> {
|
2912 3166 | let this = self.project();
|
2913 3167 | this.inner.as_mut().poll(cx)
|
2914 3168 | }
|
2915 3169 | }
|
2916 3170 |
|
2917 3171 | impl<B>
|
2918 3172 | ::aws_smithy_http_server::request::FromRequest<
|
2919 3173 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
2920 3174 | B,
|
2921 3175 | > for crate::input::MalformedRangeInput
|
2922 3176 | where
|
2923 3177 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2924 3178 | B: 'static,
|
2925 3179 |
|
2926 3180 | B::Data: Send,
|
2927 3181 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
2928 3182 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2929 3183 | {
|
2930 3184 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
2931 3185 | type Future = MalformedRangeInputFuture;
|
2932 3186 |
|
2933 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3187 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2934 3188 | let fut = async move {
|
2935 3189 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2936 3190 | request.headers(),
|
2937 3191 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
2938 3192 | ) {
|
2939 3193 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
2940 3194 | }
|
2941 3195 | crate::protocol_serde::shape_malformed_range::de_malformed_range_http_request(request)
|
2942 3196 | .await
|
2943 3197 | };
|
2997 3251 | mod malformed_range_test {
|
2998 3252 |
|
2999 3253 | /// When a byte member does not fit within range bounds,
|
3000 3254 | /// the response should be a 400 ValidationException.
|
3001 3255 | /// Test ID: RestJsonMalformedRangeByte_case0
|
3002 3256 | #[::tokio::test]
|
3003 3257 | #[::tracing_test::traced_test]
|
3004 3258 | async fn rest_json_malformed_range_byte_case0_malformed_request() {
|
3005 3259 | {
|
3006 3260 | #[allow(unused_mut)]
|
3007 - | let mut http_request = http::Request::builder()
|
3261 + | let mut http_request = ::http_1x::Request::builder()
|
3008 3262 | .uri("/MalformedRange")
|
3009 3263 | .method("POST")
|
3010 3264 | .header("content-type", "application/json")
|
3011 - | .body(::aws_smithy_http_server::body::Body::from(
|
3012 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3013 - | "{ \"byte\" : 1 }".as_bytes(),
|
3014 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3265 + | .body(::aws_smithy_http_server::body::boxed(
|
3266 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3267 + | &::aws_smithy_protocol_test::decode_body_data(
|
3268 + | "{ \"byte\" : 1 }".as_bytes(),
|
3269 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3270 + | ),
|
3015 3271 | )),
|
3016 3272 | ))
|
3017 3273 | .unwrap();
|
3018 3274 | #[allow(unused_mut)]
|
3019 3275 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3020 3276 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3021 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3277 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3022 3278 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3023 3279 | let sender = sender.clone();
|
3024 3280 | async move {
|
3025 3281 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3026 3282 | sender.send(()).await.expect("receiver dropped early");
|
3027 3283 | result
|
3028 3284 | }
|
3029 3285 | })
|
3030 3286 | .build_unchecked();
|
3031 3287 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3032 3288 | .await
|
3033 3289 | .expect("unable to make an HTTP request");
|
3034 3290 | ::pretty_assertions::assert_eq!(
|
3035 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3291 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3036 3292 | http_response.status()
|
3037 3293 | );
|
3038 3294 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3039 3295 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3040 3296 | http_response.headers(),
|
3041 3297 | expected_headers,
|
3042 3298 | ));
|
3043 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3299 + | use ::http_body_util::BodyExt;
|
3300 + | let body = http_response
|
3301 + | .into_body()
|
3302 + | .collect()
|
3044 3303 | .await
|
3045 - | .expect("unable to extract body to bytes");
|
3304 + | .expect("unable to collect body")
|
3305 + | .to_bytes();
|
3046 3306 | ::aws_smithy_protocol_test::assert_ok(
|
3047 3307 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/byte' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/byte' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/byte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3048 3308 | );
|
3049 3309 | }
|
3050 3310 | }
|
3051 3311 |
|
3052 3312 | /// When a byte member does not fit within range bounds,
|
3053 3313 | /// the response should be a 400 ValidationException.
|
3054 3314 | /// Test ID: RestJsonMalformedRangeByte_case1
|
3055 3315 | #[::tokio::test]
|
3056 3316 | #[::tracing_test::traced_test]
|
3057 3317 | async fn rest_json_malformed_range_byte_case1_malformed_request() {
|
3058 3318 | {
|
3059 3319 | #[allow(unused_mut)]
|
3060 - | let mut http_request = http::Request::builder()
|
3320 + | let mut http_request = ::http_1x::Request::builder()
|
3061 3321 | .uri("/MalformedRange")
|
3062 3322 | .method("POST")
|
3063 3323 | .header("content-type", "application/json")
|
3064 - | .body(::aws_smithy_http_server::body::Body::from(
|
3065 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3066 - | "{ \"byte\" : 9 }".as_bytes(),
|
3067 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3324 + | .body(::aws_smithy_http_server::body::boxed(
|
3325 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3326 + | &::aws_smithy_protocol_test::decode_body_data(
|
3327 + | "{ \"byte\" : 9 }".as_bytes(),
|
3328 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3329 + | ),
|
3068 3330 | )),
|
3069 3331 | ))
|
3070 3332 | .unwrap();
|
3071 3333 | #[allow(unused_mut)]
|
3072 3334 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3073 3335 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3074 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3336 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3075 3337 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3076 3338 | let sender = sender.clone();
|
3077 3339 | async move {
|
3078 3340 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3079 3341 | sender.send(()).await.expect("receiver dropped early");
|
3080 3342 | result
|
3081 3343 | }
|
3082 3344 | })
|
3083 3345 | .build_unchecked();
|
3084 3346 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3085 3347 | .await
|
3086 3348 | .expect("unable to make an HTTP request");
|
3087 3349 | ::pretty_assertions::assert_eq!(
|
3088 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3350 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3089 3351 | http_response.status()
|
3090 3352 | );
|
3091 3353 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3092 3354 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3093 3355 | http_response.headers(),
|
3094 3356 | expected_headers,
|
3095 3357 | ));
|
3096 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3358 + | use ::http_body_util::BodyExt;
|
3359 + | let body = http_response
|
3360 + | .into_body()
|
3361 + | .collect()
|
3097 3362 | .await
|
3098 - | .expect("unable to extract body to bytes");
|
3363 + | .expect("unable to collect body")
|
3364 + | .to_bytes();
|
3099 3365 | ::aws_smithy_protocol_test::assert_ok(
|
3100 3366 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/byte' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/byte' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/byte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3101 3367 | );
|
3102 3368 | }
|
3103 3369 | }
|
3104 3370 |
|
3105 3371 | /// When a byte member does not fit within range bounds,
|
3106 3372 | /// the response should be a 400 ValidationException.
|
3107 3373 | /// Test ID: RestJsonMalformedRangeMinByte
|
3108 3374 | #[::tokio::test]
|
3109 3375 | #[::tracing_test::traced_test]
|
3110 3376 | async fn rest_json_malformed_range_min_byte_malformed_request() {
|
3111 3377 | {
|
3112 3378 | #[allow(unused_mut)]
|
3113 - | let mut http_request = http::Request::builder()
|
3379 + | let mut http_request = ::http_1x::Request::builder()
|
3114 3380 | .uri("/MalformedRange")
|
3115 3381 | .method("POST")
|
3116 3382 | .header("content-type", "application/json")
|
3117 - | .body(::aws_smithy_http_server::body::Body::from(
|
3118 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3119 - | "{ \"minByte\" : 1 }".as_bytes(),
|
3120 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3383 + | .body(::aws_smithy_http_server::body::boxed(
|
3384 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3385 + | &::aws_smithy_protocol_test::decode_body_data(
|
3386 + | "{ \"minByte\" : 1 }".as_bytes(),
|
3387 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3388 + | ),
|
3121 3389 | )),
|
3122 3390 | ))
|
3123 3391 | .unwrap();
|
3124 3392 | #[allow(unused_mut)]
|
3125 3393 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3126 3394 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3127 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3395 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3128 3396 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3129 3397 | let sender = sender.clone();
|
3130 3398 | async move {
|
3131 3399 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3132 3400 | sender.send(()).await.expect("receiver dropped early");
|
3133 3401 | result
|
3134 3402 | }
|
3135 3403 | })
|
3136 3404 | .build_unchecked();
|
3137 3405 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3138 3406 | .await
|
3139 3407 | .expect("unable to make an HTTP request");
|
3140 3408 | ::pretty_assertions::assert_eq!(
|
3141 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3409 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3142 3410 | http_response.status()
|
3143 3411 | );
|
3144 3412 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3145 3413 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3146 3414 | http_response.headers(),
|
3147 3415 | expected_headers,
|
3148 3416 | ));
|
3149 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3417 + | use ::http_body_util::BodyExt;
|
3418 + | let body = http_response
|
3419 + | .into_body()
|
3420 + | .collect()
|
3150 3421 | .await
|
3151 - | .expect("unable to extract body to bytes");
|
3422 + | .expect("unable to collect body")
|
3423 + | .to_bytes();
|
3152 3424 | ::aws_smithy_protocol_test::assert_ok(
|
3153 3425 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minByte' failed to satisfy constraint: Member must be greater than or equal to 2\",\n \"fieldList\" : [{\"message\": \"Value at '/minByte' failed to satisfy constraint: Member must be greater than or equal to 2\", \"path\": \"/minByte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3154 3426 | );
|
3155 3427 | }
|
3156 3428 | }
|
3157 3429 |
|
3158 3430 | /// When a byte member does not fit within range bounds,
|
3159 3431 | /// the response should be a 400 ValidationException.
|
3160 3432 | /// Test ID: RestJsonMalformedRangeMaxByte
|
3161 3433 | #[::tokio::test]
|
3162 3434 | #[::tracing_test::traced_test]
|
3163 3435 | async fn rest_json_malformed_range_max_byte_malformed_request() {
|
3164 3436 | {
|
3165 3437 | #[allow(unused_mut)]
|
3166 - | let mut http_request = http::Request::builder()
|
3438 + | let mut http_request = ::http_1x::Request::builder()
|
3167 3439 | .uri("/MalformedRange")
|
3168 3440 | .method("POST")
|
3169 3441 | .header("content-type", "application/json")
|
3170 - | .body(::aws_smithy_http_server::body::Body::from(
|
3171 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3172 - | "{ \"maxByte\" : 9 }".as_bytes(),
|
3173 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3442 + | .body(::aws_smithy_http_server::body::boxed(
|
3443 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3444 + | &::aws_smithy_protocol_test::decode_body_data(
|
3445 + | "{ \"maxByte\" : 9 }".as_bytes(),
|
3446 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3447 + | ),
|
3174 3448 | )),
|
3175 3449 | ))
|
3176 3450 | .unwrap();
|
3177 3451 | #[allow(unused_mut)]
|
3178 3452 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3179 3453 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3180 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3454 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3181 3455 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3182 3456 | let sender = sender.clone();
|
3183 3457 | async move {
|
3184 3458 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3185 3459 | sender.send(()).await.expect("receiver dropped early");
|
3186 3460 | result
|
3187 3461 | }
|
3188 3462 | })
|
3189 3463 | .build_unchecked();
|
3190 3464 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3191 3465 | .await
|
3192 3466 | .expect("unable to make an HTTP request");
|
3193 3467 | ::pretty_assertions::assert_eq!(
|
3194 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3468 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3195 3469 | http_response.status()
|
3196 3470 | );
|
3197 3471 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3198 3472 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3199 3473 | http_response.headers(),
|
3200 3474 | expected_headers,
|
3201 3475 | ));
|
3202 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3476 + | use ::http_body_util::BodyExt;
|
3477 + | let body = http_response
|
3478 + | .into_body()
|
3479 + | .collect()
|
3203 3480 | .await
|
3204 - | .expect("unable to extract body to bytes");
|
3481 + | .expect("unable to collect body")
|
3482 + | .to_bytes();
|
3205 3483 | ::aws_smithy_protocol_test::assert_ok(
|
3206 3484 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxByte' failed to satisfy constraint: Member must be less than or equal to 8\",\n \"fieldList\" : [{\"message\": \"Value at '/maxByte' failed to satisfy constraint: Member must be less than or equal to 8\", \"path\": \"/maxByte\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3207 3485 | );
|
3208 3486 | }
|
3209 3487 | }
|
3210 3488 |
|
3211 3489 | /// When a float member does not fit within range bounds,
|
3212 3490 | /// the response should be a 400 ValidationException.
|
3213 3491 | /// Test ID: RestJsonMalformedRangeFloat_case0
|
3214 3492 | #[::tokio::test]
|
3215 3493 | #[::tracing_test::traced_test]
|
3216 3494 | #[should_panic]
|
3217 3495 | async fn rest_json_malformed_range_float_case0_malformed_request() {
|
3218 3496 | {
|
3219 3497 | #[allow(unused_mut)]
|
3220 - | let mut http_request = http::Request::builder()
|
3498 + | let mut http_request = ::http_1x::Request::builder()
|
3221 3499 | .uri("/MalformedRange")
|
3222 3500 | .method("POST")
|
3223 3501 | .header("content-type", "application/json")
|
3224 - | .body(::aws_smithy_http_server::body::Body::from(
|
3225 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3226 - | "{ \"float\" : 2.1 }".as_bytes(),
|
3227 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3502 + | .body(::aws_smithy_http_server::body::boxed(
|
3503 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3504 + | &::aws_smithy_protocol_test::decode_body_data(
|
3505 + | "{ \"float\" : 2.1 }".as_bytes(),
|
3506 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3507 + | ),
|
3228 3508 | )),
|
3229 3509 | ))
|
3230 3510 | .unwrap();
|
3231 3511 | #[allow(unused_mut)]
|
3232 3512 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3233 3513 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3234 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3514 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3235 3515 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3236 3516 | let sender = sender.clone();
|
3237 3517 | async move {
|
3238 3518 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3239 3519 | sender.send(()).await.expect("receiver dropped early");
|
3240 3520 | result
|
3241 3521 | }
|
3242 3522 | })
|
3243 3523 | .build_unchecked();
|
3244 3524 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3245 3525 | .await
|
3246 3526 | .expect("unable to make an HTTP request");
|
3247 3527 | ::pretty_assertions::assert_eq!(
|
3248 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3528 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3249 3529 | http_response.status()
|
3250 3530 | );
|
3251 3531 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3252 3532 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3253 3533 | http_response.headers(),
|
3254 3534 | expected_headers,
|
3255 3535 | ));
|
3256 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3536 + | use ::http_body_util::BodyExt;
|
3537 + | let body = http_response
|
3538 + | .into_body()
|
3539 + | .collect()
|
3257 3540 | .await
|
3258 - | .expect("unable to extract body to bytes");
|
3541 + | .expect("unable to collect body")
|
3542 + | .to_bytes();
|
3259 3543 | ::aws_smithy_protocol_test::assert_ok(
|
3260 3544 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/float' failed to satisfy constraint: Member must be between 2.2 and 8.8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/float' failed to satisfy constraint: Member must be between 2.2 and 8.8, inclusive\", \"path\": \"/float\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3261 3545 | );
|
3262 3546 | }
|
3263 3547 | }
|
3264 3548 |
|
3265 3549 | /// When a float member does not fit within range bounds,
|
3266 3550 | /// the response should be a 400 ValidationException.
|
3267 3551 | /// Test ID: RestJsonMalformedRangeFloat_case1
|
3268 3552 | #[::tokio::test]
|
3269 3553 | #[::tracing_test::traced_test]
|
3270 3554 | #[should_panic]
|
3271 3555 | async fn rest_json_malformed_range_float_case1_malformed_request() {
|
3272 3556 | {
|
3273 3557 | #[allow(unused_mut)]
|
3274 - | let mut http_request = http::Request::builder()
|
3558 + | let mut http_request = ::http_1x::Request::builder()
|
3275 3559 | .uri("/MalformedRange")
|
3276 3560 | .method("POST")
|
3277 3561 | .header("content-type", "application/json")
|
3278 - | .body(::aws_smithy_http_server::body::Body::from(
|
3279 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3280 - | "{ \"float\" : 8.9 }".as_bytes(),
|
3281 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3562 + | .body(::aws_smithy_http_server::body::boxed(
|
3563 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3564 + | &::aws_smithy_protocol_test::decode_body_data(
|
3565 + | "{ \"float\" : 8.9 }".as_bytes(),
|
3566 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3567 + | ),
|
3282 3568 | )),
|
3283 3569 | ))
|
3284 3570 | .unwrap();
|
3285 3571 | #[allow(unused_mut)]
|
3286 3572 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3287 3573 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3288 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3574 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3289 3575 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3290 3576 | let sender = sender.clone();
|
3291 3577 | async move {
|
3292 3578 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3293 3579 | sender.send(()).await.expect("receiver dropped early");
|
3294 3580 | result
|
3295 3581 | }
|
3296 3582 | })
|
3297 3583 | .build_unchecked();
|
3298 3584 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3299 3585 | .await
|
3300 3586 | .expect("unable to make an HTTP request");
|
3301 3587 | ::pretty_assertions::assert_eq!(
|
3302 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3588 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3303 3589 | http_response.status()
|
3304 3590 | );
|
3305 3591 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3306 3592 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3307 3593 | http_response.headers(),
|
3308 3594 | expected_headers,
|
3309 3595 | ));
|
3310 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3596 + | use ::http_body_util::BodyExt;
|
3597 + | let body = http_response
|
3598 + | .into_body()
|
3599 + | .collect()
|
3311 3600 | .await
|
3312 - | .expect("unable to extract body to bytes");
|
3601 + | .expect("unable to collect body")
|
3602 + | .to_bytes();
|
3313 3603 | ::aws_smithy_protocol_test::assert_ok(
|
3314 3604 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/float' failed to satisfy constraint: Member must be between 2.2 and 8.8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/float' failed to satisfy constraint: Member must be between 2.2 and 8.8, inclusive\", \"path\": \"/float\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3315 3605 | );
|
3316 3606 | }
|
3317 3607 | }
|
3318 3608 |
|
3319 3609 | /// When a float member does not fit within range bounds,
|
3320 3610 | /// the response should be a 400 ValidationException.
|
3321 3611 | /// Test ID: RestJsonMalformedRangeMinFloat
|
3322 3612 | #[::tokio::test]
|
3323 3613 | #[::tracing_test::traced_test]
|
3324 3614 | #[should_panic]
|
3325 3615 | async fn rest_json_malformed_range_min_float_malformed_request() {
|
3326 3616 | {
|
3327 3617 | #[allow(unused_mut)]
|
3328 - | let mut http_request = http::Request::builder()
|
3618 + | let mut http_request = ::http_1x::Request::builder()
|
3329 3619 | .uri("/MalformedRange")
|
3330 3620 | .method("POST")
|
3331 3621 | .header("content-type", "application/json")
|
3332 - | .body(::aws_smithy_http_server::body::Body::from(
|
3333 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3334 - | "{ \"minFloat\" : 2.1 }".as_bytes(),
|
3335 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3622 + | .body(::aws_smithy_http_server::body::boxed(
|
3623 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3624 + | &::aws_smithy_protocol_test::decode_body_data(
|
3625 + | "{ \"minFloat\" : 2.1 }".as_bytes(),
|
3626 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3627 + | ),
|
3336 3628 | )),
|
3337 3629 | ))
|
3338 3630 | .unwrap();
|
3339 3631 | #[allow(unused_mut)]
|
3340 3632 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3341 3633 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3342 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3634 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3343 3635 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3344 3636 | let sender = sender.clone();
|
3345 3637 | async move {
|
3346 3638 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3347 3639 | sender.send(()).await.expect("receiver dropped early");
|
3348 3640 | result
|
3349 3641 | }
|
3350 3642 | })
|
3351 3643 | .build_unchecked();
|
3352 3644 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3353 3645 | .await
|
3354 3646 | .expect("unable to make an HTTP request");
|
3355 3647 | ::pretty_assertions::assert_eq!(
|
3356 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3648 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3357 3649 | http_response.status()
|
3358 3650 | );
|
3359 3651 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3360 3652 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3361 3653 | http_response.headers(),
|
3362 3654 | expected_headers,
|
3363 3655 | ));
|
3364 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3656 + | use ::http_body_util::BodyExt;
|
3657 + | let body = http_response
|
3658 + | .into_body()
|
3659 + | .collect()
|
3365 3660 | .await
|
3366 - | .expect("unable to extract body to bytes");
|
3661 + | .expect("unable to collect body")
|
3662 + | .to_bytes();
|
3367 3663 | ::aws_smithy_protocol_test::assert_ok(
|
3368 3664 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minFloat' failed to satisfy constraint: Member must be greater than or equal to 2.2\",\n \"fieldList\" : [{\"message\": \"Value at '/minFloat' failed to satisfy constraint: Member must be greater than or equal to 2.2\", \"path\": \"/minFloat\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3369 3665 | );
|
3370 3666 | }
|
3371 3667 | }
|
3372 3668 |
|
3373 3669 | /// When a float member does not fit within range bounds,
|
3374 3670 | /// the response should be a 400 ValidationException.
|
3375 3671 | /// Test ID: RestJsonMalformedRangeMaxFloat
|
3376 3672 | #[::tokio::test]
|
3377 3673 | #[::tracing_test::traced_test]
|
3378 3674 | #[should_panic]
|
3379 3675 | async fn rest_json_malformed_range_max_float_malformed_request() {
|
3380 3676 | {
|
3381 3677 | #[allow(unused_mut)]
|
3382 - | let mut http_request = http::Request::builder()
|
3678 + | let mut http_request = ::http_1x::Request::builder()
|
3383 3679 | .uri("/MalformedRange")
|
3384 3680 | .method("POST")
|
3385 3681 | .header("content-type", "application/json")
|
3386 - | .body(::aws_smithy_http_server::body::Body::from(
|
3387 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3388 - | "{ \"maxFloat\" : 8.9 }".as_bytes(),
|
3389 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3682 + | .body(::aws_smithy_http_server::body::boxed(
|
3683 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3684 + | &::aws_smithy_protocol_test::decode_body_data(
|
3685 + | "{ \"maxFloat\" : 8.9 }".as_bytes(),
|
3686 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3687 + | ),
|
3390 3688 | )),
|
3391 3689 | ))
|
3392 3690 | .unwrap();
|
3393 3691 | #[allow(unused_mut)]
|
3394 3692 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3395 3693 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3396 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3694 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3397 3695 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3398 3696 | let sender = sender.clone();
|
3399 3697 | async move {
|
3400 3698 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3401 3699 | sender.send(()).await.expect("receiver dropped early");
|
3402 3700 | result
|
3403 3701 | }
|
3404 3702 | })
|
3405 3703 | .build_unchecked();
|
3406 3704 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3407 3705 | .await
|
3408 3706 | .expect("unable to make an HTTP request");
|
3409 3707 | ::pretty_assertions::assert_eq!(
|
3410 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3708 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3411 3709 | http_response.status()
|
3412 3710 | );
|
3413 3711 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3414 3712 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3415 3713 | http_response.headers(),
|
3416 3714 | expected_headers,
|
3417 3715 | ));
|
3418 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3716 + | use ::http_body_util::BodyExt;
|
3717 + | let body = http_response
|
3718 + | .into_body()
|
3719 + | .collect()
|
3419 3720 | .await
|
3420 - | .expect("unable to extract body to bytes");
|
3721 + | .expect("unable to collect body")
|
3722 + | .to_bytes();
|
3421 3723 | ::aws_smithy_protocol_test::assert_ok(
|
3422 3724 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxFloat' failed to satisfy constraint: Member must be less than or equal to 8.8\",\n \"fieldList\" : [{\"message\": \"Value at '/maxFloat' failed to satisfy constraint: Member must be less than or equal to 8.8\", \"path\": \"/maxFloat\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3423 3725 | );
|
3424 3726 | }
|
3425 3727 | }
|
3426 3728 |
|
3427 3729 | /// When a short member does not fit within range bounds,
|
3428 3730 | /// the response should be a 400 ValidationException.
|
3429 3731 | /// Test ID: RestJsonMalformedRangeShort_case0
|
3430 3732 | #[::tokio::test]
|
3431 3733 | #[::tracing_test::traced_test]
|
3432 3734 | async fn rest_json_malformed_range_short_case0_malformed_request() {
|
3433 3735 | {
|
3434 3736 | #[allow(unused_mut)]
|
3435 - | let mut http_request = http::Request::builder()
|
3737 + | let mut http_request = ::http_1x::Request::builder()
|
3436 3738 | .uri("/MalformedRange")
|
3437 3739 | .method("POST")
|
3438 3740 | .header("content-type", "application/json")
|
3439 - | .body(::aws_smithy_http_server::body::Body::from(
|
3440 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3441 - | "{ \"short\" : 1 }".as_bytes(),
|
3442 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3741 + | .body(::aws_smithy_http_server::body::boxed(
|
3742 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3743 + | &::aws_smithy_protocol_test::decode_body_data(
|
3744 + | "{ \"short\" : 1 }".as_bytes(),
|
3745 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3746 + | ),
|
3443 3747 | )),
|
3444 3748 | ))
|
3445 3749 | .unwrap();
|
3446 3750 | #[allow(unused_mut)]
|
3447 3751 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3448 3752 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3449 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3753 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3450 3754 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3451 3755 | let sender = sender.clone();
|
3452 3756 | async move {
|
3453 3757 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3454 3758 | sender.send(()).await.expect("receiver dropped early");
|
3455 3759 | result
|
3456 3760 | }
|
3457 3761 | })
|
3458 3762 | .build_unchecked();
|
3459 3763 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3460 3764 | .await
|
3461 3765 | .expect("unable to make an HTTP request");
|
3462 3766 | ::pretty_assertions::assert_eq!(
|
3463 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3767 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3464 3768 | http_response.status()
|
3465 3769 | );
|
3466 3770 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3467 3771 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3468 3772 | http_response.headers(),
|
3469 3773 | expected_headers,
|
3470 3774 | ));
|
3471 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3775 + | use ::http_body_util::BodyExt;
|
3776 + | let body = http_response
|
3777 + | .into_body()
|
3778 + | .collect()
|
3472 3779 | .await
|
3473 - | .expect("unable to extract body to bytes");
|
3780 + | .expect("unable to collect body")
|
3781 + | .to_bytes();
|
3474 3782 | ::aws_smithy_protocol_test::assert_ok(
|
3475 3783 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/short' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/short' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/short\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3476 3784 | );
|
3477 3785 | }
|
3478 3786 | }
|
3479 3787 |
|
3480 3788 | /// When a short member does not fit within range bounds,
|
3481 3789 | /// the response should be a 400 ValidationException.
|
3482 3790 | /// Test ID: RestJsonMalformedRangeShort_case1
|
3483 3791 | #[::tokio::test]
|
3484 3792 | #[::tracing_test::traced_test]
|
3485 3793 | async fn rest_json_malformed_range_short_case1_malformed_request() {
|
3486 3794 | {
|
3487 3795 | #[allow(unused_mut)]
|
3488 - | let mut http_request = http::Request::builder()
|
3796 + | let mut http_request = ::http_1x::Request::builder()
|
3489 3797 | .uri("/MalformedRange")
|
3490 3798 | .method("POST")
|
3491 3799 | .header("content-type", "application/json")
|
3492 - | .body(::aws_smithy_http_server::body::Body::from(
|
3493 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3494 - | "{ \"short\" : 9 }".as_bytes(),
|
3495 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3800 + | .body(::aws_smithy_http_server::body::boxed(
|
3801 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3802 + | &::aws_smithy_protocol_test::decode_body_data(
|
3803 + | "{ \"short\" : 9 }".as_bytes(),
|
3804 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3805 + | ),
|
3496 3806 | )),
|
3497 3807 | ))
|
3498 3808 | .unwrap();
|
3499 3809 | #[allow(unused_mut)]
|
3500 3810 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3501 3811 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3502 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3812 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3503 3813 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3504 3814 | let sender = sender.clone();
|
3505 3815 | async move {
|
3506 3816 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3507 3817 | sender.send(()).await.expect("receiver dropped early");
|
3508 3818 | result
|
3509 3819 | }
|
3510 3820 | })
|
3511 3821 | .build_unchecked();
|
3512 3822 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3513 3823 | .await
|
3514 3824 | .expect("unable to make an HTTP request");
|
3515 3825 | ::pretty_assertions::assert_eq!(
|
3516 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3826 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3517 3827 | http_response.status()
|
3518 3828 | );
|
3519 3829 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3520 3830 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3521 3831 | http_response.headers(),
|
3522 3832 | expected_headers,
|
3523 3833 | ));
|
3524 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3834 + | use ::http_body_util::BodyExt;
|
3835 + | let body = http_response
|
3836 + | .into_body()
|
3837 + | .collect()
|
3525 3838 | .await
|
3526 - | .expect("unable to extract body to bytes");
|
3839 + | .expect("unable to collect body")
|
3840 + | .to_bytes();
|
3527 3841 | ::aws_smithy_protocol_test::assert_ok(
|
3528 3842 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/short' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/short' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/short\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3529 3843 | );
|
3530 3844 | }
|
3531 3845 | }
|
3532 3846 |
|
3533 3847 | /// When a short member does not fit within range bounds,
|
3534 3848 | /// the response should be a 400 ValidationException.
|
3535 3849 | /// Test ID: RestJsonMalformedRangeMinShort
|
3536 3850 | #[::tokio::test]
|
3537 3851 | #[::tracing_test::traced_test]
|
3538 3852 | async fn rest_json_malformed_range_min_short_malformed_request() {
|
3539 3853 | {
|
3540 3854 | #[allow(unused_mut)]
|
3541 - | let mut http_request = http::Request::builder()
|
3855 + | let mut http_request = ::http_1x::Request::builder()
|
3542 3856 | .uri("/MalformedRange")
|
3543 3857 | .method("POST")
|
3544 3858 | .header("content-type", "application/json")
|
3545 - | .body(::aws_smithy_http_server::body::Body::from(
|
3546 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3547 - | "{ \"minShort\" : 1 }".as_bytes(),
|
3548 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3859 + | .body(::aws_smithy_http_server::body::boxed(
|
3860 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3861 + | &::aws_smithy_protocol_test::decode_body_data(
|
3862 + | "{ \"minShort\" : 1 }".as_bytes(),
|
3863 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3864 + | ),
|
3549 3865 | )),
|
3550 3866 | ))
|
3551 3867 | .unwrap();
|
3552 3868 | #[allow(unused_mut)]
|
3553 3869 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3554 3870 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3555 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3871 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3556 3872 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3557 3873 | let sender = sender.clone();
|
3558 3874 | async move {
|
3559 3875 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3560 3876 | sender.send(()).await.expect("receiver dropped early");
|
3561 3877 | result
|
3562 3878 | }
|
3563 3879 | })
|
3564 3880 | .build_unchecked();
|
3565 3881 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3566 3882 | .await
|
3567 3883 | .expect("unable to make an HTTP request");
|
3568 3884 | ::pretty_assertions::assert_eq!(
|
3569 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3885 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3570 3886 | http_response.status()
|
3571 3887 | );
|
3572 3888 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3573 3889 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3574 3890 | http_response.headers(),
|
3575 3891 | expected_headers,
|
3576 3892 | ));
|
3577 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3893 + | use ::http_body_util::BodyExt;
|
3894 + | let body = http_response
|
3895 + | .into_body()
|
3896 + | .collect()
|
3578 3897 | .await
|
3579 - | .expect("unable to extract body to bytes");
|
3898 + | .expect("unable to collect body")
|
3899 + | .to_bytes();
|
3580 3900 | ::aws_smithy_protocol_test::assert_ok(
|
3581 3901 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minShort' failed to satisfy constraint: Member must be greater than or equal to 2\",\n \"fieldList\" : [{\"message\": \"Value at '/minShort' failed to satisfy constraint: Member must be greater than or equal to 2\", \"path\": \"/minShort\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3582 3902 | );
|
3583 3903 | }
|
3584 3904 | }
|
3585 3905 |
|
3586 3906 | /// When a short member does not fit within range bounds,
|
3587 3907 | /// the response should be a 400 ValidationException.
|
3588 3908 | /// Test ID: RestJsonMalformedRangeMaxShort
|
3589 3909 | #[::tokio::test]
|
3590 3910 | #[::tracing_test::traced_test]
|
3591 3911 | async fn rest_json_malformed_range_max_short_malformed_request() {
|
3592 3912 | {
|
3593 3913 | #[allow(unused_mut)]
|
3594 - | let mut http_request = http::Request::builder()
|
3914 + | let mut http_request = ::http_1x::Request::builder()
|
3595 3915 | .uri("/MalformedRange")
|
3596 3916 | .method("POST")
|
3597 3917 | .header("content-type", "application/json")
|
3598 - | .body(::aws_smithy_http_server::body::Body::from(
|
3599 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3600 - | "{ \"maxShort\" : 9 }".as_bytes(),
|
3601 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3918 + | .body(::aws_smithy_http_server::body::boxed(
|
3919 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3920 + | &::aws_smithy_protocol_test::decode_body_data(
|
3921 + | "{ \"maxShort\" : 9 }".as_bytes(),
|
3922 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3923 + | ),
|
3602 3924 | )),
|
3603 3925 | ))
|
3604 3926 | .unwrap();
|
3605 3927 | #[allow(unused_mut)]
|
3606 3928 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3607 3929 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3608 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3930 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3609 3931 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3610 3932 | let sender = sender.clone();
|
3611 3933 | async move {
|
3612 3934 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3613 3935 | sender.send(()).await.expect("receiver dropped early");
|
3614 3936 | result
|
3615 3937 | }
|
3616 3938 | })
|
3617 3939 | .build_unchecked();
|
3618 3940 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3619 3941 | .await
|
3620 3942 | .expect("unable to make an HTTP request");
|
3621 3943 | ::pretty_assertions::assert_eq!(
|
3622 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3944 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3623 3945 | http_response.status()
|
3624 3946 | );
|
3625 3947 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3626 3948 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3627 3949 | http_response.headers(),
|
3628 3950 | expected_headers,
|
3629 3951 | ));
|
3630 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3952 + | use ::http_body_util::BodyExt;
|
3953 + | let body = http_response
|
3954 + | .into_body()
|
3955 + | .collect()
|
3631 3956 | .await
|
3632 - | .expect("unable to extract body to bytes");
|
3957 + | .expect("unable to collect body")
|
3958 + | .to_bytes();
|
3633 3959 | ::aws_smithy_protocol_test::assert_ok(
|
3634 3960 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxShort' failed to satisfy constraint: Member must be less than or equal to 8\",\n \"fieldList\" : [{\"message\": \"Value at '/maxShort' failed to satisfy constraint: Member must be less than or equal to 8\", \"path\": \"/maxShort\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3635 3961 | );
|
3636 3962 | }
|
3637 3963 | }
|
3638 3964 |
|
3639 3965 | /// When a integer member does not fit within range bounds,
|
3640 3966 | /// the response should be a 400 ValidationException.
|
3641 3967 | /// Test ID: RestJsonMalformedRangeInteger_case0
|
3642 3968 | #[::tokio::test]
|
3643 3969 | #[::tracing_test::traced_test]
|
3644 3970 | async fn rest_json_malformed_range_integer_case0_malformed_request() {
|
3645 3971 | {
|
3646 3972 | #[allow(unused_mut)]
|
3647 - | let mut http_request = http::Request::builder()
|
3973 + | let mut http_request = ::http_1x::Request::builder()
|
3648 3974 | .uri("/MalformedRange")
|
3649 3975 | .method("POST")
|
3650 3976 | .header("content-type", "application/json")
|
3651 - | .body(::aws_smithy_http_server::body::Body::from(
|
3652 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3653 - | "{ \"integer\" : 1 }".as_bytes(),
|
3654 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3977 + | .body(::aws_smithy_http_server::body::boxed(
|
3978 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3979 + | &::aws_smithy_protocol_test::decode_body_data(
|
3980 + | "{ \"integer\" : 1 }".as_bytes(),
|
3981 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3982 + | ),
|
3655 3983 | )),
|
3656 3984 | ))
|
3657 3985 | .unwrap();
|
3658 3986 | #[allow(unused_mut)]
|
3659 3987 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3660 3988 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3661 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
3989 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3662 3990 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3663 3991 | let sender = sender.clone();
|
3664 3992 | async move {
|
3665 3993 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3666 3994 | sender.send(()).await.expect("receiver dropped early");
|
3667 3995 | result
|
3668 3996 | }
|
3669 3997 | })
|
3670 3998 | .build_unchecked();
|
3671 3999 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3672 4000 | .await
|
3673 4001 | .expect("unable to make an HTTP request");
|
3674 4002 | ::pretty_assertions::assert_eq!(
|
3675 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4003 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3676 4004 | http_response.status()
|
3677 4005 | );
|
3678 4006 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3679 4007 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3680 4008 | http_response.headers(),
|
3681 4009 | expected_headers,
|
3682 4010 | ));
|
3683 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4011 + | use ::http_body_util::BodyExt;
|
4012 + | let body = http_response
|
4013 + | .into_body()
|
4014 + | .collect()
|
3684 4015 | .await
|
3685 - | .expect("unable to extract body to bytes");
|
4016 + | .expect("unable to collect body")
|
4017 + | .to_bytes();
|
3686 4018 | ::aws_smithy_protocol_test::assert_ok(
|
3687 4019 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/integer' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/integer' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/integer\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3688 4020 | );
|
3689 4021 | }
|
3690 4022 | }
|
3691 4023 |
|
3692 4024 | /// When a integer member does not fit within range bounds,
|
3693 4025 | /// the response should be a 400 ValidationException.
|
3694 4026 | /// Test ID: RestJsonMalformedRangeInteger_case1
|
3695 4027 | #[::tokio::test]
|
3696 4028 | #[::tracing_test::traced_test]
|
3697 4029 | async fn rest_json_malformed_range_integer_case1_malformed_request() {
|
3698 4030 | {
|
3699 4031 | #[allow(unused_mut)]
|
3700 - | let mut http_request = http::Request::builder()
|
4032 + | let mut http_request = ::http_1x::Request::builder()
|
3701 4033 | .uri("/MalformedRange")
|
3702 4034 | .method("POST")
|
3703 4035 | .header("content-type", "application/json")
|
3704 - | .body(::aws_smithy_http_server::body::Body::from(
|
3705 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3706 - | "{ \"integer\" : 9 }".as_bytes(),
|
3707 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4036 + | .body(::aws_smithy_http_server::body::boxed(
|
4037 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4038 + | &::aws_smithy_protocol_test::decode_body_data(
|
4039 + | "{ \"integer\" : 9 }".as_bytes(),
|
4040 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4041 + | ),
|
3708 4042 | )),
|
3709 4043 | ))
|
3710 4044 | .unwrap();
|
3711 4045 | #[allow(unused_mut)]
|
3712 4046 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3713 4047 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3714 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4048 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3715 4049 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3716 4050 | let sender = sender.clone();
|
3717 4051 | async move {
|
3718 4052 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3719 4053 | sender.send(()).await.expect("receiver dropped early");
|
3720 4054 | result
|
3721 4055 | }
|
3722 4056 | })
|
3723 4057 | .build_unchecked();
|
3724 4058 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3725 4059 | .await
|
3726 4060 | .expect("unable to make an HTTP request");
|
3727 4061 | ::pretty_assertions::assert_eq!(
|
3728 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4062 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3729 4063 | http_response.status()
|
3730 4064 | );
|
3731 4065 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3732 4066 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3733 4067 | http_response.headers(),
|
3734 4068 | expected_headers,
|
3735 4069 | ));
|
3736 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4070 + | use ::http_body_util::BodyExt;
|
4071 + | let body = http_response
|
4072 + | .into_body()
|
4073 + | .collect()
|
3737 4074 | .await
|
3738 - | .expect("unable to extract body to bytes");
|
4075 + | .expect("unable to collect body")
|
4076 + | .to_bytes();
|
3739 4077 | ::aws_smithy_protocol_test::assert_ok(
|
3740 4078 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/integer' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/integer' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/integer\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3741 4079 | );
|
3742 4080 | }
|
3743 4081 | }
|
3744 4082 |
|
3745 4083 | /// When a integer member does not fit within range bounds,
|
3746 4084 | /// the response should be a 400 ValidationException.
|
3747 4085 | /// Test ID: RestJsonMalformedRangeMinInteger
|
3748 4086 | #[::tokio::test]
|
3749 4087 | #[::tracing_test::traced_test]
|
3750 4088 | async fn rest_json_malformed_range_min_integer_malformed_request() {
|
3751 4089 | {
|
3752 4090 | #[allow(unused_mut)]
|
3753 - | let mut http_request = http::Request::builder()
|
4091 + | let mut http_request = ::http_1x::Request::builder()
|
3754 4092 | .uri("/MalformedRange")
|
3755 4093 | .method("POST")
|
3756 4094 | .header("content-type", "application/json")
|
3757 - | .body(::aws_smithy_http_server::body::Body::from(
|
3758 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3759 - | "{ \"minInteger\" : 1 }".as_bytes(),
|
3760 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4095 + | .body(::aws_smithy_http_server::body::boxed(
|
4096 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4097 + | &::aws_smithy_protocol_test::decode_body_data(
|
4098 + | "{ \"minInteger\" : 1 }".as_bytes(),
|
4099 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4100 + | ),
|
3761 4101 | )),
|
3762 4102 | ))
|
3763 4103 | .unwrap();
|
3764 4104 | #[allow(unused_mut)]
|
3765 4105 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3766 4106 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3767 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4107 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3768 4108 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3769 4109 | let sender = sender.clone();
|
3770 4110 | async move {
|
3771 4111 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3772 4112 | sender.send(()).await.expect("receiver dropped early");
|
3773 4113 | result
|
3774 4114 | }
|
3775 4115 | })
|
3776 4116 | .build_unchecked();
|
3777 4117 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3778 4118 | .await
|
3779 4119 | .expect("unable to make an HTTP request");
|
3780 4120 | ::pretty_assertions::assert_eq!(
|
3781 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4121 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3782 4122 | http_response.status()
|
3783 4123 | );
|
3784 4124 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3785 4125 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3786 4126 | http_response.headers(),
|
3787 4127 | expected_headers,
|
3788 4128 | ));
|
3789 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4129 + | use ::http_body_util::BodyExt;
|
4130 + | let body = http_response
|
4131 + | .into_body()
|
4132 + | .collect()
|
3790 4133 | .await
|
3791 - | .expect("unable to extract body to bytes");
|
4134 + | .expect("unable to collect body")
|
4135 + | .to_bytes();
|
3792 4136 | ::aws_smithy_protocol_test::assert_ok(
|
3793 4137 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minInteger' failed to satisfy constraint: Member must be greater than or equal to 2\",\n \"fieldList\" : [{\"message\": \"Value at '/minInteger' failed to satisfy constraint: Member must be greater than or equal to 2\", \"path\": \"/minInteger\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3794 4138 | );
|
3795 4139 | }
|
3796 4140 | }
|
3797 4141 |
|
3798 4142 | /// When a integer member does not fit within range bounds,
|
3799 4143 | /// the response should be a 400 ValidationException.
|
3800 4144 | /// Test ID: RestJsonMalformedRangeMaxInteger
|
3801 4145 | #[::tokio::test]
|
3802 4146 | #[::tracing_test::traced_test]
|
3803 4147 | async fn rest_json_malformed_range_max_integer_malformed_request() {
|
3804 4148 | {
|
3805 4149 | #[allow(unused_mut)]
|
3806 - | let mut http_request = http::Request::builder()
|
4150 + | let mut http_request = ::http_1x::Request::builder()
|
3807 4151 | .uri("/MalformedRange")
|
3808 4152 | .method("POST")
|
3809 4153 | .header("content-type", "application/json")
|
3810 - | .body(::aws_smithy_http_server::body::Body::from(
|
3811 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3812 - | "{ \"maxInteger\" : 9 }".as_bytes(),
|
3813 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4154 + | .body(::aws_smithy_http_server::body::boxed(
|
4155 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4156 + | &::aws_smithy_protocol_test::decode_body_data(
|
4157 + | "{ \"maxInteger\" : 9 }".as_bytes(),
|
4158 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4159 + | ),
|
3814 4160 | )),
|
3815 4161 | ))
|
3816 4162 | .unwrap();
|
3817 4163 | #[allow(unused_mut)]
|
3818 4164 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3819 4165 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3820 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4166 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3821 4167 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3822 4168 | let sender = sender.clone();
|
3823 4169 | async move {
|
3824 4170 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3825 4171 | sender.send(()).await.expect("receiver dropped early");
|
3826 4172 | result
|
3827 4173 | }
|
3828 4174 | })
|
3829 4175 | .build_unchecked();
|
3830 4176 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3831 4177 | .await
|
3832 4178 | .expect("unable to make an HTTP request");
|
3833 4179 | ::pretty_assertions::assert_eq!(
|
3834 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4180 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3835 4181 | http_response.status()
|
3836 4182 | );
|
3837 4183 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3838 4184 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3839 4185 | http_response.headers(),
|
3840 4186 | expected_headers,
|
3841 4187 | ));
|
3842 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4188 + | use ::http_body_util::BodyExt;
|
4189 + | let body = http_response
|
4190 + | .into_body()
|
4191 + | .collect()
|
3843 4192 | .await
|
3844 - | .expect("unable to extract body to bytes");
|
4193 + | .expect("unable to collect body")
|
4194 + | .to_bytes();
|
3845 4195 | ::aws_smithy_protocol_test::assert_ok(
|
3846 4196 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxInteger' failed to satisfy constraint: Member must be less than or equal to 8\",\n \"fieldList\" : [{\"message\": \"Value at '/maxInteger' failed to satisfy constraint: Member must be less than or equal to 8\", \"path\": \"/maxInteger\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3847 4197 | );
|
3848 4198 | }
|
3849 4199 | }
|
3850 4200 |
|
3851 4201 | /// When a long member does not fit within range bounds,
|
3852 4202 | /// the response should be a 400 ValidationException.
|
3853 4203 | /// Test ID: RestJsonMalformedRangeLong_case0
|
3854 4204 | #[::tokio::test]
|
3855 4205 | #[::tracing_test::traced_test]
|
3856 4206 | async fn rest_json_malformed_range_long_case0_malformed_request() {
|
3857 4207 | {
|
3858 4208 | #[allow(unused_mut)]
|
3859 - | let mut http_request = http::Request::builder()
|
4209 + | let mut http_request = ::http_1x::Request::builder()
|
3860 4210 | .uri("/MalformedRange")
|
3861 4211 | .method("POST")
|
3862 4212 | .header("content-type", "application/json")
|
3863 - | .body(::aws_smithy_http_server::body::Body::from(
|
3864 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3865 - | "{ \"long\" : 1 }".as_bytes(),
|
3866 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4213 + | .body(::aws_smithy_http_server::body::boxed(
|
4214 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4215 + | &::aws_smithy_protocol_test::decode_body_data(
|
4216 + | "{ \"long\" : 1 }".as_bytes(),
|
4217 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4218 + | ),
|
3867 4219 | )),
|
3868 4220 | ))
|
3869 4221 | .unwrap();
|
3870 4222 | #[allow(unused_mut)]
|
3871 4223 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3872 4224 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3873 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4225 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3874 4226 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3875 4227 | let sender = sender.clone();
|
3876 4228 | async move {
|
3877 4229 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3878 4230 | sender.send(()).await.expect("receiver dropped early");
|
3879 4231 | result
|
3880 4232 | }
|
3881 4233 | })
|
3882 4234 | .build_unchecked();
|
3883 4235 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3884 4236 | .await
|
3885 4237 | .expect("unable to make an HTTP request");
|
3886 4238 | ::pretty_assertions::assert_eq!(
|
3887 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4239 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3888 4240 | http_response.status()
|
3889 4241 | );
|
3890 4242 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3891 4243 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3892 4244 | http_response.headers(),
|
3893 4245 | expected_headers,
|
3894 4246 | ));
|
3895 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4247 + | use ::http_body_util::BodyExt;
|
4248 + | let body = http_response
|
4249 + | .into_body()
|
4250 + | .collect()
|
3896 4251 | .await
|
3897 - | .expect("unable to extract body to bytes");
|
4252 + | .expect("unable to collect body")
|
4253 + | .to_bytes();
|
3898 4254 | ::aws_smithy_protocol_test::assert_ok(
|
3899 4255 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/long' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/long' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/long\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3900 4256 | );
|
3901 4257 | }
|
3902 4258 | }
|
3903 4259 |
|
3904 4260 | /// When a long member does not fit within range bounds,
|
3905 4261 | /// the response should be a 400 ValidationException.
|
3906 4262 | /// Test ID: RestJsonMalformedRangeLong_case1
|
3907 4263 | #[::tokio::test]
|
3908 4264 | #[::tracing_test::traced_test]
|
3909 4265 | async fn rest_json_malformed_range_long_case1_malformed_request() {
|
3910 4266 | {
|
3911 4267 | #[allow(unused_mut)]
|
3912 - | let mut http_request = http::Request::builder()
|
4268 + | let mut http_request = ::http_1x::Request::builder()
|
3913 4269 | .uri("/MalformedRange")
|
3914 4270 | .method("POST")
|
3915 4271 | .header("content-type", "application/json")
|
3916 - | .body(::aws_smithy_http_server::body::Body::from(
|
3917 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3918 - | "{ \"long\" : 9 }".as_bytes(),
|
3919 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4272 + | .body(::aws_smithy_http_server::body::boxed(
|
4273 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4274 + | &::aws_smithy_protocol_test::decode_body_data(
|
4275 + | "{ \"long\" : 9 }".as_bytes(),
|
4276 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4277 + | ),
|
3920 4278 | )),
|
3921 4279 | ))
|
3922 4280 | .unwrap();
|
3923 4281 | #[allow(unused_mut)]
|
3924 4282 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3925 4283 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3926 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4284 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3927 4285 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3928 4286 | let sender = sender.clone();
|
3929 4287 | async move {
|
3930 4288 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3931 4289 | sender.send(()).await.expect("receiver dropped early");
|
3932 4290 | result
|
3933 4291 | }
|
3934 4292 | })
|
3935 4293 | .build_unchecked();
|
3936 4294 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3937 4295 | .await
|
3938 4296 | .expect("unable to make an HTTP request");
|
3939 4297 | ::pretty_assertions::assert_eq!(
|
3940 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4298 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3941 4299 | http_response.status()
|
3942 4300 | );
|
3943 4301 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3944 4302 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3945 4303 | http_response.headers(),
|
3946 4304 | expected_headers,
|
3947 4305 | ));
|
3948 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4306 + | use ::http_body_util::BodyExt;
|
4307 + | let body = http_response
|
4308 + | .into_body()
|
4309 + | .collect()
|
3949 4310 | .await
|
3950 - | .expect("unable to extract body to bytes");
|
4311 + | .expect("unable to collect body")
|
4312 + | .to_bytes();
|
3951 4313 | ::aws_smithy_protocol_test::assert_ok(
|
3952 4314 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/long' failed to satisfy constraint: Member must be between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value at '/long' failed to satisfy constraint: Member must be between 2 and 8, inclusive\", \"path\": \"/long\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3953 4315 | );
|
3954 4316 | }
|
3955 4317 | }
|
3956 4318 |
|
3957 4319 | /// When a long member does not fit within range bounds,
|
3958 4320 | /// the response should be a 400 ValidationException.
|
3959 4321 | /// Test ID: RestJsonMalformedRangeMinLong
|
3960 4322 | #[::tokio::test]
|
3961 4323 | #[::tracing_test::traced_test]
|
3962 4324 | async fn rest_json_malformed_range_min_long_malformed_request() {
|
3963 4325 | {
|
3964 4326 | #[allow(unused_mut)]
|
3965 - | let mut http_request = http::Request::builder()
|
4327 + | let mut http_request = ::http_1x::Request::builder()
|
3966 4328 | .uri("/MalformedRange")
|
3967 4329 | .method("POST")
|
3968 4330 | .header("content-type", "application/json")
|
3969 - | .body(::aws_smithy_http_server::body::Body::from(
|
3970 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3971 - | "{ \"minLong\" : 1 }".as_bytes(),
|
3972 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4331 + | .body(::aws_smithy_http_server::body::boxed(
|
4332 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4333 + | &::aws_smithy_protocol_test::decode_body_data(
|
4334 + | "{ \"minLong\" : 1 }".as_bytes(),
|
4335 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4336 + | ),
|
3973 4337 | )),
|
3974 4338 | ))
|
3975 4339 | .unwrap();
|
3976 4340 | #[allow(unused_mut)]
|
3977 4341 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3978 4342 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
3979 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4343 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3980 4344 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
3981 4345 | let sender = sender.clone();
|
3982 4346 | async move {
|
3983 4347 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
3984 4348 | sender.send(()).await.expect("receiver dropped early");
|
3985 4349 | result
|
3986 4350 | }
|
3987 4351 | })
|
3988 4352 | .build_unchecked();
|
3989 4353 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3990 4354 | .await
|
3991 4355 | .expect("unable to make an HTTP request");
|
3992 4356 | ::pretty_assertions::assert_eq!(
|
3993 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4357 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3994 4358 | http_response.status()
|
3995 4359 | );
|
3996 4360 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
3997 4361 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3998 4362 | http_response.headers(),
|
3999 4363 | expected_headers,
|
4000 4364 | ));
|
4001 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4365 + | use ::http_body_util::BodyExt;
|
4366 + | let body = http_response
|
4367 + | .into_body()
|
4368 + | .collect()
|
4002 4369 | .await
|
4003 - | .expect("unable to extract body to bytes");
|
4370 + | .expect("unable to collect body")
|
4371 + | .to_bytes();
|
4004 4372 | ::aws_smithy_protocol_test::assert_ok(
|
4005 4373 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/minLong' failed to satisfy constraint: Member must be greater than or equal to 2\",\n \"fieldList\" : [{\"message\": \"Value at '/minLong' failed to satisfy constraint: Member must be greater than or equal to 2\", \"path\": \"/minLong\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4006 4374 | );
|
4007 4375 | }
|
4008 4376 | }
|
4009 4377 |
|
4010 4378 | /// When a long member does not fit within range bounds,
|
4011 4379 | /// the response should be a 400 ValidationException.
|
4012 4380 | /// Test ID: RestJsonMalformedRangeMaxLong
|
4013 4381 | #[::tokio::test]
|
4014 4382 | #[::tracing_test::traced_test]
|
4015 4383 | async fn rest_json_malformed_range_max_long_malformed_request() {
|
4016 4384 | {
|
4017 4385 | #[allow(unused_mut)]
|
4018 - | let mut http_request = http::Request::builder()
|
4386 + | let mut http_request = ::http_1x::Request::builder()
|
4019 4387 | .uri("/MalformedRange")
|
4020 4388 | .method("POST")
|
4021 4389 | .header("content-type", "application/json")
|
4022 - | .body(::aws_smithy_http_server::body::Body::from(
|
4023 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4024 - | "{ \"maxLong\" : 9 }".as_bytes(),
|
4025 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4390 + | .body(::aws_smithy_http_server::body::boxed(
|
4391 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4392 + | &::aws_smithy_protocol_test::decode_body_data(
|
4393 + | "{ \"maxLong\" : 9 }".as_bytes(),
|
4394 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4395 + | ),
|
4026 4396 | )),
|
4027 4397 | ))
|
4028 4398 | .unwrap();
|
4029 4399 | #[allow(unused_mut)]
|
4030 4400 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4031 4401 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4032 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4402 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4033 4403 | .malformed_range(move |input: crate::input::MalformedRangeInput| {
|
4034 4404 | let sender = sender.clone();
|
4035 4405 | async move {
|
4036 4406 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedRangeOutput, crate::error::MalformedRangeError> };
|
4037 4407 | sender.send(()).await.expect("receiver dropped early");
|
4038 4408 | result
|
4039 4409 | }
|
4040 4410 | })
|
4041 4411 | .build_unchecked();
|
4042 4412 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4043 4413 | .await
|
4044 4414 | .expect("unable to make an HTTP request");
|
4045 4415 | ::pretty_assertions::assert_eq!(
|
4046 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4416 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4047 4417 | http_response.status()
|
4048 4418 | );
|
4049 4419 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4050 4420 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4051 4421 | http_response.headers(),
|
4052 4422 | expected_headers,
|
4053 4423 | ));
|
4054 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4424 + | use ::http_body_util::BodyExt;
|
4425 + | let body = http_response
|
4426 + | .into_body()
|
4427 + | .collect()
|
4055 4428 | .await
|
4056 - | .expect("unable to extract body to bytes");
|
4429 + | .expect("unable to collect body")
|
4430 + | .to_bytes();
|
4057 4431 | ::aws_smithy_protocol_test::assert_ok(
|
4058 4432 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/maxLong' failed to satisfy constraint: Member must be less than or equal to 8\",\n \"fieldList\" : [{\"message\": \"Value at '/maxLong' failed to satisfy constraint: Member must be less than or equal to 8\", \"path\": \"/maxLong\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4059 4433 | );
|
4060 4434 | }
|
4061 4435 | }
|
4062 4436 | }
|
4063 4437 |
|
4064 4438 | ::pin_project_lite::pin_project! {
|
4065 4439 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
4066 4440 | /// [`MalformedPatternOverrideInput`](crate::input::MalformedPatternOverrideInput) using modelled bindings.
|
4067 4441 | pub struct MalformedPatternOverrideInputFuture {
|
4068 4442 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedPatternOverrideInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
4069 4443 | }
|
4070 4444 | }
|
4071 4445 |
|
4072 4446 | impl std::future::Future for MalformedPatternOverrideInputFuture {
|
4073 4447 | type Output = Result<
|
4074 4448 | crate::input::MalformedPatternOverrideInput,
|
4075 4449 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
4076 4450 | >;
|
4077 4451 |
|
4078 4452 | fn poll(
|
4079 4453 | self: std::pin::Pin<&mut Self>,
|
4080 4454 | cx: &mut std::task::Context<'_>,
|
4081 4455 | ) -> std::task::Poll<Self::Output> {
|
4082 4456 | let this = self.project();
|
4083 4457 | this.inner.as_mut().poll(cx)
|
4084 4458 | }
|
4085 4459 | }
|
4086 4460 |
|
4087 4461 | impl<B>
|
4088 4462 | ::aws_smithy_http_server::request::FromRequest<
|
4089 4463 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
4090 4464 | B,
|
4091 4465 | > for crate::input::MalformedPatternOverrideInput
|
4092 4466 | where
|
4093 4467 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
4094 4468 | B: 'static,
|
4095 4469 |
|
4096 4470 | B::Data: Send,
|
4097 4471 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
4098 4472 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
4099 4473 | {
|
4100 4474 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
4101 4475 | type Future = MalformedPatternOverrideInputFuture;
|
4102 4476 |
|
4103 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
4477 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
4104 4478 | let fut = async move {
|
4105 4479 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
4106 4480 | request.headers(),
|
4107 4481 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
4108 4482 | ) {
|
4109 4483 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
4110 4484 | }
|
4111 4485 | crate::protocol_serde::shape_malformed_pattern_override::de_malformed_pattern_override_http_request(request)
|
4112 4486 | .await
|
4113 4487 | };
|
4164 4538 | mod malformed_pattern_override_test {
|
4165 4539 |
|
4166 4540 | /// When a string member does not match the specified pattern,
|
4167 4541 | /// the response should be a 400 ValidationException.
|
4168 4542 | /// Test ID: RestJsonMalformedPatternStringOverride_case0
|
4169 4543 | #[::tokio::test]
|
4170 4544 | #[::tracing_test::traced_test]
|
4171 4545 | async fn rest_json_malformed_pattern_string_override_case0_malformed_request() {
|
4172 4546 | {
|
4173 4547 | #[allow(unused_mut)]
|
4174 - | let mut http_request = http::Request::builder()
|
4548 + | let mut http_request = ::http_1x::Request::builder()
|
4175 4549 | .uri("/MalformedPatternOverride")
|
4176 4550 | .method("POST")
|
4177 4551 | .header("content-type", "application/json")
|
4178 - | .body(::aws_smithy_http_server::body::Body::from(
|
4179 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4180 - | "{ \"string\" : \"abc\" }".as_bytes(),
|
4181 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4552 + | .body(::aws_smithy_http_server::body::boxed(
|
4553 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4554 + | &::aws_smithy_protocol_test::decode_body_data(
|
4555 + | "{ \"string\" : \"abc\" }".as_bytes(),
|
4556 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4557 + | ),
|
4182 4558 | )),
|
4183 4559 | ))
|
4184 4560 | .unwrap();
|
4185 4561 | #[allow(unused_mut)]
|
4186 4562 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4187 4563 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4188 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4564 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4189 4565 | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4190 4566 | let sender = sender.clone();
|
4191 4567 | async move {
|
4192 4568 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
4193 4569 | sender.send(()).await.expect("receiver dropped early");
|
4194 4570 | result
|
4195 4571 | }
|
4196 4572 | })
|
4197 4573 | .build_unchecked();
|
4198 4574 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4199 4575 | .await
|
4200 4576 | .expect("unable to make an HTTP request");
|
4201 4577 | ::pretty_assertions::assert_eq!(
|
4202 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4578 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4203 4579 | http_response.status()
|
4204 4580 | );
|
4205 4581 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4206 4582 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4207 4583 | http_response.headers(),
|
4208 4584 | expected_headers,
|
4209 4585 | ));
|
4210 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4586 + | use ::http_body_util::BodyExt;
|
4587 + | let body = http_response
|
4588 + | .into_body()
|
4589 + | .collect()
|
4211 4590 | .await
|
4212 - | .expect("unable to extract body to bytes");
|
4591 + | .expect("unable to collect body")
|
4592 + | .to_bytes();
|
4213 4593 | ::aws_smithy_protocol_test::assert_ok(
|
4214 4594 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4215 4595 | );
|
4216 4596 | }
|
4217 4597 | }
|
4218 4598 |
|
4219 4599 | /// When a string member does not match the specified pattern,
|
4220 4600 | /// the response should be a 400 ValidationException.
|
4221 4601 | /// Test ID: RestJsonMalformedPatternStringOverride_case1
|
4222 4602 | #[::tokio::test]
|
4223 4603 | #[::tracing_test::traced_test]
|
4224 4604 | async fn rest_json_malformed_pattern_string_override_case1_malformed_request() {
|
4225 4605 | {
|
4226 4606 | #[allow(unused_mut)]
|
4227 - | let mut http_request = http::Request::builder()
|
4607 + | let mut http_request = ::http_1x::Request::builder()
|
4228 4608 | .uri("/MalformedPatternOverride")
|
4229 4609 | .method("POST")
|
4230 4610 | .header("content-type", "application/json")
|
4231 - | .body(::aws_smithy_http_server::body::Body::from(
|
4232 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4233 - | "{ \"string\" : \"xyz\" }".as_bytes(),
|
4234 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4611 + | .body(::aws_smithy_http_server::body::boxed(
|
4612 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4613 + | &::aws_smithy_protocol_test::decode_body_data(
|
4614 + | "{ \"string\" : \"xyz\" }".as_bytes(),
|
4615 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4616 + | ),
|
4235 4617 | )),
|
4236 4618 | ))
|
4237 4619 | .unwrap();
|
4238 4620 | #[allow(unused_mut)]
|
4239 4621 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4240 4622 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4241 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4623 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4242 4624 | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4243 4625 | let sender = sender.clone();
|
4244 4626 | async move {
|
4245 4627 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
4246 4628 | sender.send(()).await.expect("receiver dropped early");
|
4247 4629 | result
|
4248 4630 | }
|
4249 4631 | })
|
4250 4632 | .build_unchecked();
|
4251 4633 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4252 4634 | .await
|
4253 4635 | .expect("unable to make an HTTP request");
|
4254 4636 | ::pretty_assertions::assert_eq!(
|
4255 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4637 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4256 4638 | http_response.status()
|
4257 4639 | );
|
4258 4640 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4259 4641 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4260 4642 | http_response.headers(),
|
4261 4643 | expected_headers,
|
4262 4644 | ));
|
4263 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4645 + | use ::http_body_util::BodyExt;
|
4646 + | let body = http_response
|
4647 + | .into_body()
|
4648 + | .collect()
|
4264 4649 | .await
|
4265 - | .expect("unable to extract body to bytes");
|
4650 + | .expect("unable to collect body")
|
4651 + | .to_bytes();
|
4266 4652 | ::aws_smithy_protocol_test::assert_ok(
|
4267 4653 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4268 4654 | );
|
4269 4655 | }
|
4270 4656 | }
|
4271 4657 |
|
4272 4658 | /// When a list member value does not match the specified pattern,
|
4273 4659 | /// the response should be a 400 ValidationException.
|
4274 4660 | /// Test ID: RestJsonMalformedPatternListOverride_case0
|
4275 4661 | #[::tokio::test]
|
4276 4662 | #[::tracing_test::traced_test]
|
4277 4663 | async fn rest_json_malformed_pattern_list_override_case0_malformed_request() {
|
4278 4664 | {
|
4279 4665 | #[allow(unused_mut)]
|
4280 - | let mut http_request = http::Request::builder()
|
4666 + | let mut http_request = ::http_1x::Request::builder()
|
4281 4667 | .uri("/MalformedPatternOverride")
|
4282 4668 | .method("POST")
|
4283 4669 | .header("content-type", "application/json")
|
4284 - | .body(::aws_smithy_http_server::body::Body::from(
|
4285 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4286 - | "{ \"list\" : [\"abc\"] }".as_bytes(),
|
4287 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4670 + | .body(::aws_smithy_http_server::body::boxed(
|
4671 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4672 + | &::aws_smithy_protocol_test::decode_body_data(
|
4673 + | "{ \"list\" : [\"abc\"] }".as_bytes(),
|
4674 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4675 + | ),
|
4288 4676 | )),
|
4289 4677 | ))
|
4290 4678 | .unwrap();
|
4291 4679 | #[allow(unused_mut)]
|
4292 4680 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4293 4681 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4294 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4682 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4295 4683 | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4296 4684 | let sender = sender.clone();
|
4297 4685 | async move {
|
4298 4686 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
4299 4687 | sender.send(()).await.expect("receiver dropped early");
|
4300 4688 | result
|
4301 4689 | }
|
4302 4690 | })
|
4303 4691 | .build_unchecked();
|
4304 4692 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4305 4693 | .await
|
4306 4694 | .expect("unable to make an HTTP request");
|
4307 4695 | ::pretty_assertions::assert_eq!(
|
4308 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4696 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4309 4697 | http_response.status()
|
4310 4698 | );
|
4311 4699 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4312 4700 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4313 4701 | http_response.headers(),
|
4314 4702 | expected_headers,
|
4315 4703 | ));
|
4316 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4704 + | use ::http_body_util::BodyExt;
|
4705 + | let body = http_response
|
4706 + | .into_body()
|
4707 + | .collect()
|
4317 4708 | .await
|
4318 - | .expect("unable to extract body to bytes");
|
4709 + | .expect("unable to collect body")
|
4710 + | .to_bytes();
|
4319 4711 | ::aws_smithy_protocol_test::assert_ok(
|
4320 4712 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4321 4713 | );
|
4322 4714 | }
|
4323 4715 | }
|
4324 4716 |
|
4325 4717 | /// When a list member value does not match the specified pattern,
|
4326 4718 | /// the response should be a 400 ValidationException.
|
4327 4719 | /// Test ID: RestJsonMalformedPatternListOverride_case1
|
4328 4720 | #[::tokio::test]
|
4329 4721 | #[::tracing_test::traced_test]
|
4330 4722 | async fn rest_json_malformed_pattern_list_override_case1_malformed_request() {
|
4331 4723 | {
|
4332 4724 | #[allow(unused_mut)]
|
4333 - | let mut http_request = http::Request::builder()
|
4725 + | let mut http_request = ::http_1x::Request::builder()
|
4334 4726 | .uri("/MalformedPatternOverride")
|
4335 4727 | .method("POST")
|
4336 4728 | .header("content-type", "application/json")
|
4337 - | .body(::aws_smithy_http_server::body::Body::from(
|
4338 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4339 - | "{ \"list\" : [\"xyz\"] }".as_bytes(),
|
4340 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4729 + | .body(::aws_smithy_http_server::body::boxed(
|
4730 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4731 + | &::aws_smithy_protocol_test::decode_body_data(
|
4732 + | "{ \"list\" : [\"xyz\"] }".as_bytes(),
|
4733 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4734 + | ),
|
4341 4735 | )),
|
4342 4736 | ))
|
4343 4737 | .unwrap();
|
4344 4738 | #[allow(unused_mut)]
|
4345 4739 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4346 4740 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4347 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4741 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4348 4742 | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4349 4743 | let sender = sender.clone();
|
4350 4744 | async move {
|
4351 4745 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
4352 4746 | sender.send(()).await.expect("receiver dropped early");
|
4353 4747 | result
|
4354 4748 | }
|
4355 4749 | })
|
4356 4750 | .build_unchecked();
|
4357 4751 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4358 4752 | .await
|
4359 4753 | .expect("unable to make an HTTP request");
|
4360 4754 | ::pretty_assertions::assert_eq!(
|
4361 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4755 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4362 4756 | http_response.status()
|
4363 4757 | );
|
4364 4758 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4365 4759 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4366 4760 | http_response.headers(),
|
4367 4761 | expected_headers,
|
4368 4762 | ));
|
4369 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4763 + | use ::http_body_util::BodyExt;
|
4764 + | let body = http_response
|
4765 + | .into_body()
|
4766 + | .collect()
|
4370 4767 | .await
|
4371 - | .expect("unable to extract body to bytes");
|
4768 + | .expect("unable to collect body")
|
4769 + | .to_bytes();
|
4372 4770 | ::aws_smithy_protocol_test::assert_ok(
|
4373 4771 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4374 4772 | );
|
4375 4773 | }
|
4376 4774 | }
|
4377 4775 |
|
4378 4776 | /// When a map member's key does not match the specified pattern,
|
4379 4777 | /// the response should be a 400 ValidationException.
|
4380 4778 | /// Test ID: RestJsonMalformedPatternMapKeyOverride_case0
|
4381 4779 | #[::tokio::test]
|
4382 4780 | #[::tracing_test::traced_test]
|
4383 4781 | async fn rest_json_malformed_pattern_map_key_override_case0_malformed_request() {
|
4384 4782 | {
|
4385 4783 | #[allow(unused_mut)]
|
4386 - | let mut http_request = http::Request::builder()
|
4784 + | let mut http_request = ::http_1x::Request::builder()
|
4387 4785 | .uri("/MalformedPatternOverride")
|
4388 4786 | .method("POST")
|
4389 4787 | .header("content-type", "application/json")
|
4390 - | .body(::aws_smithy_http_server::body::Body::from(
|
4391 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4392 - | "{ \"map\" : { \"abc\" : \"ghi\" } }".as_bytes(),
|
4393 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4788 + | .body(::aws_smithy_http_server::body::boxed(
|
4789 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4790 + | &::aws_smithy_protocol_test::decode_body_data(
|
4791 + | "{ \"map\" : { \"abc\" : \"ghi\" } }".as_bytes(),
|
4792 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4793 + | ),
|
4394 4794 | )),
|
4395 4795 | ))
|
4396 4796 | .unwrap();
|
4397 4797 | #[allow(unused_mut)]
|
4398 4798 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4399 4799 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4400 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4800 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4401 4801 | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4402 4802 | let sender = sender.clone();
|
4403 4803 | async move {
|
4404 4804 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
4405 4805 | sender.send(()).await.expect("receiver dropped early");
|
4406 4806 | result
|
4407 4807 | }
|
4408 4808 | })
|
4409 4809 | .build_unchecked();
|
4410 4810 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4411 4811 | .await
|
4412 4812 | .expect("unable to make an HTTP request");
|
4413 4813 | ::pretty_assertions::assert_eq!(
|
4414 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4814 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4415 4815 | http_response.status()
|
4416 4816 | );
|
4417 4817 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4418 4818 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4419 4819 | http_response.headers(),
|
4420 4820 | expected_headers,
|
4421 4821 | ));
|
4422 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4822 + | use ::http_body_util::BodyExt;
|
4823 + | let body = http_response
|
4824 + | .into_body()
|
4825 + | .collect()
|
4423 4826 | .await
|
4424 - | .expect("unable to extract body to bytes");
|
4827 + | .expect("unable to collect body")
|
4828 + | .to_bytes();
|
4425 4829 | ::aws_smithy_protocol_test::assert_ok(
|
4426 4830 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4427 4831 | );
|
4428 4832 | }
|
4429 4833 | }
|
4430 4834 |
|
4431 4835 | /// When a map member's key does not match the specified pattern,
|
4432 4836 | /// the response should be a 400 ValidationException.
|
4433 4837 | /// Test ID: RestJsonMalformedPatternMapKeyOverride_case1
|
4434 4838 | #[::tokio::test]
|
4435 4839 | #[::tracing_test::traced_test]
|
4436 4840 | async fn rest_json_malformed_pattern_map_key_override_case1_malformed_request() {
|
4437 4841 | {
|
4438 4842 | #[allow(unused_mut)]
|
4439 - | let mut http_request = http::Request::builder()
|
4843 + | let mut http_request = ::http_1x::Request::builder()
|
4440 4844 | .uri("/MalformedPatternOverride")
|
4441 4845 | .method("POST")
|
4442 4846 | .header("content-type", "application/json")
|
4443 - | .body(::aws_smithy_http_server::body::Body::from(
|
4444 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4445 - | "{ \"map\" : { \"xyz\" : \"ghi\" } }".as_bytes(),
|
4446 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4847 + | .body(::aws_smithy_http_server::body::boxed(
|
4848 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4849 + | &::aws_smithy_protocol_test::decode_body_data(
|
4850 + | "{ \"map\" : { \"xyz\" : \"ghi\" } }".as_bytes(),
|
4851 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4852 + | ),
|
4447 4853 | )),
|
4448 4854 | ))
|
4449 4855 | .unwrap();
|
4450 4856 | #[allow(unused_mut)]
|
4451 4857 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4452 4858 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4453 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4859 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4454 4860 | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4455 4861 | let sender = sender.clone();
|
4456 4862 | async move {
|
4457 4863 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
4458 4864 | sender.send(()).await.expect("receiver dropped early");
|
4459 4865 | result
|
4460 4866 | }
|
4461 4867 | })
|
4462 4868 | .build_unchecked();
|
4463 4869 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4464 4870 | .await
|
4465 4871 | .expect("unable to make an HTTP request");
|
4466 4872 | ::pretty_assertions::assert_eq!(
|
4467 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4873 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4468 4874 | http_response.status()
|
4469 4875 | );
|
4470 4876 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4471 4877 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4472 4878 | http_response.headers(),
|
4473 4879 | expected_headers,
|
4474 4880 | ));
|
4475 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4881 + | use ::http_body_util::BodyExt;
|
4882 + | let body = http_response
|
4883 + | .into_body()
|
4884 + | .collect()
|
4476 4885 | .await
|
4477 - | .expect("unable to extract body to bytes");
|
4886 + | .expect("unable to collect body")
|
4887 + | .to_bytes();
|
4478 4888 | ::aws_smithy_protocol_test::assert_ok(
|
4479 4889 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4480 4890 | );
|
4481 4891 | }
|
4482 4892 | }
|
4483 4893 |
|
4484 4894 | /// When a map member's value does not match the specified pattern,
|
4485 4895 | /// the response should be a 400 ValidationException.
|
4486 4896 | /// Test ID: RestJsonMalformedPatternMapValueOverride_case0
|
4487 4897 | #[::tokio::test]
|
4488 4898 | #[::tracing_test::traced_test]
|
4489 4899 | async fn rest_json_malformed_pattern_map_value_override_case0_malformed_request() {
|
4490 4900 | {
|
4491 4901 | #[allow(unused_mut)]
|
4492 - | let mut http_request = http::Request::builder()
|
4902 + | let mut http_request = ::http_1x::Request::builder()
|
4493 4903 | .uri("/MalformedPatternOverride")
|
4494 4904 | .method("POST")
|
4495 4905 | .header("content-type", "application/json")
|
4496 - | .body(::aws_smithy_http_server::body::Body::from(
|
4497 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4498 - | "{ \"map\" : { \"ghi\": \"abc\" } }".as_bytes(),
|
4499 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4906 + | .body(::aws_smithy_http_server::body::boxed(
|
4907 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4908 + | &::aws_smithy_protocol_test::decode_body_data(
|
4909 + | "{ \"map\" : { \"ghi\": \"abc\" } }".as_bytes(),
|
4910 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4911 + | ),
|
4500 4912 | )),
|
4501 4913 | ))
|
4502 4914 | .unwrap();
|
4503 4915 | #[allow(unused_mut)]
|
4504 4916 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4505 4917 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4506 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4918 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4507 4919 | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4508 4920 | let sender = sender.clone();
|
4509 4921 | async move {
|
4510 4922 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
4511 4923 | sender.send(()).await.expect("receiver dropped early");
|
4512 4924 | result
|
4513 4925 | }
|
4514 4926 | })
|
4515 4927 | .build_unchecked();
|
4516 4928 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4517 4929 | .await
|
4518 4930 | .expect("unable to make an HTTP request");
|
4519 4931 | ::pretty_assertions::assert_eq!(
|
4520 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4932 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4521 4933 | http_response.status()
|
4522 4934 | );
|
4523 4935 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4524 4936 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4525 4937 | http_response.headers(),
|
4526 4938 | expected_headers,
|
4527 4939 | ));
|
4528 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4940 + | use ::http_body_util::BodyExt;
|
4941 + | let body = http_response
|
4942 + | .into_body()
|
4943 + | .collect()
|
4529 4944 | .await
|
4530 - | .expect("unable to extract body to bytes");
|
4945 + | .expect("unable to collect body")
|
4946 + | .to_bytes();
|
4531 4947 | ::aws_smithy_protocol_test::assert_ok(
|
4532 4948 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/ghi' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map/ghi' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/map/ghi\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4533 4949 | );
|
4534 4950 | }
|
4535 4951 | }
|
4536 4952 |
|
4537 4953 | /// When a map member's value does not match the specified pattern,
|
4538 4954 | /// the response should be a 400 ValidationException.
|
4539 4955 | /// Test ID: RestJsonMalformedPatternMapValueOverride_case1
|
4540 4956 | #[::tokio::test]
|
4541 4957 | #[::tracing_test::traced_test]
|
4542 4958 | async fn rest_json_malformed_pattern_map_value_override_case1_malformed_request() {
|
4543 4959 | {
|
4544 4960 | #[allow(unused_mut)]
|
4545 - | let mut http_request = http::Request::builder()
|
4961 + | let mut http_request = ::http_1x::Request::builder()
|
4546 4962 | .uri("/MalformedPatternOverride")
|
4547 4963 | .method("POST")
|
4548 4964 | .header("content-type", "application/json")
|
4549 - | .body(::aws_smithy_http_server::body::Body::from(
|
4550 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4551 - | "{ \"map\" : { \"ghi\": \"xyz\" } }".as_bytes(),
|
4552 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4965 + | .body(::aws_smithy_http_server::body::boxed(
|
4966 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4967 + | &::aws_smithy_protocol_test::decode_body_data(
|
4968 + | "{ \"map\" : { \"ghi\": \"xyz\" } }".as_bytes(),
|
4969 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4970 + | ),
|
4553 4971 | )),
|
4554 4972 | ))
|
4555 4973 | .unwrap();
|
4556 4974 | #[allow(unused_mut)]
|
4557 4975 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4558 4976 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4559 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
4977 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4560 4978 | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4561 4979 | let sender = sender.clone();
|
4562 4980 | async move {
|
4563 4981 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
4564 4982 | sender.send(()).await.expect("receiver dropped early");
|
4565 4983 | result
|
4566 4984 | }
|
4567 4985 | })
|
4568 4986 | .build_unchecked();
|
4569 4987 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4570 4988 | .await
|
4571 4989 | .expect("unable to make an HTTP request");
|
4572 4990 | ::pretty_assertions::assert_eq!(
|
4573 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4991 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4574 4992 | http_response.status()
|
4575 4993 | );
|
4576 4994 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4577 4995 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4578 4996 | http_response.headers(),
|
4579 4997 | expected_headers,
|
4580 4998 | ));
|
4581 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
4999 + | use ::http_body_util::BodyExt;
|
5000 + | let body = http_response
|
5001 + | .into_body()
|
5002 + | .collect()
|
4582 5003 | .await
|
4583 - | .expect("unable to extract body to bytes");
|
5004 + | .expect("unable to collect body")
|
5005 + | .to_bytes();
|
4584 5006 | ::aws_smithy_protocol_test::assert_ok(
|
4585 5007 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/ghi' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map/ghi' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/map/ghi\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4586 5008 | );
|
4587 5009 | }
|
4588 5010 | }
|
4589 5011 |
|
4590 5012 | /// When a union member's value does not match the specified pattern,
|
4591 5013 | /// the response should be a 400 ValidationException.
|
4592 5014 | /// Test ID: RestJsonMalformedPatternUnionOverride_case0
|
4593 5015 | #[::tokio::test]
|
4594 5016 | #[::tracing_test::traced_test]
|
4595 5017 | async fn rest_json_malformed_pattern_union_override_case0_malformed_request() {
|
4596 5018 | {
|
4597 5019 | #[allow(unused_mut)]
|
4598 - | let mut http_request = http::Request::builder()
|
5020 + | let mut http_request = ::http_1x::Request::builder()
|
4599 5021 | .uri("/MalformedPatternOverride")
|
4600 5022 | .method("POST")
|
4601 5023 | .header("content-type", "application/json")
|
4602 - | .body(::aws_smithy_http_server::body::Body::from(
|
4603 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4604 - | "{ \"union\" : { \"first\": \"abc\" } }".as_bytes(),
|
4605 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5024 + | .body(::aws_smithy_http_server::body::boxed(
|
5025 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5026 + | &::aws_smithy_protocol_test::decode_body_data(
|
5027 + | "{ \"union\" : { \"first\": \"abc\" } }".as_bytes(),
|
5028 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5029 + | ),
|
4606 5030 | )),
|
4607 5031 | ))
|
4608 5032 | .unwrap();
|
4609 5033 | #[allow(unused_mut)]
|
4610 5034 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4611 5035 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4612 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5036 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4613 5037 | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4614 5038 | let sender = sender.clone();
|
4615 5039 | async move {
|
4616 5040 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
4617 5041 | sender.send(()).await.expect("receiver dropped early");
|
4618 5042 | result
|
4619 5043 | }
|
4620 5044 | })
|
4621 5045 | .build_unchecked();
|
4622 5046 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4623 5047 | .await
|
4624 5048 | .expect("unable to make an HTTP request");
|
4625 5049 | ::pretty_assertions::assert_eq!(
|
4626 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5050 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4627 5051 | http_response.status()
|
4628 5052 | );
|
4629 5053 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4630 5054 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4631 5055 | http_response.headers(),
|
4632 5056 | expected_headers,
|
4633 5057 | ));
|
4634 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5058 + | use ::http_body_util::BodyExt;
|
5059 + | let body = http_response
|
5060 + | .into_body()
|
5061 + | .collect()
|
4635 5062 | .await
|
4636 - | .expect("unable to extract body to bytes");
|
5063 + | .expect("unable to collect body")
|
5064 + | .to_bytes();
|
4637 5065 | ::aws_smithy_protocol_test::assert_ok(
|
4638 5066 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4639 5067 | );
|
4640 5068 | }
|
4641 5069 | }
|
4642 5070 |
|
4643 5071 | /// When a union member's value does not match the specified pattern,
|
4644 5072 | /// the response should be a 400 ValidationException.
|
4645 5073 | /// Test ID: RestJsonMalformedPatternUnionOverride_case1
|
4646 5074 | #[::tokio::test]
|
4647 5075 | #[::tracing_test::traced_test]
|
4648 5076 | async fn rest_json_malformed_pattern_union_override_case1_malformed_request() {
|
4649 5077 | {
|
4650 5078 | #[allow(unused_mut)]
|
4651 - | let mut http_request = http::Request::builder()
|
5079 + | let mut http_request = ::http_1x::Request::builder()
|
4652 5080 | .uri("/MalformedPatternOverride")
|
4653 5081 | .method("POST")
|
4654 5082 | .header("content-type", "application/json")
|
4655 - | .body(::aws_smithy_http_server::body::Body::from(
|
4656 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4657 - | "{ \"union\" : { \"first\": \"xyz\" } }".as_bytes(),
|
4658 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5083 + | .body(::aws_smithy_http_server::body::boxed(
|
5084 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5085 + | &::aws_smithy_protocol_test::decode_body_data(
|
5086 + | "{ \"union\" : { \"first\": \"xyz\" } }".as_bytes(),
|
5087 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5088 + | ),
|
4659 5089 | )),
|
4660 5090 | ))
|
4661 5091 | .unwrap();
|
4662 5092 | #[allow(unused_mut)]
|
4663 5093 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4664 5094 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4665 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5095 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4666 5096 | .malformed_pattern_override(move |input: crate::input::MalformedPatternOverrideInput| {
|
4667 5097 | let sender = sender.clone();
|
4668 5098 | async move {
|
4669 5099 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOverrideOutput, crate::error::MalformedPatternOverrideError> };
|
4670 5100 | sender.send(()).await.expect("receiver dropped early");
|
4671 5101 | result
|
4672 5102 | }
|
4673 5103 | })
|
4674 5104 | .build_unchecked();
|
4675 5105 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4676 5106 | .await
|
4677 5107 | .expect("unable to make an HTTP request");
|
4678 5108 | ::pretty_assertions::assert_eq!(
|
4679 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5109 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4680 5110 | http_response.status()
|
4681 5111 | );
|
4682 5112 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4683 5113 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4684 5114 | http_response.headers(),
|
4685 5115 | expected_headers,
|
4686 5116 | ));
|
4687 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5117 + | use ::http_body_util::BodyExt;
|
5118 + | let body = http_response
|
5119 + | .into_body()
|
5120 + | .collect()
|
4688 5121 | .await
|
4689 - | .expect("unable to extract body to bytes");
|
5122 + | .expect("unable to collect body")
|
5123 + | .to_bytes();
|
4690 5124 | ::aws_smithy_protocol_test::assert_ok(
|
4691 5125 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[g-m]+$\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4692 5126 | );
|
4693 5127 | }
|
4694 5128 | }
|
4695 5129 | }
|
4696 5130 |
|
4697 5131 | ::pin_project_lite::pin_project! {
|
4698 5132 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
4699 5133 | /// [`MalformedPatternInput`](crate::input::MalformedPatternInput) using modelled bindings.
|
4700 5134 | pub struct MalformedPatternInputFuture {
|
4701 5135 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedPatternInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
4702 5136 | }
|
4703 5137 | }
|
4704 5138 |
|
4705 5139 | impl std::future::Future for MalformedPatternInputFuture {
|
4706 5140 | type Output = Result<
|
4707 5141 | crate::input::MalformedPatternInput,
|
4708 5142 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
4709 5143 | >;
|
4710 5144 |
|
4711 5145 | fn poll(
|
4712 5146 | self: std::pin::Pin<&mut Self>,
|
4713 5147 | cx: &mut std::task::Context<'_>,
|
4714 5148 | ) -> std::task::Poll<Self::Output> {
|
4715 5149 | let this = self.project();
|
4716 5150 | this.inner.as_mut().poll(cx)
|
4717 5151 | }
|
4718 5152 | }
|
4719 5153 |
|
4720 5154 | impl<B>
|
4721 5155 | ::aws_smithy_http_server::request::FromRequest<
|
4722 5156 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
4723 5157 | B,
|
4724 5158 | > for crate::input::MalformedPatternInput
|
4725 5159 | where
|
4726 5160 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
4727 5161 | B: 'static,
|
4728 5162 |
|
4729 5163 | B::Data: Send,
|
4730 5164 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
4731 5165 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
4732 5166 | {
|
4733 5167 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
4734 5168 | type Future = MalformedPatternInputFuture;
|
4735 5169 |
|
4736 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
5170 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
4737 5171 | let fut = async move {
|
4738 5172 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
4739 5173 | request.headers(),
|
4740 5174 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
4741 5175 | ) {
|
4742 5176 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
4743 5177 | }
|
4744 5178 | crate::protocol_serde::shape_malformed_pattern::de_malformed_pattern_http_request(
|
4745 5179 | request,
|
4746 5180 | )
|
4805 5239 | mod malformed_pattern_test {
|
4806 5240 |
|
4807 5241 | /// When a string member does not match the specified pattern,
|
4808 5242 | /// the response should be a 400 ValidationException.
|
4809 5243 | /// Test ID: RestJsonMalformedPatternString_case0
|
4810 5244 | #[::tokio::test]
|
4811 5245 | #[::tracing_test::traced_test]
|
4812 5246 | async fn rest_json_malformed_pattern_string_case0_malformed_request() {
|
4813 5247 | {
|
4814 5248 | #[allow(unused_mut)]
|
4815 - | let mut http_request = http::Request::builder()
|
5249 + | let mut http_request = ::http_1x::Request::builder()
|
4816 5250 | .uri("/MalformedPattern")
|
4817 5251 | .method("POST")
|
4818 5252 | .header("content-type", "application/json")
|
4819 - | .body(::aws_smithy_http_server::body::Body::from(
|
4820 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4821 - | "{ \"string\" : \"ABC\" }".as_bytes(),
|
4822 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5253 + | .body(::aws_smithy_http_server::body::boxed(
|
5254 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5255 + | &::aws_smithy_protocol_test::decode_body_data(
|
5256 + | "{ \"string\" : \"ABC\" }".as_bytes(),
|
5257 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5258 + | ),
|
4823 5259 | )),
|
4824 5260 | ))
|
4825 5261 | .unwrap();
|
4826 5262 | #[allow(unused_mut)]
|
4827 5263 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4828 5264 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4829 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5265 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4830 5266 | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4831 5267 | let sender = sender.clone();
|
4832 5268 | async move {
|
4833 5269 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
4834 5270 | sender.send(()).await.expect("receiver dropped early");
|
4835 5271 | result
|
4836 5272 | }
|
4837 5273 | })
|
4838 5274 | .build_unchecked();
|
4839 5275 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4840 5276 | .await
|
4841 5277 | .expect("unable to make an HTTP request");
|
4842 5278 | ::pretty_assertions::assert_eq!(
|
4843 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5279 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4844 5280 | http_response.status()
|
4845 5281 | );
|
4846 5282 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4847 5283 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4848 5284 | http_response.headers(),
|
4849 5285 | expected_headers,
|
4850 5286 | ));
|
4851 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5287 + | use ::http_body_util::BodyExt;
|
5288 + | let body = http_response
|
5289 + | .into_body()
|
5290 + | .collect()
|
4852 5291 | .await
|
4853 - | .expect("unable to extract body to bytes");
|
5292 + | .expect("unable to collect body")
|
5293 + | .to_bytes();
|
4854 5294 | ::aws_smithy_protocol_test::assert_ok(
|
4855 5295 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4856 5296 | );
|
4857 5297 | }
|
4858 5298 | }
|
4859 5299 |
|
4860 5300 | /// When a string member does not match the specified pattern,
|
4861 5301 | /// the response should be a 400 ValidationException.
|
4862 5302 | /// Test ID: RestJsonMalformedPatternString_case1
|
4863 5303 | #[::tokio::test]
|
4864 5304 | #[::tracing_test::traced_test]
|
4865 5305 | async fn rest_json_malformed_pattern_string_case1_malformed_request() {
|
4866 5306 | {
|
4867 5307 | #[allow(unused_mut)]
|
4868 - | let mut http_request = http::Request::builder()
|
5308 + | let mut http_request = ::http_1x::Request::builder()
|
4869 5309 | .uri("/MalformedPattern")
|
4870 5310 | .method("POST")
|
4871 5311 | .header("content-type", "application/json")
|
4872 - | .body(::aws_smithy_http_server::body::Body::from(
|
4873 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4874 - | "{ \"string\" : \"xyz\" }".as_bytes(),
|
4875 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5312 + | .body(::aws_smithy_http_server::body::boxed(
|
5313 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5314 + | &::aws_smithy_protocol_test::decode_body_data(
|
5315 + | "{ \"string\" : \"xyz\" }".as_bytes(),
|
5316 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5317 + | ),
|
4876 5318 | )),
|
4877 5319 | ))
|
4878 5320 | .unwrap();
|
4879 5321 | #[allow(unused_mut)]
|
4880 5322 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4881 5323 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4882 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5324 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4883 5325 | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4884 5326 | let sender = sender.clone();
|
4885 5327 | async move {
|
4886 5328 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
4887 5329 | sender.send(()).await.expect("receiver dropped early");
|
4888 5330 | result
|
4889 5331 | }
|
4890 5332 | })
|
4891 5333 | .build_unchecked();
|
4892 5334 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4893 5335 | .await
|
4894 5336 | .expect("unable to make an HTTP request");
|
4895 5337 | ::pretty_assertions::assert_eq!(
|
4896 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5338 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4897 5339 | http_response.status()
|
4898 5340 | );
|
4899 5341 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4900 5342 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4901 5343 | http_response.headers(),
|
4902 5344 | expected_headers,
|
4903 5345 | ));
|
4904 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5346 + | use ::http_body_util::BodyExt;
|
5347 + | let body = http_response
|
5348 + | .into_body()
|
5349 + | .collect()
|
4905 5350 | .await
|
4906 - | .expect("unable to extract body to bytes");
|
5351 + | .expect("unable to collect body")
|
5352 + | .to_bytes();
|
4907 5353 | ::aws_smithy_protocol_test::assert_ok(
|
4908 5354 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4909 5355 | );
|
4910 5356 | }
|
4911 5357 | }
|
4912 5358 |
|
4913 5359 | /// When the specified pattern is susceptible to ReDOS, the service will not
|
4914 5360 | /// hang indefinitely while evaluating the pattern
|
4915 5361 | /// Test ID: RestJsonMalformedPatternReDOSString
|
4916 5362 | #[::tokio::test]
|
4917 5363 | #[::tracing_test::traced_test]
|
4918 5364 | #[should_panic]
|
4919 5365 | async fn rest_json_malformed_pattern_re_dos_string_malformed_request() {
|
4920 5366 | {
|
4921 5367 | #[allow(unused_mut)]
|
4922 - | let mut http_request = http::Request::builder()
|
5368 + | let mut http_request = ::http_1x::Request::builder()
|
4923 5369 | .uri("/MalformedPattern")
|
4924 5370 | .method("POST")
|
4925 5371 | .header("content-type", "application/json")
|
4926 - | .body(::aws_smithy_http_server::body::Body::from(
|
4927 - | ::bytes::Bytes::copy_from_slice(
|
4928 - | &::aws_smithy_protocol_test::decode_body_data("{ \"evilString\" : \"000000000000000000000000000000000000000000000000000000000000000000000000000000000000!\" }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
4929 - | )
|
4930 - | )).unwrap();
|
5372 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
5373 + | ::bytes::Bytes::copy_from_slice(
|
5374 + | &::aws_smithy_protocol_test::decode_body_data("{ \"evilString\" : \"000000000000000000000000000000000000000000000000000000000000000000000000000000000000!\" }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
5375 + | )
|
5376 + | ))).unwrap();
|
4931 5377 | #[allow(unused_mut)]
|
4932 5378 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4933 5379 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4934 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5380 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4935 5381 | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4936 5382 | let sender = sender.clone();
|
4937 5383 | async move {
|
4938 5384 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
4939 5385 | sender.send(()).await.expect("receiver dropped early");
|
4940 5386 | result
|
4941 5387 | }
|
4942 5388 | })
|
4943 5389 | .build_unchecked();
|
4944 5390 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4945 5391 | .await
|
4946 5392 | .expect("unable to make an HTTP request");
|
4947 5393 | ::pretty_assertions::assert_eq!(
|
4948 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5394 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4949 5395 | http_response.status()
|
4950 5396 | );
|
4951 5397 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
4952 5398 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4953 5399 | http_response.headers(),
|
4954 5400 | expected_headers,
|
4955 5401 | ));
|
4956 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5402 + | use ::http_body_util::BodyExt;
|
5403 + | let body = http_response
|
5404 + | .into_body()
|
5405 + | .collect()
|
4957 5406 | .await
|
4958 - | .expect("unable to extract body to bytes");
|
5407 + | .expect("unable to collect body")
|
5408 + | .to_bytes();
|
4959 5409 | ::aws_smithy_protocol_test::assert_ok(
|
4960 5410 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/evilString' failed to satisfy constraint: Member must satisfy regular expression pattern: ^([0-9]+)+$$\",\n \"fieldList\" : [{\"message\": \"Value at '/evilString' failed to satisfy constraint: Member must satisfy regular expression pattern: ^([0-9]+)+$$\", \"path\": \"/evilString\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
4961 5411 | );
|
4962 5412 | }
|
4963 5413 | }
|
4964 5414 |
|
4965 5415 | /// When the specified pattern is susceptible to ReDOS, the service will not
|
4966 5416 | /// hang indefinitely while evaluating the pattern
|
4967 5417 | /// Test ID: RestJsonMalformedPatternReDOSString_hotfixed
|
4968 5418 | #[::tokio::test]
|
4969 5419 | #[::tracing_test::traced_test]
|
4970 5420 | async fn rest_json_malformed_pattern_re_dos_string_hotfixed_malformed_request() {
|
4971 5421 | {
|
4972 5422 | #[allow(unused_mut)]
|
4973 - | let mut http_request = http::Request::builder()
|
5423 + | let mut http_request = ::http_1x::Request::builder()
|
4974 5424 | .uri("/MalformedPattern")
|
4975 5425 | .method("POST")
|
4976 5426 | .header("content-type", "application/json")
|
4977 - | .body(::aws_smithy_http_server::body::Body::from(
|
4978 - | ::bytes::Bytes::copy_from_slice(
|
4979 - | &::aws_smithy_protocol_test::decode_body_data("{ \"evilString\" : \"000000000000000000000000000000000000000000000000000000000000000000000000000000000000!\" }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
4980 - | )
|
4981 - | )).unwrap();
|
5427 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
5428 + | ::bytes::Bytes::copy_from_slice(
|
5429 + | &::aws_smithy_protocol_test::decode_body_data("{ \"evilString\" : \"000000000000000000000000000000000000000000000000000000000000000000000000000000000000!\" }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
5430 + | )
|
5431 + | ))).unwrap();
|
4982 5432 | #[allow(unused_mut)]
|
4983 5433 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4984 5434 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
4985 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5435 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4986 5436 | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
4987 5437 | let sender = sender.clone();
|
4988 5438 | async move {
|
4989 5439 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
4990 5440 | sender.send(()).await.expect("receiver dropped early");
|
4991 5441 | result
|
4992 5442 | }
|
4993 5443 | })
|
4994 5444 | .build_unchecked();
|
4995 5445 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4996 5446 | .await
|
4997 5447 | .expect("unable to make an HTTP request");
|
4998 5448 | ::pretty_assertions::assert_eq!(
|
4999 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5449 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5000 5450 | http_response.status()
|
5001 5451 | );
|
5002 5452 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5003 5453 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5004 5454 | http_response.headers(),
|
5005 5455 | expected_headers,
|
5006 5456 | ));
|
5007 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5457 + | use ::http_body_util::BodyExt;
|
5458 + | let body = http_response
|
5459 + | .into_body()
|
5460 + | .collect()
|
5008 5461 | .await
|
5009 - | .expect("unable to extract body to bytes");
|
5462 + | .expect("unable to collect body")
|
5463 + | .to_bytes();
|
5010 5464 | ::aws_smithy_protocol_test::assert_ok(
|
5011 5465 | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"message\" : \"1 validation error detected. Value at '/evilString' failed to satisfy constraint: Member must satisfy regular expression pattern: ^([0-9]+)+$\",\n \"fieldList\" : [{\"message\": \"Value at '/evilString' failed to satisfy constraint: Member must satisfy regular expression pattern: ^([0-9]+)+$\", \"path\": \"/evilString\"}]\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5012 5466 | );
|
5013 5467 | }
|
5014 5468 | }
|
5015 5469 |
|
5016 5470 | /// When a list member value does not match the specified pattern,
|
5017 5471 | /// the response should be a 400 ValidationException.
|
5018 5472 | /// Test ID: RestJsonMalformedPatternList_case0
|
5019 5473 | #[::tokio::test]
|
5020 5474 | #[::tracing_test::traced_test]
|
5021 5475 | async fn rest_json_malformed_pattern_list_case0_malformed_request() {
|
5022 5476 | {
|
5023 5477 | #[allow(unused_mut)]
|
5024 - | let mut http_request = http::Request::builder()
|
5478 + | let mut http_request = ::http_1x::Request::builder()
|
5025 5479 | .uri("/MalformedPattern")
|
5026 5480 | .method("POST")
|
5027 5481 | .header("content-type", "application/json")
|
5028 - | .body(::aws_smithy_http_server::body::Body::from(
|
5029 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5030 - | "{ \"list\" : [\"ABC\"] }".as_bytes(),
|
5031 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5482 + | .body(::aws_smithy_http_server::body::boxed(
|
5483 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5484 + | &::aws_smithy_protocol_test::decode_body_data(
|
5485 + | "{ \"list\" : [\"ABC\"] }".as_bytes(),
|
5486 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5487 + | ),
|
5032 5488 | )),
|
5033 5489 | ))
|
5034 5490 | .unwrap();
|
5035 5491 | #[allow(unused_mut)]
|
5036 5492 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5037 5493 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5038 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5494 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5039 5495 | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
5040 5496 | let sender = sender.clone();
|
5041 5497 | async move {
|
5042 5498 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
5043 5499 | sender.send(()).await.expect("receiver dropped early");
|
5044 5500 | result
|
5045 5501 | }
|
5046 5502 | })
|
5047 5503 | .build_unchecked();
|
5048 5504 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5049 5505 | .await
|
5050 5506 | .expect("unable to make an HTTP request");
|
5051 5507 | ::pretty_assertions::assert_eq!(
|
5052 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5508 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5053 5509 | http_response.status()
|
5054 5510 | );
|
5055 5511 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5056 5512 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5057 5513 | http_response.headers(),
|
5058 5514 | expected_headers,
|
5059 5515 | ));
|
5060 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5516 + | use ::http_body_util::BodyExt;
|
5517 + | let body = http_response
|
5518 + | .into_body()
|
5519 + | .collect()
|
5061 5520 | .await
|
5062 - | .expect("unable to extract body to bytes");
|
5521 + | .expect("unable to collect body")
|
5522 + | .to_bytes();
|
5063 5523 | ::aws_smithy_protocol_test::assert_ok(
|
5064 5524 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5065 5525 | );
|
5066 5526 | }
|
5067 5527 | }
|
5068 5528 |
|
5069 5529 | /// When a list member value does not match the specified pattern,
|
5070 5530 | /// the response should be a 400 ValidationException.
|
5071 5531 | /// Test ID: RestJsonMalformedPatternList_case1
|
5072 5532 | #[::tokio::test]
|
5073 5533 | #[::tracing_test::traced_test]
|
5074 5534 | async fn rest_json_malformed_pattern_list_case1_malformed_request() {
|
5075 5535 | {
|
5076 5536 | #[allow(unused_mut)]
|
5077 - | let mut http_request = http::Request::builder()
|
5537 + | let mut http_request = ::http_1x::Request::builder()
|
5078 5538 | .uri("/MalformedPattern")
|
5079 5539 | .method("POST")
|
5080 5540 | .header("content-type", "application/json")
|
5081 - | .body(::aws_smithy_http_server::body::Body::from(
|
5082 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5083 - | "{ \"list\" : [\"xyz\"] }".as_bytes(),
|
5084 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5541 + | .body(::aws_smithy_http_server::body::boxed(
|
5542 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5543 + | &::aws_smithy_protocol_test::decode_body_data(
|
5544 + | "{ \"list\" : [\"xyz\"] }".as_bytes(),
|
5545 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5546 + | ),
|
5085 5547 | )),
|
5086 5548 | ))
|
5087 5549 | .unwrap();
|
5088 5550 | #[allow(unused_mut)]
|
5089 5551 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5090 5552 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5091 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5553 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5092 5554 | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
5093 5555 | let sender = sender.clone();
|
5094 5556 | async move {
|
5095 5557 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
5096 5558 | sender.send(()).await.expect("receiver dropped early");
|
5097 5559 | result
|
5098 5560 | }
|
5099 5561 | })
|
5100 5562 | .build_unchecked();
|
5101 5563 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5102 5564 | .await
|
5103 5565 | .expect("unable to make an HTTP request");
|
5104 5566 | ::pretty_assertions::assert_eq!(
|
5105 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5567 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5106 5568 | http_response.status()
|
5107 5569 | );
|
5108 5570 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5109 5571 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5110 5572 | http_response.headers(),
|
5111 5573 | expected_headers,
|
5112 5574 | ));
|
5113 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5575 + | use ::http_body_util::BodyExt;
|
5576 + | let body = http_response
|
5577 + | .into_body()
|
5578 + | .collect()
|
5114 5579 | .await
|
5115 - | .expect("unable to extract body to bytes");
|
5580 + | .expect("unable to collect body")
|
5581 + | .to_bytes();
|
5116 5582 | ::aws_smithy_protocol_test::assert_ok(
|
5117 5583 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5118 5584 | );
|
5119 5585 | }
|
5120 5586 | }
|
5121 5587 |
|
5122 5588 | /// When a map member's key does not match the specified pattern,
|
5123 5589 | /// the response should be a 400 ValidationException.
|
5124 5590 | /// Test ID: RestJsonMalformedPatternMapKey_case0
|
5125 5591 | #[::tokio::test]
|
5126 5592 | #[::tracing_test::traced_test]
|
5127 5593 | async fn rest_json_malformed_pattern_map_key_case0_malformed_request() {
|
5128 5594 | {
|
5129 5595 | #[allow(unused_mut)]
|
5130 - | let mut http_request = http::Request::builder()
|
5596 + | let mut http_request = ::http_1x::Request::builder()
|
5131 5597 | .uri("/MalformedPattern")
|
5132 5598 | .method("POST")
|
5133 5599 | .header("content-type", "application/json")
|
5134 - | .body(::aws_smithy_http_server::body::Body::from(
|
5135 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5136 - | "{ \"map\" : { \"ABC\" : \"abc\" } }".as_bytes(),
|
5137 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5600 + | .body(::aws_smithy_http_server::body::boxed(
|
5601 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5602 + | &::aws_smithy_protocol_test::decode_body_data(
|
5603 + | "{ \"map\" : { \"ABC\" : \"abc\" } }".as_bytes(),
|
5604 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5605 + | ),
|
5138 5606 | )),
|
5139 5607 | ))
|
5140 5608 | .unwrap();
|
5141 5609 | #[allow(unused_mut)]
|
5142 5610 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5143 5611 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5144 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5612 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5145 5613 | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
5146 5614 | let sender = sender.clone();
|
5147 5615 | async move {
|
5148 5616 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
5149 5617 | sender.send(()).await.expect("receiver dropped early");
|
5150 5618 | result
|
5151 5619 | }
|
5152 5620 | })
|
5153 5621 | .build_unchecked();
|
5154 5622 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5155 5623 | .await
|
5156 5624 | .expect("unable to make an HTTP request");
|
5157 5625 | ::pretty_assertions::assert_eq!(
|
5158 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5626 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5159 5627 | http_response.status()
|
5160 5628 | );
|
5161 5629 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5162 5630 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5163 5631 | http_response.headers(),
|
5164 5632 | expected_headers,
|
5165 5633 | ));
|
5166 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5634 + | use ::http_body_util::BodyExt;
|
5635 + | let body = http_response
|
5636 + | .into_body()
|
5637 + | .collect()
|
5167 5638 | .await
|
5168 - | .expect("unable to extract body to bytes");
|
5639 + | .expect("unable to collect body")
|
5640 + | .to_bytes();
|
5169 5641 | ::aws_smithy_protocol_test::assert_ok(
|
5170 5642 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5171 5643 | );
|
5172 5644 | }
|
5173 5645 | }
|
5174 5646 |
|
5175 5647 | /// When a map member's key does not match the specified pattern,
|
5176 5648 | /// the response should be a 400 ValidationException.
|
5177 5649 | /// Test ID: RestJsonMalformedPatternMapKey_case1
|
5178 5650 | #[::tokio::test]
|
5179 5651 | #[::tracing_test::traced_test]
|
5180 5652 | async fn rest_json_malformed_pattern_map_key_case1_malformed_request() {
|
5181 5653 | {
|
5182 5654 | #[allow(unused_mut)]
|
5183 - | let mut http_request = http::Request::builder()
|
5655 + | let mut http_request = ::http_1x::Request::builder()
|
5184 5656 | .uri("/MalformedPattern")
|
5185 5657 | .method("POST")
|
5186 5658 | .header("content-type", "application/json")
|
5187 - | .body(::aws_smithy_http_server::body::Body::from(
|
5188 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5189 - | "{ \"map\" : { \"xyz\" : \"abc\" } }".as_bytes(),
|
5190 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5659 + | .body(::aws_smithy_http_server::body::boxed(
|
5660 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5661 + | &::aws_smithy_protocol_test::decode_body_data(
|
5662 + | "{ \"map\" : { \"xyz\" : \"abc\" } }".as_bytes(),
|
5663 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5664 + | ),
|
5191 5665 | )),
|
5192 5666 | ))
|
5193 5667 | .unwrap();
|
5194 5668 | #[allow(unused_mut)]
|
5195 5669 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5196 5670 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5197 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5671 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5198 5672 | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
5199 5673 | let sender = sender.clone();
|
5200 5674 | async move {
|
5201 5675 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
5202 5676 | sender.send(()).await.expect("receiver dropped early");
|
5203 5677 | result
|
5204 5678 | }
|
5205 5679 | })
|
5206 5680 | .build_unchecked();
|
5207 5681 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5208 5682 | .await
|
5209 5683 | .expect("unable to make an HTTP request");
|
5210 5684 | ::pretty_assertions::assert_eq!(
|
5211 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5685 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5212 5686 | http_response.status()
|
5213 5687 | );
|
5214 5688 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5215 5689 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5216 5690 | http_response.headers(),
|
5217 5691 | expected_headers,
|
5218 5692 | ));
|
5219 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5693 + | use ::http_body_util::BodyExt;
|
5694 + | let body = http_response
|
5695 + | .into_body()
|
5696 + | .collect()
|
5220 5697 | .await
|
5221 - | .expect("unable to extract body to bytes");
|
5698 + | .expect("unable to collect body")
|
5699 + | .to_bytes();
|
5222 5700 | ::aws_smithy_protocol_test::assert_ok(
|
5223 5701 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5224 5702 | );
|
5225 5703 | }
|
5226 5704 | }
|
5227 5705 |
|
5228 5706 | /// When a map member's value does not match the specified pattern,
|
5229 5707 | /// the response should be a 400 ValidationException.
|
5230 5708 | /// Test ID: RestJsonMalformedPatternMapValue_case0
|
5231 5709 | #[::tokio::test]
|
5232 5710 | #[::tracing_test::traced_test]
|
5233 5711 | async fn rest_json_malformed_pattern_map_value_case0_malformed_request() {
|
5234 5712 | {
|
5235 5713 | #[allow(unused_mut)]
|
5236 - | let mut http_request = http::Request::builder()
|
5714 + | let mut http_request = ::http_1x::Request::builder()
|
5237 5715 | .uri("/MalformedPattern")
|
5238 5716 | .method("POST")
|
5239 5717 | .header("content-type", "application/json")
|
5240 - | .body(::aws_smithy_http_server::body::Body::from(
|
5241 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5242 - | "{ \"map\" : { \"abc\": \"ABC\" } }".as_bytes(),
|
5243 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5718 + | .body(::aws_smithy_http_server::body::boxed(
|
5719 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5720 + | &::aws_smithy_protocol_test::decode_body_data(
|
5721 + | "{ \"map\" : { \"abc\": \"ABC\" } }".as_bytes(),
|
5722 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5723 + | ),
|
5244 5724 | )),
|
5245 5725 | ))
|
5246 5726 | .unwrap();
|
5247 5727 | #[allow(unused_mut)]
|
5248 5728 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5249 5729 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5250 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5730 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5251 5731 | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
5252 5732 | let sender = sender.clone();
|
5253 5733 | async move {
|
5254 5734 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
5255 5735 | sender.send(()).await.expect("receiver dropped early");
|
5256 5736 | result
|
5257 5737 | }
|
5258 5738 | })
|
5259 5739 | .build_unchecked();
|
5260 5740 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5261 5741 | .await
|
5262 5742 | .expect("unable to make an HTTP request");
|
5263 5743 | ::pretty_assertions::assert_eq!(
|
5264 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5744 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5265 5745 | http_response.status()
|
5266 5746 | );
|
5267 5747 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5268 5748 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5269 5749 | http_response.headers(),
|
5270 5750 | expected_headers,
|
5271 5751 | ));
|
5272 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5752 + | use ::http_body_util::BodyExt;
|
5753 + | let body = http_response
|
5754 + | .into_body()
|
5755 + | .collect()
|
5273 5756 | .await
|
5274 - | .expect("unable to extract body to bytes");
|
5757 + | .expect("unable to collect body")
|
5758 + | .to_bytes();
|
5275 5759 | ::aws_smithy_protocol_test::assert_ok(
|
5276 5760 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/abc' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map/abc' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5277 5761 | );
|
5278 5762 | }
|
5279 5763 | }
|
5280 5764 |
|
5281 5765 | /// When a map member's value does not match the specified pattern,
|
5282 5766 | /// the response should be a 400 ValidationException.
|
5283 5767 | /// Test ID: RestJsonMalformedPatternMapValue_case1
|
5284 5768 | #[::tokio::test]
|
5285 5769 | #[::tracing_test::traced_test]
|
5286 5770 | async fn rest_json_malformed_pattern_map_value_case1_malformed_request() {
|
5287 5771 | {
|
5288 5772 | #[allow(unused_mut)]
|
5289 - | let mut http_request = http::Request::builder()
|
5773 + | let mut http_request = ::http_1x::Request::builder()
|
5290 5774 | .uri("/MalformedPattern")
|
5291 5775 | .method("POST")
|
5292 5776 | .header("content-type", "application/json")
|
5293 - | .body(::aws_smithy_http_server::body::Body::from(
|
5294 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5295 - | "{ \"map\" : { \"abc\": \"xyz\" } }".as_bytes(),
|
5296 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5777 + | .body(::aws_smithy_http_server::body::boxed(
|
5778 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5779 + | &::aws_smithy_protocol_test::decode_body_data(
|
5780 + | "{ \"map\" : { \"abc\": \"xyz\" } }".as_bytes(),
|
5781 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5782 + | ),
|
5297 5783 | )),
|
5298 5784 | ))
|
5299 5785 | .unwrap();
|
5300 5786 | #[allow(unused_mut)]
|
5301 5787 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5302 5788 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5303 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5789 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5304 5790 | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
5305 5791 | let sender = sender.clone();
|
5306 5792 | async move {
|
5307 5793 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
5308 5794 | sender.send(()).await.expect("receiver dropped early");
|
5309 5795 | result
|
5310 5796 | }
|
5311 5797 | })
|
5312 5798 | .build_unchecked();
|
5313 5799 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5314 5800 | .await
|
5315 5801 | .expect("unable to make an HTTP request");
|
5316 5802 | ::pretty_assertions::assert_eq!(
|
5317 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5803 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5318 5804 | http_response.status()
|
5319 5805 | );
|
5320 5806 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5321 5807 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5322 5808 | http_response.headers(),
|
5323 5809 | expected_headers,
|
5324 5810 | ));
|
5325 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5811 + | use ::http_body_util::BodyExt;
|
5812 + | let body = http_response
|
5813 + | .into_body()
|
5814 + | .collect()
|
5326 5815 | .await
|
5327 - | .expect("unable to extract body to bytes");
|
5816 + | .expect("unable to collect body")
|
5817 + | .to_bytes();
|
5328 5818 | ::aws_smithy_protocol_test::assert_ok(
|
5329 5819 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/abc' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/map/abc' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5330 5820 | );
|
5331 5821 | }
|
5332 5822 | }
|
5333 5823 |
|
5334 5824 | /// When a union member's value does not match the specified pattern,
|
5335 5825 | /// the response should be a 400 ValidationException.
|
5336 5826 | /// Test ID: RestJsonMalformedPatternUnion_case0
|
5337 5827 | #[::tokio::test]
|
5338 5828 | #[::tracing_test::traced_test]
|
5339 5829 | async fn rest_json_malformed_pattern_union_case0_malformed_request() {
|
5340 5830 | {
|
5341 5831 | #[allow(unused_mut)]
|
5342 - | let mut http_request = http::Request::builder()
|
5832 + | let mut http_request = ::http_1x::Request::builder()
|
5343 5833 | .uri("/MalformedPattern")
|
5344 5834 | .method("POST")
|
5345 5835 | .header("content-type", "application/json")
|
5346 - | .body(::aws_smithy_http_server::body::Body::from(
|
5347 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5348 - | "{ \"union\" : { \"first\": \"ABC\" } }".as_bytes(),
|
5349 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5836 + | .body(::aws_smithy_http_server::body::boxed(
|
5837 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5838 + | &::aws_smithy_protocol_test::decode_body_data(
|
5839 + | "{ \"union\" : { \"first\": \"ABC\" } }".as_bytes(),
|
5840 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5841 + | ),
|
5350 5842 | )),
|
5351 5843 | ))
|
5352 5844 | .unwrap();
|
5353 5845 | #[allow(unused_mut)]
|
5354 5846 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5355 5847 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5356 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5848 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5357 5849 | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
5358 5850 | let sender = sender.clone();
|
5359 5851 | async move {
|
5360 5852 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
5361 5853 | sender.send(()).await.expect("receiver dropped early");
|
5362 5854 | result
|
5363 5855 | }
|
5364 5856 | })
|
5365 5857 | .build_unchecked();
|
5366 5858 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5367 5859 | .await
|
5368 5860 | .expect("unable to make an HTTP request");
|
5369 5861 | ::pretty_assertions::assert_eq!(
|
5370 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5862 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5371 5863 | http_response.status()
|
5372 5864 | );
|
5373 5865 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5374 5866 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5375 5867 | http_response.headers(),
|
5376 5868 | expected_headers,
|
5377 5869 | ));
|
5378 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5870 + | use ::http_body_util::BodyExt;
|
5871 + | let body = http_response
|
5872 + | .into_body()
|
5873 + | .collect()
|
5379 5874 | .await
|
5380 - | .expect("unable to extract body to bytes");
|
5875 + | .expect("unable to collect body")
|
5876 + | .to_bytes();
|
5381 5877 | ::aws_smithy_protocol_test::assert_ok(
|
5382 5878 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5383 5879 | );
|
5384 5880 | }
|
5385 5881 | }
|
5386 5882 |
|
5387 5883 | /// When a union member's value does not match the specified pattern,
|
5388 5884 | /// the response should be a 400 ValidationException.
|
5389 5885 | /// Test ID: RestJsonMalformedPatternUnion_case1
|
5390 5886 | #[::tokio::test]
|
5391 5887 | #[::tracing_test::traced_test]
|
5392 5888 | async fn rest_json_malformed_pattern_union_case1_malformed_request() {
|
5393 5889 | {
|
5394 5890 | #[allow(unused_mut)]
|
5395 - | let mut http_request = http::Request::builder()
|
5891 + | let mut http_request = ::http_1x::Request::builder()
|
5396 5892 | .uri("/MalformedPattern")
|
5397 5893 | .method("POST")
|
5398 5894 | .header("content-type", "application/json")
|
5399 - | .body(::aws_smithy_http_server::body::Body::from(
|
5400 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5401 - | "{ \"union\" : { \"first\": \"xyz\" } }".as_bytes(),
|
5402 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5895 + | .body(::aws_smithy_http_server::body::boxed(
|
5896 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5897 + | &::aws_smithy_protocol_test::decode_body_data(
|
5898 + | "{ \"union\" : { \"first\": \"xyz\" } }".as_bytes(),
|
5899 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5900 + | ),
|
5403 5901 | )),
|
5404 5902 | ))
|
5405 5903 | .unwrap();
|
5406 5904 | #[allow(unused_mut)]
|
5407 5905 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5408 5906 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5409 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
5907 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5410 5908 | .malformed_pattern(move |input: crate::input::MalformedPatternInput| {
|
5411 5909 | let sender = sender.clone();
|
5412 5910 | async move {
|
5413 5911 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedPatternOutput, crate::error::MalformedPatternError> };
|
5414 5912 | sender.send(()).await.expect("receiver dropped early");
|
5415 5913 | result
|
5416 5914 | }
|
5417 5915 | })
|
5418 5916 | .build_unchecked();
|
5419 5917 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5420 5918 | .await
|
5421 5919 | .expect("unable to make an HTTP request");
|
5422 5920 | ::pretty_assertions::assert_eq!(
|
5423 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5921 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5424 5922 | http_response.status()
|
5425 5923 | );
|
5426 5924 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5427 5925 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5428 5926 | http_response.headers(),
|
5429 5927 | expected_headers,
|
5430 5928 | ));
|
5431 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
5929 + | use ::http_body_util::BodyExt;
|
5930 + | let body = http_response
|
5931 + | .into_body()
|
5932 + | .collect()
|
5432 5933 | .await
|
5433 - | .expect("unable to extract body to bytes");
|
5934 + | .expect("unable to collect body")
|
5935 + | .to_bytes();
|
5434 5936 | ::aws_smithy_protocol_test::assert_ok(
|
5435 5937 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy regular expression pattern: ^[a-m]+$\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5436 5938 | );
|
5437 5939 | }
|
5438 5940 | }
|
5439 5941 | }
|
5440 5942 |
|
5441 5943 | ::pin_project_lite::pin_project! {
|
5442 5944 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
5443 5945 | /// [`MalformedLengthQueryStringInput`](crate::input::MalformedLengthQueryStringInput) using modelled bindings.
|
5444 5946 | pub struct MalformedLengthQueryStringInputFuture {
|
5445 5947 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedLengthQueryStringInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
5446 5948 | }
|
5447 5949 | }
|
5448 5950 |
|
5449 5951 | impl std::future::Future for MalformedLengthQueryStringInputFuture {
|
5450 5952 | type Output = Result<
|
5451 5953 | crate::input::MalformedLengthQueryStringInput,
|
5452 5954 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
5453 5955 | >;
|
5454 5956 |
|
5455 5957 | fn poll(
|
5456 5958 | self: std::pin::Pin<&mut Self>,
|
5457 5959 | cx: &mut std::task::Context<'_>,
|
5458 5960 | ) -> std::task::Poll<Self::Output> {
|
5459 5961 | let this = self.project();
|
5460 5962 | this.inner.as_mut().poll(cx)
|
5461 5963 | }
|
5462 5964 | }
|
5463 5965 |
|
5464 5966 | impl<B>
|
5465 5967 | ::aws_smithy_http_server::request::FromRequest<
|
5466 5968 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
5467 5969 | B,
|
5468 5970 | > for crate::input::MalformedLengthQueryStringInput
|
5469 5971 | where
|
5470 5972 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
5471 5973 | B: 'static,
|
5472 5974 |
|
5473 5975 | B::Data: Send,
|
5474 5976 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
5475 5977 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
5476 5978 | {
|
5477 5979 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
5478 5980 | type Future = MalformedLengthQueryStringInputFuture;
|
5479 5981 |
|
5480 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
5982 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
5481 5983 | let fut = async move {
|
5482 5984 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
5483 5985 | request.headers(),
|
5484 5986 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
5485 5987 | ) {
|
5486 5988 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
5487 5989 | }
|
5488 5990 | crate::protocol_serde::shape_malformed_length_query_string::de_malformed_length_query_string_http_request(request)
|
5489 5991 | .await
|
5490 5992 | };
|
5697 6205 | mod malformed_length_override_test {
|
5698 6206 |
|
5699 6207 | /// When a blob member does not fit within length bounds,
|
5700 6208 | /// the response should be a 400 ValidationException.
|
5701 6209 | /// Test ID: RestJsonMalformedLengthBlobOverride_case0
|
5702 6210 | #[::tokio::test]
|
5703 6211 | #[::tracing_test::traced_test]
|
5704 6212 | async fn rest_json_malformed_length_blob_override_case0_malformed_request() {
|
5705 6213 | {
|
5706 6214 | #[allow(unused_mut)]
|
5707 - | let mut http_request = http::Request::builder()
|
6215 + | let mut http_request = ::http_1x::Request::builder()
|
5708 6216 | .uri("/MalformedLengthOverride")
|
5709 6217 | .method("POST")
|
5710 6218 | .header("content-type", "application/json")
|
5711 - | .body(::aws_smithy_http_server::body::Body::from(
|
5712 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5713 - | "{ \"blob\" : \"YWJj\" }".as_bytes(),
|
5714 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6219 + | .body(::aws_smithy_http_server::body::boxed(
|
6220 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
6221 + | &::aws_smithy_protocol_test::decode_body_data(
|
6222 + | "{ \"blob\" : \"YWJj\" }".as_bytes(),
|
6223 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6224 + | ),
|
5715 6225 | )),
|
5716 6226 | ))
|
5717 6227 | .unwrap();
|
5718 6228 | #[allow(unused_mut)]
|
5719 6229 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5720 6230 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5721 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6231 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5722 6232 | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5723 6233 | let sender = sender.clone();
|
5724 6234 | async move {
|
5725 6235 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
5726 6236 | sender.send(()).await.expect("receiver dropped early");
|
5727 6237 | result
|
5728 6238 | }
|
5729 6239 | })
|
5730 6240 | .build_unchecked();
|
5731 6241 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5732 6242 | .await
|
5733 6243 | .expect("unable to make an HTTP request");
|
5734 6244 | ::pretty_assertions::assert_eq!(
|
5735 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6245 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5736 6246 | http_response.status()
|
5737 6247 | );
|
5738 6248 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5739 6249 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5740 6250 | http_response.headers(),
|
5741 6251 | expected_headers,
|
5742 6252 | ));
|
5743 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6253 + | use ::http_body_util::BodyExt;
|
6254 + | let body = http_response
|
6255 + | .into_body()
|
6256 + | .collect()
|
5744 6257 | .await
|
5745 - | .expect("unable to extract body to bytes");
|
6258 + | .expect("unable to collect body")
|
6259 + | .to_bytes();
|
5746 6260 | ::aws_smithy_protocol_test::assert_ok(
|
5747 6261 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/blob' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/blob' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/blob\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5748 6262 | );
|
5749 6263 | }
|
5750 6264 | }
|
5751 6265 |
|
5752 6266 | /// When a blob member does not fit within length bounds,
|
5753 6267 | /// the response should be a 400 ValidationException.
|
5754 6268 | /// Test ID: RestJsonMalformedLengthBlobOverride_case1
|
5755 6269 | #[::tokio::test]
|
5756 6270 | #[::tracing_test::traced_test]
|
5757 6271 | async fn rest_json_malformed_length_blob_override_case1_malformed_request() {
|
5758 6272 | {
|
5759 6273 | #[allow(unused_mut)]
|
5760 - | let mut http_request = http::Request::builder()
|
6274 + | let mut http_request = ::http_1x::Request::builder()
|
5761 6275 | .uri("/MalformedLengthOverride")
|
5762 6276 | .method("POST")
|
5763 6277 | .header("content-type", "application/json")
|
5764 - | .body(::aws_smithy_http_server::body::Body::from(
|
5765 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5766 - | "{ \"blob\" : \"YWJjZGVmZw==\" }".as_bytes(),
|
5767 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6278 + | .body(::aws_smithy_http_server::body::boxed(
|
6279 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
6280 + | &::aws_smithy_protocol_test::decode_body_data(
|
6281 + | "{ \"blob\" : \"YWJjZGVmZw==\" }".as_bytes(),
|
6282 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6283 + | ),
|
5768 6284 | )),
|
5769 6285 | ))
|
5770 6286 | .unwrap();
|
5771 6287 | #[allow(unused_mut)]
|
5772 6288 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5773 6289 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5774 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6290 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5775 6291 | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5776 6292 | let sender = sender.clone();
|
5777 6293 | async move {
|
5778 6294 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
5779 6295 | sender.send(()).await.expect("receiver dropped early");
|
5780 6296 | result
|
5781 6297 | }
|
5782 6298 | })
|
5783 6299 | .build_unchecked();
|
5784 6300 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5785 6301 | .await
|
5786 6302 | .expect("unable to make an HTTP request");
|
5787 6303 | ::pretty_assertions::assert_eq!(
|
5788 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6304 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5789 6305 | http_response.status()
|
5790 6306 | );
|
5791 6307 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5792 6308 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5793 6309 | http_response.headers(),
|
5794 6310 | expected_headers,
|
5795 6311 | ));
|
5796 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6312 + | use ::http_body_util::BodyExt;
|
6313 + | let body = http_response
|
6314 + | .into_body()
|
6315 + | .collect()
|
5797 6316 | .await
|
5798 - | .expect("unable to extract body to bytes");
|
6317 + | .expect("unable to collect body")
|
6318 + | .to_bytes();
|
5799 6319 | ::aws_smithy_protocol_test::assert_ok(
|
5800 6320 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 7 at '/blob' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 7 at '/blob' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/blob\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5801 6321 | );
|
5802 6322 | }
|
5803 6323 | }
|
5804 6324 |
|
5805 6325 | /// When a string member does not fit within length bounds,
|
5806 6326 | /// the response should be a 400 ValidationException.
|
5807 6327 | /// Test ID: RestJsonMalformedLengthStringOverride_case0
|
5808 6328 | #[::tokio::test]
|
5809 6329 | #[::tracing_test::traced_test]
|
5810 6330 | async fn rest_json_malformed_length_string_override_case0_malformed_request() {
|
5811 6331 | {
|
5812 6332 | #[allow(unused_mut)]
|
5813 - | let mut http_request = http::Request::builder()
|
6333 + | let mut http_request = ::http_1x::Request::builder()
|
5814 6334 | .uri("/MalformedLengthOverride")
|
5815 6335 | .method("POST")
|
5816 6336 | .header("content-type", "application/json")
|
5817 - | .body(::aws_smithy_http_server::body::Body::from(
|
5818 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5819 - | "{ \"string\" : \"abc\" }".as_bytes(),
|
5820 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6337 + | .body(::aws_smithy_http_server::body::boxed(
|
6338 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
6339 + | &::aws_smithy_protocol_test::decode_body_data(
|
6340 + | "{ \"string\" : \"abc\" }".as_bytes(),
|
6341 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6342 + | ),
|
5821 6343 | )),
|
5822 6344 | ))
|
5823 6345 | .unwrap();
|
5824 6346 | #[allow(unused_mut)]
|
5825 6347 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5826 6348 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5827 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6349 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5828 6350 | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5829 6351 | let sender = sender.clone();
|
5830 6352 | async move {
|
5831 6353 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
5832 6354 | sender.send(()).await.expect("receiver dropped early");
|
5833 6355 | result
|
5834 6356 | }
|
5835 6357 | })
|
5836 6358 | .build_unchecked();
|
5837 6359 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5838 6360 | .await
|
5839 6361 | .expect("unable to make an HTTP request");
|
5840 6362 | ::pretty_assertions::assert_eq!(
|
5841 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6363 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5842 6364 | http_response.status()
|
5843 6365 | );
|
5844 6366 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5845 6367 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5846 6368 | http_response.headers(),
|
5847 6369 | expected_headers,
|
5848 6370 | ));
|
5849 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6371 + | use ::http_body_util::BodyExt;
|
6372 + | let body = http_response
|
6373 + | .into_body()
|
6374 + | .collect()
|
5850 6375 | .await
|
5851 - | .expect("unable to extract body to bytes");
|
6376 + | .expect("unable to collect body")
|
6377 + | .to_bytes();
|
5852 6378 | ::aws_smithy_protocol_test::assert_ok(
|
5853 6379 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5854 6380 | );
|
5855 6381 | }
|
5856 6382 | }
|
5857 6383 |
|
5858 6384 | /// When a string member does not fit within length bounds,
|
5859 6385 | /// the response should be a 400 ValidationException.
|
5860 6386 | /// Test ID: RestJsonMalformedLengthStringOverride_case1
|
5861 6387 | #[::tokio::test]
|
5862 6388 | #[::tracing_test::traced_test]
|
5863 6389 | async fn rest_json_malformed_length_string_override_case1_malformed_request() {
|
5864 6390 | {
|
5865 6391 | #[allow(unused_mut)]
|
5866 - | let mut http_request = http::Request::builder()
|
6392 + | let mut http_request = ::http_1x::Request::builder()
|
5867 6393 | .uri("/MalformedLengthOverride")
|
5868 6394 | .method("POST")
|
5869 6395 | .header("content-type", "application/json")
|
5870 - | .body(::aws_smithy_http_server::body::Body::from(
|
5871 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5872 - | "{ \"string\" : \"abcdefg\" }".as_bytes(),
|
5873 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6396 + | .body(::aws_smithy_http_server::body::boxed(
|
6397 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
6398 + | &::aws_smithy_protocol_test::decode_body_data(
|
6399 + | "{ \"string\" : \"abcdefg\" }".as_bytes(),
|
6400 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6401 + | ),
|
5874 6402 | )),
|
5875 6403 | ))
|
5876 6404 | .unwrap();
|
5877 6405 | #[allow(unused_mut)]
|
5878 6406 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5879 6407 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5880 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6408 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5881 6409 | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5882 6410 | let sender = sender.clone();
|
5883 6411 | async move {
|
5884 6412 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
5885 6413 | sender.send(()).await.expect("receiver dropped early");
|
5886 6414 | result
|
5887 6415 | }
|
5888 6416 | })
|
5889 6417 | .build_unchecked();
|
5890 6418 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5891 6419 | .await
|
5892 6420 | .expect("unable to make an HTTP request");
|
5893 6421 | ::pretty_assertions::assert_eq!(
|
5894 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6422 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5895 6423 | http_response.status()
|
5896 6424 | );
|
5897 6425 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5898 6426 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5899 6427 | http_response.headers(),
|
5900 6428 | expected_headers,
|
5901 6429 | ));
|
5902 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6430 + | use ::http_body_util::BodyExt;
|
6431 + | let body = http_response
|
6432 + | .into_body()
|
6433 + | .collect()
|
5903 6434 | .await
|
5904 - | .expect("unable to extract body to bytes");
|
6435 + | .expect("unable to collect body")
|
6436 + | .to_bytes();
|
5905 6437 | ::aws_smithy_protocol_test::assert_ok(
|
5906 6438 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 7 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 7 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5907 6439 | );
|
5908 6440 | }
|
5909 6441 | }
|
5910 6442 |
|
5911 6443 | /// When a string member does not fit within length bounds,
|
5912 6444 | /// the response should be a 400 ValidationException.
|
5913 6445 | /// Test ID: RestJsonMalformedLengthStringOverride_case2
|
5914 6446 | #[::tokio::test]
|
5915 6447 | #[::tracing_test::traced_test]
|
5916 6448 | async fn rest_json_malformed_length_string_override_case2_malformed_request() {
|
5917 6449 | {
|
5918 6450 | #[allow(unused_mut)]
|
5919 - | let mut http_request = http::Request::builder()
|
6451 + | let mut http_request = ::http_1x::Request::builder()
|
5920 6452 | .uri("/MalformedLengthOverride")
|
5921 6453 | .method("POST")
|
5922 6454 | .header("content-type", "application/json")
|
5923 - | .body(::aws_smithy_http_server::body::Body::from(
|
5924 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5925 - | "{ \"string\" : \"👍👍👍\" }".as_bytes(),
|
5926 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6455 + | .body(::aws_smithy_http_server::body::boxed(
|
6456 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
6457 + | &::aws_smithy_protocol_test::decode_body_data(
|
6458 + | "{ \"string\" : \"👍👍👍\" }".as_bytes(),
|
6459 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6460 + | ),
|
5927 6461 | )),
|
5928 6462 | ))
|
5929 6463 | .unwrap();
|
5930 6464 | #[allow(unused_mut)]
|
5931 6465 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5932 6466 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5933 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6467 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5934 6468 | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5935 6469 | let sender = sender.clone();
|
5936 6470 | async move {
|
5937 6471 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
5938 6472 | sender.send(()).await.expect("receiver dropped early");
|
5939 6473 | result
|
5940 6474 | }
|
5941 6475 | })
|
5942 6476 | .build_unchecked();
|
5943 6477 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5944 6478 | .await
|
5945 6479 | .expect("unable to make an HTTP request");
|
5946 6480 | ::pretty_assertions::assert_eq!(
|
5947 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6481 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5948 6482 | http_response.status()
|
5949 6483 | );
|
5950 6484 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
5951 6485 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5952 6486 | http_response.headers(),
|
5953 6487 | expected_headers,
|
5954 6488 | ));
|
5955 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6489 + | use ::http_body_util::BodyExt;
|
6490 + | let body = http_response
|
6491 + | .into_body()
|
6492 + | .collect()
|
5956 6493 | .await
|
5957 - | .expect("unable to extract body to bytes");
|
6494 + | .expect("unable to collect body")
|
6495 + | .to_bytes();
|
5958 6496 | ::aws_smithy_protocol_test::assert_ok(
|
5959 6497 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/string' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
5960 6498 | );
|
5961 6499 | }
|
5962 6500 | }
|
5963 6501 |
|
5964 6502 | /// When a string member does not fit within length bounds,
|
5965 6503 | /// the response should be a 400 ValidationException.
|
5966 6504 | /// Test ID: RestJsonMalformedLengthMinStringOverride
|
5967 6505 | #[::tokio::test]
|
5968 6506 | #[::tracing_test::traced_test]
|
5969 6507 | async fn rest_json_malformed_length_min_string_override_malformed_request() {
|
5970 6508 | {
|
5971 6509 | #[allow(unused_mut)]
|
5972 - | let mut http_request = http::Request::builder()
|
6510 + | let mut http_request = ::http_1x::Request::builder()
|
5973 6511 | .uri("/MalformedLengthOverride")
|
5974 6512 | .method("POST")
|
5975 6513 | .header("content-type", "application/json")
|
5976 - | .body(::aws_smithy_http_server::body::Body::from(
|
5977 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5978 - | "{ \"minString\" : \"abc\" }".as_bytes(),
|
5979 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6514 + | .body(::aws_smithy_http_server::body::boxed(
|
6515 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
6516 + | &::aws_smithy_protocol_test::decode_body_data(
|
6517 + | "{ \"minString\" : \"abc\" }".as_bytes(),
|
6518 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6519 + | ),
|
5980 6520 | )),
|
5981 6521 | ))
|
5982 6522 | .unwrap();
|
5983 6523 | #[allow(unused_mut)]
|
5984 6524 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5985 6525 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
5986 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6526 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5987 6527 | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
5988 6528 | let sender = sender.clone();
|
5989 6529 | async move {
|
5990 6530 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
5991 6531 | sender.send(()).await.expect("receiver dropped early");
|
5992 6532 | result
|
5993 6533 | }
|
5994 6534 | })
|
5995 6535 | .build_unchecked();
|
5996 6536 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5997 6537 | .await
|
5998 6538 | .expect("unable to make an HTTP request");
|
5999 6539 | ::pretty_assertions::assert_eq!(
|
6000 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6540 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6001 6541 | http_response.status()
|
6002 6542 | );
|
6003 6543 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6004 6544 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6005 6545 | http_response.headers(),
|
6006 6546 | expected_headers,
|
6007 6547 | ));
|
6008 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6548 + | use ::http_body_util::BodyExt;
|
6549 + | let body = http_response
|
6550 + | .into_body()
|
6551 + | .collect()
|
6009 6552 | .await
|
6010 - | .expect("unable to extract body to bytes");
|
6553 + | .expect("unable to collect body")
|
6554 + | .to_bytes();
|
6011 6555 | ::aws_smithy_protocol_test::assert_ok(
|
6012 6556 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/minString' failed to satisfy constraint: Member must have length greater than or equal to 4\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/minString' failed to satisfy constraint: Member must have length greater than or equal to 4\", \"path\": \"/minString\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6013 6557 | );
|
6014 6558 | }
|
6015 6559 | }
|
6016 6560 |
|
6017 6561 | /// When a string member does not fit within length bounds,
|
6018 6562 | /// the response should be a 400 ValidationException.
|
6019 6563 | /// Test ID: RestJsonMalformedLengthMaxStringOverride
|
6020 6564 | #[::tokio::test]
|
6021 6565 | #[::tracing_test::traced_test]
|
6022 6566 | async fn rest_json_malformed_length_max_string_override_malformed_request() {
|
6023 6567 | {
|
6024 6568 | #[allow(unused_mut)]
|
6025 - | let mut http_request = http::Request::builder()
|
6569 + | let mut http_request = ::http_1x::Request::builder()
|
6026 6570 | .uri("/MalformedLengthOverride")
|
6027 6571 | .method("POST")
|
6028 6572 | .header("content-type", "application/json")
|
6029 - | .body(::aws_smithy_http_server::body::Body::from(
|
6030 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6031 - | "{ \"maxString\" : \"abcdefg\" }".as_bytes(),
|
6032 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6573 + | .body(::aws_smithy_http_server::body::boxed(
|
6574 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
6575 + | &::aws_smithy_protocol_test::decode_body_data(
|
6576 + | "{ \"maxString\" : \"abcdefg\" }".as_bytes(),
|
6577 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6578 + | ),
|
6033 6579 | )),
|
6034 6580 | ))
|
6035 6581 | .unwrap();
|
6036 6582 | #[allow(unused_mut)]
|
6037 6583 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6038 6584 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6039 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6585 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6040 6586 | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
6041 6587 | let sender = sender.clone();
|
6042 6588 | async move {
|
6043 6589 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
6044 6590 | sender.send(()).await.expect("receiver dropped early");
|
6045 6591 | result
|
6046 6592 | }
|
6047 6593 | })
|
6048 6594 | .build_unchecked();
|
6049 6595 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6050 6596 | .await
|
6051 6597 | .expect("unable to make an HTTP request");
|
6052 6598 | ::pretty_assertions::assert_eq!(
|
6053 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6599 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6054 6600 | http_response.status()
|
6055 6601 | );
|
6056 6602 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6057 6603 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6058 6604 | http_response.headers(),
|
6059 6605 | expected_headers,
|
6060 6606 | ));
|
6061 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6607 + | use ::http_body_util::BodyExt;
|
6608 + | let body = http_response
|
6609 + | .into_body()
|
6610 + | .collect()
|
6062 6611 | .await
|
6063 - | .expect("unable to extract body to bytes");
|
6612 + | .expect("unable to collect body")
|
6613 + | .to_bytes();
|
6064 6614 | ::aws_smithy_protocol_test::assert_ok(
|
6065 6615 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 7 at '/maxString' failed to satisfy constraint: Member must have length less than or equal to 6\",\n \"fieldList\" : [{\"message\": \"Value with length 7 at '/maxString' failed to satisfy constraint: Member must have length less than or equal to 6\", \"path\": \"/maxString\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6066 6616 | );
|
6067 6617 | }
|
6068 6618 | }
|
6069 6619 |
|
6070 6620 | /// When a list member does not fit within length bounds,
|
6071 6621 | /// the response should be a 400 ValidationException.
|
6072 6622 | /// Test ID: RestJsonMalformedLengthListOverride_case0
|
6073 6623 | #[::tokio::test]
|
6074 6624 | #[::tracing_test::traced_test]
|
6075 6625 | async fn rest_json_malformed_length_list_override_case0_malformed_request() {
|
6076 6626 | {
|
6077 6627 | #[allow(unused_mut)]
|
6078 - | let mut http_request = http::Request::builder()
|
6628 + | let mut http_request = ::http_1x::Request::builder()
|
6079 6629 | .uri("/MalformedLengthOverride")
|
6080 6630 | .method("POST")
|
6081 6631 | .header("content-type", "application/json")
|
6082 - | .body(::aws_smithy_http_server::body::Body::from(
|
6083 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6084 - | "{ \"list\" : [\"abc\", \"def\", \"ghi\"] }".as_bytes(),
|
6085 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6632 + | .body(::aws_smithy_http_server::body::boxed(
|
6633 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
6634 + | &::aws_smithy_protocol_test::decode_body_data(
|
6635 + | "{ \"list\" : [\"abc\", \"def\", \"ghi\"] }".as_bytes(),
|
6636 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6637 + | ),
|
6086 6638 | )),
|
6087 6639 | ))
|
6088 6640 | .unwrap();
|
6089 6641 | #[allow(unused_mut)]
|
6090 6642 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6091 6643 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6092 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6644 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6093 6645 | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
6094 6646 | let sender = sender.clone();
|
6095 6647 | async move {
|
6096 6648 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
6097 6649 | sender.send(()).await.expect("receiver dropped early");
|
6098 6650 | result
|
6099 6651 | }
|
6100 6652 | })
|
6101 6653 | .build_unchecked();
|
6102 6654 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6103 6655 | .await
|
6104 6656 | .expect("unable to make an HTTP request");
|
6105 6657 | ::pretty_assertions::assert_eq!(
|
6106 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6658 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6107 6659 | http_response.status()
|
6108 6660 | );
|
6109 6661 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6110 6662 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6111 6663 | http_response.headers(),
|
6112 6664 | expected_headers,
|
6113 6665 | ));
|
6114 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6666 + | use ::http_body_util::BodyExt;
|
6667 + | let body = http_response
|
6668 + | .into_body()
|
6669 + | .collect()
|
6115 6670 | .await
|
6116 - | .expect("unable to extract body to bytes");
|
6671 + | .expect("unable to collect body")
|
6672 + | .to_bytes();
|
6117 6673 | ::aws_smithy_protocol_test::assert_ok(
|
6118 6674 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/list' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/list' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/list\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6119 6675 | );
|
6120 6676 | }
|
6121 6677 | }
|
6122 6678 |
|
6123 6679 | /// When a list member does not fit within length bounds,
|
6124 6680 | /// the response should be a 400 ValidationException.
|
6125 6681 | /// Test ID: RestJsonMalformedLengthListOverride_case1
|
6126 6682 | #[::tokio::test]
|
6127 6683 | #[::tracing_test::traced_test]
|
6128 6684 | async fn rest_json_malformed_length_list_override_case1_malformed_request() {
|
6129 6685 | {
|
6130 6686 | #[allow(unused_mut)]
|
6131 - | let mut http_request = http::Request::builder()
|
6687 + | let mut http_request = ::http_1x::Request::builder()
|
6132 6688 | .uri("/MalformedLengthOverride")
|
6133 6689 | .method("POST")
|
6134 6690 | .header("content-type", "application/json")
|
6135 - | .body(::aws_smithy_http_server::body::Body::from(
|
6136 - | ::bytes::Bytes::copy_from_slice(
|
6137 - | &::aws_smithy_protocol_test::decode_body_data("{ \"list\" : [\"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\"] }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
6138 - | )
|
6139 - | )).unwrap();
|
6691 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
6692 + | ::bytes::Bytes::copy_from_slice(
|
6693 + | &::aws_smithy_protocol_test::decode_body_data("{ \"list\" : [\"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\"] }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
6694 + | )
|
6695 + | ))).unwrap();
|
6140 6696 | #[allow(unused_mut)]
|
6141 6697 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6142 6698 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6143 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6699 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6144 6700 | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
6145 6701 | let sender = sender.clone();
|
6146 6702 | async move {
|
6147 6703 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
6148 6704 | sender.send(()).await.expect("receiver dropped early");
|
6149 6705 | result
|
6150 6706 | }
|
6151 6707 | })
|
6152 6708 | .build_unchecked();
|
6153 6709 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6154 6710 | .await
|
6155 6711 | .expect("unable to make an HTTP request");
|
6156 6712 | ::pretty_assertions::assert_eq!(
|
6157 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6713 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6158 6714 | http_response.status()
|
6159 6715 | );
|
6160 6716 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6161 6717 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6162 6718 | http_response.headers(),
|
6163 6719 | expected_headers,
|
6164 6720 | ));
|
6165 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6721 + | use ::http_body_util::BodyExt;
|
6722 + | let body = http_response
|
6723 + | .into_body()
|
6724 + | .collect()
|
6166 6725 | .await
|
6167 - | .expect("unable to extract body to bytes");
|
6726 + | .expect("unable to collect body")
|
6727 + | .to_bytes();
|
6168 6728 | ::aws_smithy_protocol_test::assert_ok(
|
6169 6729 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 7 at '/list' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 7 at '/list' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/list\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6170 6730 | );
|
6171 6731 | }
|
6172 6732 | }
|
6173 6733 |
|
6174 6734 | /// When a map member does not fit within length bounds,
|
6175 6735 | /// the response should be a 400 ValidationException.
|
6176 6736 | /// Test ID: RestJsonMalformedLengthMapOverride_case0
|
6177 6737 | #[::tokio::test]
|
6178 6738 | #[::tracing_test::traced_test]
|
6179 6739 | async fn rest_json_malformed_length_map_override_case0_malformed_request() {
|
6180 6740 | {
|
6181 6741 | #[allow(unused_mut)]
|
6182 - | let mut http_request = http::Request::builder()
|
6742 + | let mut http_request = ::http_1x::Request::builder()
|
6183 6743 | .uri("/MalformedLengthOverride")
|
6184 6744 | .method("POST")
|
6185 6745 | .header("content-type", "application/json")
|
6186 - | .body(::aws_smithy_http_server::body::Body::from(
|
6187 - | ::bytes::Bytes::copy_from_slice(
|
6188 - | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"def\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
6189 - | )
|
6190 - | )).unwrap();
|
6746 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
6747 + | ::bytes::Bytes::copy_from_slice(
|
6748 + | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"def\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
6749 + | )
|
6750 + | ))).unwrap();
|
6191 6751 | #[allow(unused_mut)]
|
6192 6752 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6193 6753 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6194 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6754 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6195 6755 | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
6196 6756 | let sender = sender.clone();
|
6197 6757 | async move {
|
6198 6758 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
6199 6759 | sender.send(()).await.expect("receiver dropped early");
|
6200 6760 | result
|
6201 6761 | }
|
6202 6762 | })
|
6203 6763 | .build_unchecked();
|
6204 6764 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6205 6765 | .await
|
6206 6766 | .expect("unable to make an HTTP request");
|
6207 6767 | ::pretty_assertions::assert_eq!(
|
6208 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6768 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6209 6769 | http_response.status()
|
6210 6770 | );
|
6211 6771 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6212 6772 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6213 6773 | http_response.headers(),
|
6214 6774 | expected_headers,
|
6215 6775 | ));
|
6216 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6776 + | use ::http_body_util::BodyExt;
|
6777 + | let body = http_response
|
6778 + | .into_body()
|
6779 + | .collect()
|
6217 6780 | .await
|
6218 - | .expect("unable to extract body to bytes");
|
6781 + | .expect("unable to collect body")
|
6782 + | .to_bytes();
|
6219 6783 | ::aws_smithy_protocol_test::assert_ok(
|
6220 6784 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 3 at '/map' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 3 at '/map' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6221 6785 | );
|
6222 6786 | }
|
6223 6787 | }
|
6224 6788 |
|
6225 6789 | /// When a map member does not fit within length bounds,
|
6226 6790 | /// the response should be a 400 ValidationException.
|
6227 6791 | /// Test ID: RestJsonMalformedLengthMapOverride_case1
|
6228 6792 | #[::tokio::test]
|
6229 6793 | #[::tracing_test::traced_test]
|
6230 6794 | async fn rest_json_malformed_length_map_override_case1_malformed_request() {
|
6231 6795 | {
|
6232 6796 | #[allow(unused_mut)]
|
6233 - | let mut http_request = http::Request::builder()
|
6797 + | let mut http_request = ::http_1x::Request::builder()
|
6234 6798 | .uri("/MalformedLengthOverride")
|
6235 6799 | .method("POST")
|
6236 6800 | .header("content-type", "application/json")
|
6237 - | .body(::aws_smithy_http_server::body::Body::from(
|
6238 - | ::bytes::Bytes::copy_from_slice(
|
6239 - | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abc\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"],\n \"cde\": [\"abc\", \"def\", \"efg\"], \"def\": [\"abc\", \"def\", \"efg\"],\n \"efg\": [\"abc\", \"def\", \"efg\"], \"fgh\": [\"abc\", \"def\", \"efg\"],\n \"ghi\": [\"abc\", \"def\", \"efg\"] } }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
6240 - | )
|
6241 - | )).unwrap();
|
6801 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
6802 + | ::bytes::Bytes::copy_from_slice(
|
6803 + | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abc\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"],\n \"cde\": [\"abc\", \"def\", \"efg\"], \"def\": [\"abc\", \"def\", \"efg\"],\n \"efg\": [\"abc\", \"def\", \"efg\"], \"fgh\": [\"abc\", \"def\", \"efg\"],\n \"ghi\": [\"abc\", \"def\", \"efg\"] } }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
6804 + | )
|
6805 + | ))).unwrap();
|
6242 6806 | #[allow(unused_mut)]
|
6243 6807 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6244 6808 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6245 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6809 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6246 6810 | .malformed_length_override(move |input: crate::input::MalformedLengthOverrideInput| {
|
6247 6811 | let sender = sender.clone();
|
6248 6812 | async move {
|
6249 6813 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOverrideOutput, crate::error::MalformedLengthOverrideError> };
|
6250 6814 | sender.send(()).await.expect("receiver dropped early");
|
6251 6815 | result
|
6252 6816 | }
|
6253 6817 | })
|
6254 6818 | .build_unchecked();
|
6255 6819 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6256 6820 | .await
|
6257 6821 | .expect("unable to make an HTTP request");
|
6258 6822 | ::pretty_assertions::assert_eq!(
|
6259 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6823 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6260 6824 | http_response.status()
|
6261 6825 | );
|
6262 6826 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6263 6827 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6264 6828 | http_response.headers(),
|
6265 6829 | expected_headers,
|
6266 6830 | ));
|
6267 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6831 + | use ::http_body_util::BodyExt;
|
6832 + | let body = http_response
|
6833 + | .into_body()
|
6834 + | .collect()
|
6268 6835 | .await
|
6269 - | .expect("unable to extract body to bytes");
|
6836 + | .expect("unable to collect body")
|
6837 + | .to_bytes();
|
6270 6838 | ::aws_smithy_protocol_test::assert_ok(
|
6271 6839 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 7 at '/map' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 7 at '/map' failed to satisfy constraint: Member must have length between 4 and 6, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6272 6840 | );
|
6273 6841 | }
|
6274 6842 | }
|
6275 6843 | }
|
6276 6844 |
|
6277 6845 | ::pin_project_lite::pin_project! {
|
6278 6846 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
6279 6847 | /// [`MalformedLengthInput`](crate::input::MalformedLengthInput) using modelled bindings.
|
6280 6848 | pub struct MalformedLengthInputFuture {
|
6281 6849 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedLengthInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
6282 6850 | }
|
6283 6851 | }
|
6284 6852 |
|
6285 6853 | impl std::future::Future for MalformedLengthInputFuture {
|
6286 6854 | type Output = Result<
|
6287 6855 | crate::input::MalformedLengthInput,
|
6288 6856 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
6289 6857 | >;
|
6290 6858 |
|
6291 6859 | fn poll(
|
6292 6860 | self: std::pin::Pin<&mut Self>,
|
6293 6861 | cx: &mut std::task::Context<'_>,
|
6294 6862 | ) -> std::task::Poll<Self::Output> {
|
6295 6863 | let this = self.project();
|
6296 6864 | this.inner.as_mut().poll(cx)
|
6297 6865 | }
|
6298 6866 | }
|
6299 6867 |
|
6300 6868 | impl<B>
|
6301 6869 | ::aws_smithy_http_server::request::FromRequest<
|
6302 6870 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6303 6871 | B,
|
6304 6872 | > for crate::input::MalformedLengthInput
|
6305 6873 | where
|
6306 6874 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
6307 6875 | B: 'static,
|
6308 6876 |
|
6309 6877 | B::Data: Send,
|
6310 6878 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
6311 6879 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
6312 6880 | {
|
6313 6881 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
6314 6882 | type Future = MalformedLengthInputFuture;
|
6315 6883 |
|
6316 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
6884 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
6317 6885 | let fut = async move {
|
6318 6886 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
6319 6887 | request.headers(),
|
6320 6888 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
6321 6889 | ) {
|
6322 6890 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
6323 6891 | }
|
6324 6892 | crate::protocol_serde::shape_malformed_length::de_malformed_length_http_request(request)
|
6325 6893 | .await
|
6326 6894 | };
|
6382 6950 | mod malformed_length_test {
|
6383 6951 |
|
6384 6952 | /// When a blob member does not fit within length bounds,
|
6385 6953 | /// the response should be a 400 ValidationException.
|
6386 6954 | /// Test ID: RestJsonMalformedLengthBlob_case0
|
6387 6955 | #[::tokio::test]
|
6388 6956 | #[::tracing_test::traced_test]
|
6389 6957 | async fn rest_json_malformed_length_blob_case0_malformed_request() {
|
6390 6958 | {
|
6391 6959 | #[allow(unused_mut)]
|
6392 - | let mut http_request = http::Request::builder()
|
6960 + | let mut http_request = ::http_1x::Request::builder()
|
6393 6961 | .uri("/MalformedLength")
|
6394 6962 | .method("POST")
|
6395 6963 | .header("content-type", "application/json")
|
6396 - | .body(::aws_smithy_http_server::body::Body::from(
|
6397 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6398 - | "{ \"blob\" : \"YQ==\" }".as_bytes(),
|
6399 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6964 + | .body(::aws_smithy_http_server::body::boxed(
|
6965 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
6966 + | &::aws_smithy_protocol_test::decode_body_data(
|
6967 + | "{ \"blob\" : \"YQ==\" }".as_bytes(),
|
6968 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
6969 + | ),
|
6400 6970 | )),
|
6401 6971 | ))
|
6402 6972 | .unwrap();
|
6403 6973 | #[allow(unused_mut)]
|
6404 6974 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6405 6975 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6406 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
6976 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6407 6977 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6408 6978 | let sender = sender.clone();
|
6409 6979 | async move {
|
6410 6980 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
6411 6981 | sender.send(()).await.expect("receiver dropped early");
|
6412 6982 | result
|
6413 6983 | }
|
6414 6984 | })
|
6415 6985 | .build_unchecked();
|
6416 6986 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6417 6987 | .await
|
6418 6988 | .expect("unable to make an HTTP request");
|
6419 6989 | ::pretty_assertions::assert_eq!(
|
6420 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6990 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6421 6991 | http_response.status()
|
6422 6992 | );
|
6423 6993 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6424 6994 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6425 6995 | http_response.headers(),
|
6426 6996 | expected_headers,
|
6427 6997 | ));
|
6428 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
6998 + | use ::http_body_util::BodyExt;
|
6999 + | let body = http_response
|
7000 + | .into_body()
|
7001 + | .collect()
|
6429 7002 | .await
|
6430 - | .expect("unable to extract body to bytes");
|
7003 + | .expect("unable to collect body")
|
7004 + | .to_bytes();
|
6431 7005 | ::aws_smithy_protocol_test::assert_ok(
|
6432 7006 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/blob' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/blob' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/blob\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6433 7007 | );
|
6434 7008 | }
|
6435 7009 | }
|
6436 7010 |
|
6437 7011 | /// When a blob member does not fit within length bounds,
|
6438 7012 | /// the response should be a 400 ValidationException.
|
6439 7013 | /// Test ID: RestJsonMalformedLengthBlob_case1
|
6440 7014 | #[::tokio::test]
|
6441 7015 | #[::tracing_test::traced_test]
|
6442 7016 | async fn rest_json_malformed_length_blob_case1_malformed_request() {
|
6443 7017 | {
|
6444 7018 | #[allow(unused_mut)]
|
6445 - | let mut http_request = http::Request::builder()
|
7019 + | let mut http_request = ::http_1x::Request::builder()
|
6446 7020 | .uri("/MalformedLength")
|
6447 7021 | .method("POST")
|
6448 7022 | .header("content-type", "application/json")
|
6449 - | .body(::aws_smithy_http_server::body::Body::from(
|
6450 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6451 - | "{ \"blob\" : \"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=\" }".as_bytes(),
|
6452 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7023 + | .body(::aws_smithy_http_server::body::boxed(
|
7024 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
7025 + | &::aws_smithy_protocol_test::decode_body_data(
|
7026 + | "{ \"blob\" : \"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXo=\" }".as_bytes(),
|
7027 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7028 + | ),
|
6453 7029 | )),
|
6454 7030 | ))
|
6455 7031 | .unwrap();
|
6456 7032 | #[allow(unused_mut)]
|
6457 7033 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6458 7034 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6459 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7035 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6460 7036 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6461 7037 | let sender = sender.clone();
|
6462 7038 | async move {
|
6463 7039 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
6464 7040 | sender.send(()).await.expect("receiver dropped early");
|
6465 7041 | result
|
6466 7042 | }
|
6467 7043 | })
|
6468 7044 | .build_unchecked();
|
6469 7045 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6470 7046 | .await
|
6471 7047 | .expect("unable to make an HTTP request");
|
6472 7048 | ::pretty_assertions::assert_eq!(
|
6473 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7049 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6474 7050 | http_response.status()
|
6475 7051 | );
|
6476 7052 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6477 7053 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6478 7054 | http_response.headers(),
|
6479 7055 | expected_headers,
|
6480 7056 | ));
|
6481 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7057 + | use ::http_body_util::BodyExt;
|
7058 + | let body = http_response
|
7059 + | .into_body()
|
7060 + | .collect()
|
6482 7061 | .await
|
6483 - | .expect("unable to extract body to bytes");
|
7062 + | .expect("unable to collect body")
|
7063 + | .to_bytes();
|
6484 7064 | ::aws_smithy_protocol_test::assert_ok(
|
6485 7065 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 26 at '/blob' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 26 at '/blob' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/blob\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6486 7066 | );
|
6487 7067 | }
|
6488 7068 | }
|
6489 7069 |
|
6490 7070 | /// When a string member does not fit within length bounds,
|
6491 7071 | /// the response should be a 400 ValidationException.
|
6492 7072 | /// Test ID: RestJsonMalformedLengthString_case0
|
6493 7073 | #[::tokio::test]
|
6494 7074 | #[::tracing_test::traced_test]
|
6495 7075 | async fn rest_json_malformed_length_string_case0_malformed_request() {
|
6496 7076 | {
|
6497 7077 | #[allow(unused_mut)]
|
6498 - | let mut http_request = http::Request::builder()
|
7078 + | let mut http_request = ::http_1x::Request::builder()
|
6499 7079 | .uri("/MalformedLength")
|
6500 7080 | .method("POST")
|
6501 7081 | .header("content-type", "application/json")
|
6502 - | .body(::aws_smithy_http_server::body::Body::from(
|
6503 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6504 - | "{ \"string\" : \"a\" }".as_bytes(),
|
6505 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7082 + | .body(::aws_smithy_http_server::body::boxed(
|
7083 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
7084 + | &::aws_smithy_protocol_test::decode_body_data(
|
7085 + | "{ \"string\" : \"a\" }".as_bytes(),
|
7086 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7087 + | ),
|
6506 7088 | )),
|
6507 7089 | ))
|
6508 7090 | .unwrap();
|
6509 7091 | #[allow(unused_mut)]
|
6510 7092 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6511 7093 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6512 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7094 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6513 7095 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6514 7096 | let sender = sender.clone();
|
6515 7097 | async move {
|
6516 7098 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
6517 7099 | sender.send(()).await.expect("receiver dropped early");
|
6518 7100 | result
|
6519 7101 | }
|
6520 7102 | })
|
6521 7103 | .build_unchecked();
|
6522 7104 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6523 7105 | .await
|
6524 7106 | .expect("unable to make an HTTP request");
|
6525 7107 | ::pretty_assertions::assert_eq!(
|
6526 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7108 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6527 7109 | http_response.status()
|
6528 7110 | );
|
6529 7111 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6530 7112 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6531 7113 | http_response.headers(),
|
6532 7114 | expected_headers,
|
6533 7115 | ));
|
6534 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7116 + | use ::http_body_util::BodyExt;
|
7117 + | let body = http_response
|
7118 + | .into_body()
|
7119 + | .collect()
|
6535 7120 | .await
|
6536 - | .expect("unable to extract body to bytes");
|
7121 + | .expect("unable to collect body")
|
7122 + | .to_bytes();
|
6537 7123 | ::aws_smithy_protocol_test::assert_ok(
|
6538 7124 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6539 7125 | );
|
6540 7126 | }
|
6541 7127 | }
|
6542 7128 |
|
6543 7129 | /// When a string member does not fit within length bounds,
|
6544 7130 | /// the response should be a 400 ValidationException.
|
6545 7131 | /// Test ID: RestJsonMalformedLengthString_case1
|
6546 7132 | #[::tokio::test]
|
6547 7133 | #[::tracing_test::traced_test]
|
6548 7134 | async fn rest_json_malformed_length_string_case1_malformed_request() {
|
6549 7135 | {
|
6550 7136 | #[allow(unused_mut)]
|
6551 - | let mut http_request = http::Request::builder()
|
7137 + | let mut http_request = ::http_1x::Request::builder()
|
6552 7138 | .uri("/MalformedLength")
|
6553 7139 | .method("POST")
|
6554 7140 | .header("content-type", "application/json")
|
6555 - | .body(::aws_smithy_http_server::body::Body::from(
|
6556 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6557 - | "{ \"string\" : \"abcdefghijklmnopqrstuvwxyz\" }".as_bytes(),
|
6558 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7141 + | .body(::aws_smithy_http_server::body::boxed(
|
7142 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
7143 + | &::aws_smithy_protocol_test::decode_body_data(
|
7144 + | "{ \"string\" : \"abcdefghijklmnopqrstuvwxyz\" }".as_bytes(),
|
7145 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7146 + | ),
|
6559 7147 | )),
|
6560 7148 | ))
|
6561 7149 | .unwrap();
|
6562 7150 | #[allow(unused_mut)]
|
6563 7151 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6564 7152 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6565 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7153 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6566 7154 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6567 7155 | let sender = sender.clone();
|
6568 7156 | async move {
|
6569 7157 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
6570 7158 | sender.send(()).await.expect("receiver dropped early");
|
6571 7159 | result
|
6572 7160 | }
|
6573 7161 | })
|
6574 7162 | .build_unchecked();
|
6575 7163 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6576 7164 | .await
|
6577 7165 | .expect("unable to make an HTTP request");
|
6578 7166 | ::pretty_assertions::assert_eq!(
|
6579 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7167 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6580 7168 | http_response.status()
|
6581 7169 | );
|
6582 7170 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6583 7171 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6584 7172 | http_response.headers(),
|
6585 7173 | expected_headers,
|
6586 7174 | ));
|
6587 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7175 + | use ::http_body_util::BodyExt;
|
7176 + | let body = http_response
|
7177 + | .into_body()
|
7178 + | .collect()
|
6588 7179 | .await
|
6589 - | .expect("unable to extract body to bytes");
|
7180 + | .expect("unable to collect body")
|
7181 + | .to_bytes();
|
6590 7182 | ::aws_smithy_protocol_test::assert_ok(
|
6591 7183 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 26 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 26 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6592 7184 | );
|
6593 7185 | }
|
6594 7186 | }
|
6595 7187 |
|
6596 7188 | /// When a string member does not fit within length bounds,
|
6597 7189 | /// the response should be a 400 ValidationException.
|
6598 7190 | /// Test ID: RestJsonMalformedLengthString_case2
|
6599 7191 | #[::tokio::test]
|
6600 7192 | #[::tracing_test::traced_test]
|
6601 7193 | async fn rest_json_malformed_length_string_case2_malformed_request() {
|
6602 7194 | {
|
6603 7195 | #[allow(unused_mut)]
|
6604 - | let mut http_request = http::Request::builder()
|
7196 + | let mut http_request = ::http_1x::Request::builder()
|
6605 7197 | .uri("/MalformedLength")
|
6606 7198 | .method("POST")
|
6607 7199 | .header("content-type", "application/json")
|
6608 - | .body(::aws_smithy_http_server::body::Body::from(
|
6609 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6610 - | "{ \"string\" : \"👍\" }".as_bytes(),
|
6611 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7200 + | .body(::aws_smithy_http_server::body::boxed(
|
7201 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
7202 + | &::aws_smithy_protocol_test::decode_body_data(
|
7203 + | "{ \"string\" : \"👍\" }".as_bytes(),
|
7204 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7205 + | ),
|
6612 7206 | )),
|
6613 7207 | ))
|
6614 7208 | .unwrap();
|
6615 7209 | #[allow(unused_mut)]
|
6616 7210 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6617 7211 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6618 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7212 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6619 7213 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6620 7214 | let sender = sender.clone();
|
6621 7215 | async move {
|
6622 7216 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
6623 7217 | sender.send(()).await.expect("receiver dropped early");
|
6624 7218 | result
|
6625 7219 | }
|
6626 7220 | })
|
6627 7221 | .build_unchecked();
|
6628 7222 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6629 7223 | .await
|
6630 7224 | .expect("unable to make an HTTP request");
|
6631 7225 | ::pretty_assertions::assert_eq!(
|
6632 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7226 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6633 7227 | http_response.status()
|
6634 7228 | );
|
6635 7229 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6636 7230 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6637 7231 | http_response.headers(),
|
6638 7232 | expected_headers,
|
6639 7233 | ));
|
6640 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7234 + | use ::http_body_util::BodyExt;
|
7235 + | let body = http_response
|
7236 + | .into_body()
|
7237 + | .collect()
|
6641 7238 | .await
|
6642 - | .expect("unable to extract body to bytes");
|
7239 + | .expect("unable to collect body")
|
7240 + | .to_bytes();
|
6643 7241 | ::aws_smithy_protocol_test::assert_ok(
|
6644 7242 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/string' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6645 7243 | );
|
6646 7244 | }
|
6647 7245 | }
|
6648 7246 |
|
6649 7247 | /// When a string member does not fit within length bounds,
|
6650 7248 | /// the response should be a 400 ValidationException.
|
6651 7249 | /// Test ID: RestJsonMalformedLengthMinString
|
6652 7250 | #[::tokio::test]
|
6653 7251 | #[::tracing_test::traced_test]
|
6654 7252 | async fn rest_json_malformed_length_min_string_malformed_request() {
|
6655 7253 | {
|
6656 7254 | #[allow(unused_mut)]
|
6657 - | let mut http_request = http::Request::builder()
|
7255 + | let mut http_request = ::http_1x::Request::builder()
|
6658 7256 | .uri("/MalformedLength")
|
6659 7257 | .method("POST")
|
6660 7258 | .header("content-type", "application/json")
|
6661 - | .body(::aws_smithy_http_server::body::Body::from(
|
6662 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6663 - | "{ \"minString\" : \"a\" }".as_bytes(),
|
6664 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7259 + | .body(::aws_smithy_http_server::body::boxed(
|
7260 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
7261 + | &::aws_smithy_protocol_test::decode_body_data(
|
7262 + | "{ \"minString\" : \"a\" }".as_bytes(),
|
7263 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7264 + | ),
|
6665 7265 | )),
|
6666 7266 | ))
|
6667 7267 | .unwrap();
|
6668 7268 | #[allow(unused_mut)]
|
6669 7269 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6670 7270 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6671 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7271 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6672 7272 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6673 7273 | let sender = sender.clone();
|
6674 7274 | async move {
|
6675 7275 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
6676 7276 | sender.send(()).await.expect("receiver dropped early");
|
6677 7277 | result
|
6678 7278 | }
|
6679 7279 | })
|
6680 7280 | .build_unchecked();
|
6681 7281 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6682 7282 | .await
|
6683 7283 | .expect("unable to make an HTTP request");
|
6684 7284 | ::pretty_assertions::assert_eq!(
|
6685 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7285 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6686 7286 | http_response.status()
|
6687 7287 | );
|
6688 7288 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6689 7289 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6690 7290 | http_response.headers(),
|
6691 7291 | expected_headers,
|
6692 7292 | ));
|
6693 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7293 + | use ::http_body_util::BodyExt;
|
7294 + | let body = http_response
|
7295 + | .into_body()
|
7296 + | .collect()
|
6694 7297 | .await
|
6695 - | .expect("unable to extract body to bytes");
|
7298 + | .expect("unable to collect body")
|
7299 + | .to_bytes();
|
6696 7300 | ::aws_smithy_protocol_test::assert_ok(
|
6697 7301 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/minString' failed to satisfy constraint: Member must have length greater than or equal to 2\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/minString' failed to satisfy constraint: Member must have length greater than or equal to 2\", \"path\": \"/minString\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6698 7302 | );
|
6699 7303 | }
|
6700 7304 | }
|
6701 7305 |
|
6702 7306 | /// When a string member does not fit within length bounds,
|
6703 7307 | /// the response should be a 400 ValidationException.
|
6704 7308 | /// Test ID: RestJsonMalformedLengthMaxString
|
6705 7309 | #[::tokio::test]
|
6706 7310 | #[::tracing_test::traced_test]
|
6707 7311 | async fn rest_json_malformed_length_max_string_malformed_request() {
|
6708 7312 | {
|
6709 7313 | #[allow(unused_mut)]
|
6710 - | let mut http_request = http::Request::builder()
|
7314 + | let mut http_request = ::http_1x::Request::builder()
|
6711 7315 | .uri("/MalformedLength")
|
6712 7316 | .method("POST")
|
6713 7317 | .header("content-type", "application/json")
|
6714 - | .body(::aws_smithy_http_server::body::Body::from(
|
6715 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6716 - | "{ \"maxString\" : \"abcdefghijklmnopqrstuvwxyz\" }".as_bytes(),
|
6717 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7318 + | .body(::aws_smithy_http_server::body::boxed(
|
7319 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
7320 + | &::aws_smithy_protocol_test::decode_body_data(
|
7321 + | "{ \"maxString\" : \"abcdefghijklmnopqrstuvwxyz\" }".as_bytes(),
|
7322 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7323 + | ),
|
6718 7324 | )),
|
6719 7325 | ))
|
6720 7326 | .unwrap();
|
6721 7327 | #[allow(unused_mut)]
|
6722 7328 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6723 7329 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6724 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7330 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6725 7331 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6726 7332 | let sender = sender.clone();
|
6727 7333 | async move {
|
6728 7334 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
6729 7335 | sender.send(()).await.expect("receiver dropped early");
|
6730 7336 | result
|
6731 7337 | }
|
6732 7338 | })
|
6733 7339 | .build_unchecked();
|
6734 7340 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6735 7341 | .await
|
6736 7342 | .expect("unable to make an HTTP request");
|
6737 7343 | ::pretty_assertions::assert_eq!(
|
6738 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7344 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6739 7345 | http_response.status()
|
6740 7346 | );
|
6741 7347 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6742 7348 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6743 7349 | http_response.headers(),
|
6744 7350 | expected_headers,
|
6745 7351 | ));
|
6746 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7352 + | use ::http_body_util::BodyExt;
|
7353 + | let body = http_response
|
7354 + | .into_body()
|
7355 + | .collect()
|
6747 7356 | .await
|
6748 - | .expect("unable to extract body to bytes");
|
7357 + | .expect("unable to collect body")
|
7358 + | .to_bytes();
|
6749 7359 | ::aws_smithy_protocol_test::assert_ok(
|
6750 7360 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 26 at '/maxString' failed to satisfy constraint: Member must have length less than or equal to 8\",\n \"fieldList\" : [{\"message\": \"Value with length 26 at '/maxString' failed to satisfy constraint: Member must have length less than or equal to 8\", \"path\": \"/maxString\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6751 7361 | );
|
6752 7362 | }
|
6753 7363 | }
|
6754 7364 |
|
6755 7365 | /// When a list member does not fit within length bounds,
|
6756 7366 | /// the response should be a 400 ValidationException.
|
6757 7367 | /// Test ID: RestJsonMalformedLengthList_case0
|
6758 7368 | #[::tokio::test]
|
6759 7369 | #[::tracing_test::traced_test]
|
6760 7370 | async fn rest_json_malformed_length_list_case0_malformed_request() {
|
6761 7371 | {
|
6762 7372 | #[allow(unused_mut)]
|
6763 - | let mut http_request = http::Request::builder()
|
7373 + | let mut http_request = ::http_1x::Request::builder()
|
6764 7374 | .uri("/MalformedLength")
|
6765 7375 | .method("POST")
|
6766 7376 | .header("content-type", "application/json")
|
6767 - | .body(::aws_smithy_http_server::body::Body::from(
|
6768 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6769 - | "{ \"list\" : [\"abc\"] }".as_bytes(),
|
6770 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7377 + | .body(::aws_smithy_http_server::body::boxed(
|
7378 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
7379 + | &::aws_smithy_protocol_test::decode_body_data(
|
7380 + | "{ \"list\" : [\"abc\"] }".as_bytes(),
|
7381 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7382 + | ),
|
6771 7383 | )),
|
6772 7384 | ))
|
6773 7385 | .unwrap();
|
6774 7386 | #[allow(unused_mut)]
|
6775 7387 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6776 7388 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6777 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7389 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6778 7390 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6779 7391 | let sender = sender.clone();
|
6780 7392 | async move {
|
6781 7393 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
6782 7394 | sender.send(()).await.expect("receiver dropped early");
|
6783 7395 | result
|
6784 7396 | }
|
6785 7397 | })
|
6786 7398 | .build_unchecked();
|
6787 7399 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6788 7400 | .await
|
6789 7401 | .expect("unable to make an HTTP request");
|
6790 7402 | ::pretty_assertions::assert_eq!(
|
6791 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7403 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6792 7404 | http_response.status()
|
6793 7405 | );
|
6794 7406 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6795 7407 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6796 7408 | http_response.headers(),
|
6797 7409 | expected_headers,
|
6798 7410 | ));
|
6799 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7411 + | use ::http_body_util::BodyExt;
|
7412 + | let body = http_response
|
7413 + | .into_body()
|
7414 + | .collect()
|
6800 7415 | .await
|
6801 - | .expect("unable to extract body to bytes");
|
7416 + | .expect("unable to collect body")
|
7417 + | .to_bytes();
|
6802 7418 | ::aws_smithy_protocol_test::assert_ok(
|
6803 7419 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/list' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/list' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/list\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6804 7420 | );
|
6805 7421 | }
|
6806 7422 | }
|
6807 7423 |
|
6808 7424 | /// When a list member does not fit within length bounds,
|
6809 7425 | /// the response should be a 400 ValidationException.
|
6810 7426 | /// Test ID: RestJsonMalformedLengthList_case1
|
6811 7427 | #[::tokio::test]
|
6812 7428 | #[::tracing_test::traced_test]
|
6813 7429 | async fn rest_json_malformed_length_list_case1_malformed_request() {
|
6814 7430 | {
|
6815 7431 | #[allow(unused_mut)]
|
6816 - | let mut http_request = http::Request::builder()
|
7432 + | let mut http_request = ::http_1x::Request::builder()
|
6817 7433 | .uri("/MalformedLength")
|
6818 7434 | .method("POST")
|
6819 7435 | .header("content-type", "application/json")
|
6820 - | .body(::aws_smithy_http_server::body::Body::from(
|
6821 - | ::bytes::Bytes::copy_from_slice(
|
6822 - | &::aws_smithy_protocol_test::decode_body_data("{ \"list\" : [\"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\"] }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
6823 - | )
|
6824 - | )).unwrap();
|
7436 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
7437 + | ::bytes::Bytes::copy_from_slice(
|
7438 + | &::aws_smithy_protocol_test::decode_body_data("{ \"list\" : [\"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\", \"abc\"] }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7439 + | )
|
7440 + | ))).unwrap();
|
6825 7441 | #[allow(unused_mut)]
|
6826 7442 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6827 7443 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6828 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7444 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6829 7445 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6830 7446 | let sender = sender.clone();
|
6831 7447 | async move {
|
6832 7448 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
6833 7449 | sender.send(()).await.expect("receiver dropped early");
|
6834 7450 | result
|
6835 7451 | }
|
6836 7452 | })
|
6837 7453 | .build_unchecked();
|
6838 7454 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6839 7455 | .await
|
6840 7456 | .expect("unable to make an HTTP request");
|
6841 7457 | ::pretty_assertions::assert_eq!(
|
6842 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7458 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6843 7459 | http_response.status()
|
6844 7460 | );
|
6845 7461 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6846 7462 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6847 7463 | http_response.headers(),
|
6848 7464 | expected_headers,
|
6849 7465 | ));
|
6850 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7466 + | use ::http_body_util::BodyExt;
|
7467 + | let body = http_response
|
7468 + | .into_body()
|
7469 + | .collect()
|
6851 7470 | .await
|
6852 - | .expect("unable to extract body to bytes");
|
7471 + | .expect("unable to collect body")
|
7472 + | .to_bytes();
|
6853 7473 | ::aws_smithy_protocol_test::assert_ok(
|
6854 7474 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 10 at '/list' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 10 at '/list' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/list\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6855 7475 | );
|
6856 7476 | }
|
6857 7477 | }
|
6858 7478 |
|
6859 7479 | /// When a list member's value does not fit within length bounds,
|
6860 7480 | /// the response should be a 400 ValidationException.
|
6861 7481 | /// Test ID: RestJsonMalformedLengthListValue_case0
|
6862 7482 | #[::tokio::test]
|
6863 7483 | #[::tracing_test::traced_test]
|
6864 7484 | async fn rest_json_malformed_length_list_value_case0_malformed_request() {
|
6865 7485 | {
|
6866 7486 | #[allow(unused_mut)]
|
6867 - | let mut http_request = http::Request::builder()
|
7487 + | let mut http_request = ::http_1x::Request::builder()
|
6868 7488 | .uri("/MalformedLength")
|
6869 7489 | .method("POST")
|
6870 7490 | .header("content-type", "application/json")
|
6871 - | .body(::aws_smithy_http_server::body::Body::from(
|
6872 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6873 - | "{ \"list\" : [\"a\", \"abc\"] }".as_bytes(),
|
6874 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7491 + | .body(::aws_smithy_http_server::body::boxed(
|
7492 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
7493 + | &::aws_smithy_protocol_test::decode_body_data(
|
7494 + | "{ \"list\" : [\"a\", \"abc\"] }".as_bytes(),
|
7495 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7496 + | ),
|
6875 7497 | )),
|
6876 7498 | ))
|
6877 7499 | .unwrap();
|
6878 7500 | #[allow(unused_mut)]
|
6879 7501 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6880 7502 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6881 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7503 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6882 7504 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6883 7505 | let sender = sender.clone();
|
6884 7506 | async move {
|
6885 7507 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
6886 7508 | sender.send(()).await.expect("receiver dropped early");
|
6887 7509 | result
|
6888 7510 | }
|
6889 7511 | })
|
6890 7512 | .build_unchecked();
|
6891 7513 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6892 7514 | .await
|
6893 7515 | .expect("unable to make an HTTP request");
|
6894 7516 | ::pretty_assertions::assert_eq!(
|
6895 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7517 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6896 7518 | http_response.status()
|
6897 7519 | );
|
6898 7520 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6899 7521 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6900 7522 | http_response.headers(),
|
6901 7523 | expected_headers,
|
6902 7524 | ));
|
6903 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7525 + | use ::http_body_util::BodyExt;
|
7526 + | let body = http_response
|
7527 + | .into_body()
|
7528 + | .collect()
|
6904 7529 | .await
|
6905 - | .expect("unable to extract body to bytes");
|
7530 + | .expect("unable to collect body")
|
7531 + | .to_bytes();
|
6906 7532 | ::aws_smithy_protocol_test::assert_ok(
|
6907 7533 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/list/0' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/list/0' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6908 7534 | );
|
6909 7535 | }
|
6910 7536 | }
|
6911 7537 |
|
6912 7538 | /// When a list member's value does not fit within length bounds,
|
6913 7539 | /// the response should be a 400 ValidationException.
|
6914 7540 | /// Test ID: RestJsonMalformedLengthListValue_case1
|
6915 7541 | #[::tokio::test]
|
6916 7542 | #[::tracing_test::traced_test]
|
6917 7543 | async fn rest_json_malformed_length_list_value_case1_malformed_request() {
|
6918 7544 | {
|
6919 7545 | #[allow(unused_mut)]
|
6920 - | let mut http_request = http::Request::builder()
|
7546 + | let mut http_request = ::http_1x::Request::builder()
|
6921 7547 | .uri("/MalformedLength")
|
6922 7548 | .method("POST")
|
6923 7549 | .header("content-type", "application/json")
|
6924 - | .body(::aws_smithy_http_server::body::Body::from(
|
6925 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6926 - | "{ \"list\" : [\"abcdefghijklmnopqrstuvwxyz\", \"abc\"] }".as_bytes(),
|
6927 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7550 + | .body(::aws_smithy_http_server::body::boxed(
|
7551 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
7552 + | &::aws_smithy_protocol_test::decode_body_data(
|
7553 + | "{ \"list\" : [\"abcdefghijklmnopqrstuvwxyz\", \"abc\"] }".as_bytes(),
|
7554 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7555 + | ),
|
6928 7556 | )),
|
6929 7557 | ))
|
6930 7558 | .unwrap();
|
6931 7559 | #[allow(unused_mut)]
|
6932 7560 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6933 7561 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6934 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7562 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6935 7563 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6936 7564 | let sender = sender.clone();
|
6937 7565 | async move {
|
6938 7566 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
6939 7567 | sender.send(()).await.expect("receiver dropped early");
|
6940 7568 | result
|
6941 7569 | }
|
6942 7570 | })
|
6943 7571 | .build_unchecked();
|
6944 7572 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6945 7573 | .await
|
6946 7574 | .expect("unable to make an HTTP request");
|
6947 7575 | ::pretty_assertions::assert_eq!(
|
6948 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7576 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6949 7577 | http_response.status()
|
6950 7578 | );
|
6951 7579 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
6952 7580 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6953 7581 | http_response.headers(),
|
6954 7582 | expected_headers,
|
6955 7583 | ));
|
6956 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7584 + | use ::http_body_util::BodyExt;
|
7585 + | let body = http_response
|
7586 + | .into_body()
|
7587 + | .collect()
|
6957 7588 | .await
|
6958 - | .expect("unable to extract body to bytes");
|
7589 + | .expect("unable to collect body")
|
7590 + | .to_bytes();
|
6959 7591 | ::aws_smithy_protocol_test::assert_ok(
|
6960 7592 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 26 at '/list/0' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 26 at '/list/0' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
6961 7593 | );
|
6962 7594 | }
|
6963 7595 | }
|
6964 7596 |
|
6965 7597 | /// When a map member does not fit within length bounds,
|
6966 7598 | /// the response should be a 400 ValidationException.
|
6967 7599 | /// Test ID: RestJsonMalformedLengthMap_case0
|
6968 7600 | #[::tokio::test]
|
6969 7601 | #[::tracing_test::traced_test]
|
6970 7602 | async fn rest_json_malformed_length_map_case0_malformed_request() {
|
6971 7603 | {
|
6972 7604 | #[allow(unused_mut)]
|
6973 - | let mut http_request = http::Request::builder()
|
7605 + | let mut http_request = ::http_1x::Request::builder()
|
6974 7606 | .uri("/MalformedLength")
|
6975 7607 | .method("POST")
|
6976 7608 | .header("content-type", "application/json")
|
6977 - | .body(::aws_smithy_http_server::body::Body::from(
|
6978 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
6979 - | "{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\"]} }".as_bytes(),
|
6980 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7609 + | .body(::aws_smithy_http_server::body::boxed(
|
7610 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
7611 + | &::aws_smithy_protocol_test::decode_body_data(
|
7612 + | "{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\"]} }".as_bytes(),
|
7613 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
7614 + | ),
|
6981 7615 | )),
|
6982 7616 | ))
|
6983 7617 | .unwrap();
|
6984 7618 | #[allow(unused_mut)]
|
6985 7619 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6986 7620 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
6987 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7621 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6988 7622 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
6989 7623 | let sender = sender.clone();
|
6990 7624 | async move {
|
6991 7625 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
6992 7626 | sender.send(()).await.expect("receiver dropped early");
|
6993 7627 | result
|
6994 7628 | }
|
6995 7629 | })
|
6996 7630 | .build_unchecked();
|
6997 7631 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6998 7632 | .await
|
6999 7633 | .expect("unable to make an HTTP request");
|
7000 7634 | ::pretty_assertions::assert_eq!(
|
7001 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7635 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7002 7636 | http_response.status()
|
7003 7637 | );
|
7004 7638 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7005 7639 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7006 7640 | http_response.headers(),
|
7007 7641 | expected_headers,
|
7008 7642 | ));
|
7009 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7643 + | use ::http_body_util::BodyExt;
|
7644 + | let body = http_response
|
7645 + | .into_body()
|
7646 + | .collect()
|
7010 7647 | .await
|
7011 - | .expect("unable to extract body to bytes");
|
7648 + | .expect("unable to collect body")
|
7649 + | .to_bytes();
|
7012 7650 | ::aws_smithy_protocol_test::assert_ok(
|
7013 7651 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7014 7652 | );
|
7015 7653 | }
|
7016 7654 | }
|
7017 7655 |
|
7018 7656 | /// When a map member does not fit within length bounds,
|
7019 7657 | /// the response should be a 400 ValidationException.
|
7020 7658 | /// Test ID: RestJsonMalformedLengthMap_case1
|
7021 7659 | #[::tokio::test]
|
7022 7660 | #[::tracing_test::traced_test]
|
7023 7661 | async fn rest_json_malformed_length_map_case1_malformed_request() {
|
7024 7662 | {
|
7025 7663 | #[allow(unused_mut)]
|
7026 - | let mut http_request = http::Request::builder()
|
7664 + | let mut http_request = ::http_1x::Request::builder()
|
7027 7665 | .uri("/MalformedLength")
|
7028 7666 | .method("POST")
|
7029 7667 | .header("content-type", "application/json")
|
7030 - | .body(::aws_smithy_http_server::body::Body::from(
|
7031 - | ::bytes::Bytes::copy_from_slice(
|
7032 - | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abc\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"],\n \"cde\": [\"abc\", \"def\", \"efg\"], \"def\": [\"abc\", \"def\", \"efg\"],\n \"efg\": [\"abc\", \"def\", \"efg\"], \"fgh\": [\"abc\", \"def\", \"efg\"],\n \"ghi\": [\"abc\", \"def\", \"efg\"], \"jkl\": [\"abc\", \"def\", \"efg\"],\n \"klm\": [\"abc\", \"def\", \"efg\"], \"lmn\": [\"abc\", \"def\", \"efg\"] } }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7033 - | )
|
7034 - | )).unwrap();
|
7668 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
7669 + | ::bytes::Bytes::copy_from_slice(
|
7670 + | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abc\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"],\n \"cde\": [\"abc\", \"def\", \"efg\"], \"def\": [\"abc\", \"def\", \"efg\"],\n \"efg\": [\"abc\", \"def\", \"efg\"], \"fgh\": [\"abc\", \"def\", \"efg\"],\n \"ghi\": [\"abc\", \"def\", \"efg\"], \"jkl\": [\"abc\", \"def\", \"efg\"],\n \"klm\": [\"abc\", \"def\", \"efg\"], \"lmn\": [\"abc\", \"def\", \"efg\"] } }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7671 + | )
|
7672 + | ))).unwrap();
|
7035 7673 | #[allow(unused_mut)]
|
7036 7674 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7037 7675 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7038 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7676 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7039 7677 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
7040 7678 | let sender = sender.clone();
|
7041 7679 | async move {
|
7042 7680 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
7043 7681 | sender.send(()).await.expect("receiver dropped early");
|
7044 7682 | result
|
7045 7683 | }
|
7046 7684 | })
|
7047 7685 | .build_unchecked();
|
7048 7686 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7049 7687 | .await
|
7050 7688 | .expect("unable to make an HTTP request");
|
7051 7689 | ::pretty_assertions::assert_eq!(
|
7052 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7690 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7053 7691 | http_response.status()
|
7054 7692 | );
|
7055 7693 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7056 7694 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7057 7695 | http_response.headers(),
|
7058 7696 | expected_headers,
|
7059 7697 | ));
|
7060 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7698 + | use ::http_body_util::BodyExt;
|
7699 + | let body = http_response
|
7700 + | .into_body()
|
7701 + | .collect()
|
7061 7702 | .await
|
7062 - | .expect("unable to extract body to bytes");
|
7703 + | .expect("unable to collect body")
|
7704 + | .to_bytes();
|
7063 7705 | ::aws_smithy_protocol_test::assert_ok(
|
7064 7706 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 10 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 10 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7065 7707 | );
|
7066 7708 | }
|
7067 7709 | }
|
7068 7710 |
|
7069 7711 | /// When a map member's key does not fit within length bounds,
|
7070 7712 | /// the response should be a 400 ValidationException.
|
7071 7713 | /// Test ID: RestJsonMalformedLengthMapKey_case0
|
7072 7714 | #[::tokio::test]
|
7073 7715 | #[::tracing_test::traced_test]
|
7074 7716 | async fn rest_json_malformed_length_map_key_case0_malformed_request() {
|
7075 7717 | {
|
7076 7718 | #[allow(unused_mut)]
|
7077 - | let mut http_request = http::Request::builder()
|
7719 + | let mut http_request = ::http_1x::Request::builder()
|
7078 7720 | .uri("/MalformedLength")
|
7079 7721 | .method("POST")
|
7080 7722 | .header("content-type", "application/json")
|
7081 - | .body(::aws_smithy_http_server::body::Body::from(
|
7082 - | ::bytes::Bytes::copy_from_slice(
|
7083 - | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"a\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7084 - | )
|
7085 - | )).unwrap();
|
7723 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
7724 + | ::bytes::Bytes::copy_from_slice(
|
7725 + | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"a\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7726 + | )
|
7727 + | ))).unwrap();
|
7086 7728 | #[allow(unused_mut)]
|
7087 7729 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7088 7730 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7089 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7731 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7090 7732 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
7091 7733 | let sender = sender.clone();
|
7092 7734 | async move {
|
7093 7735 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
7094 7736 | sender.send(()).await.expect("receiver dropped early");
|
7095 7737 | result
|
7096 7738 | }
|
7097 7739 | })
|
7098 7740 | .build_unchecked();
|
7099 7741 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7100 7742 | .await
|
7101 7743 | .expect("unable to make an HTTP request");
|
7102 7744 | ::pretty_assertions::assert_eq!(
|
7103 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7745 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7104 7746 | http_response.status()
|
7105 7747 | );
|
7106 7748 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7107 7749 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7108 7750 | http_response.headers(),
|
7109 7751 | expected_headers,
|
7110 7752 | ));
|
7111 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7753 + | use ::http_body_util::BodyExt;
|
7754 + | let body = http_response
|
7755 + | .into_body()
|
7756 + | .collect()
|
7112 7757 | .await
|
7113 - | .expect("unable to extract body to bytes");
|
7758 + | .expect("unable to collect body")
|
7759 + | .to_bytes();
|
7114 7760 | ::aws_smithy_protocol_test::assert_ok(
|
7115 7761 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7116 7762 | );
|
7117 7763 | }
|
7118 7764 | }
|
7119 7765 |
|
7120 7766 | /// When a map member's key does not fit within length bounds,
|
7121 7767 | /// the response should be a 400 ValidationException.
|
7122 7768 | /// Test ID: RestJsonMalformedLengthMapKey_case1
|
7123 7769 | #[::tokio::test]
|
7124 7770 | #[::tracing_test::traced_test]
|
7125 7771 | async fn rest_json_malformed_length_map_key_case1_malformed_request() {
|
7126 7772 | {
|
7127 7773 | #[allow(unused_mut)]
|
7128 - | let mut http_request = http::Request::builder()
|
7774 + | let mut http_request = ::http_1x::Request::builder()
|
7129 7775 | .uri("/MalformedLength")
|
7130 7776 | .method("POST")
|
7131 7777 | .header("content-type", "application/json")
|
7132 - | .body(::aws_smithy_http_server::body::Body::from(
|
7133 - | ::bytes::Bytes::copy_from_slice(
|
7134 - | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abcdefghijklmnopqrstuvwxyz\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7135 - | )
|
7136 - | )).unwrap();
|
7778 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
7779 + | ::bytes::Bytes::copy_from_slice(
|
7780 + | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abcdefghijklmnopqrstuvwxyz\": [\"abc\", \"def\", \"efg\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7781 + | )
|
7782 + | ))).unwrap();
|
7137 7783 | #[allow(unused_mut)]
|
7138 7784 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7139 7785 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7140 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7786 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7141 7787 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
7142 7788 | let sender = sender.clone();
|
7143 7789 | async move {
|
7144 7790 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
7145 7791 | sender.send(()).await.expect("receiver dropped early");
|
7146 7792 | result
|
7147 7793 | }
|
7148 7794 | })
|
7149 7795 | .build_unchecked();
|
7150 7796 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7151 7797 | .await
|
7152 7798 | .expect("unable to make an HTTP request");
|
7153 7799 | ::pretty_assertions::assert_eq!(
|
7154 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7800 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7155 7801 | http_response.status()
|
7156 7802 | );
|
7157 7803 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7158 7804 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7159 7805 | http_response.headers(),
|
7160 7806 | expected_headers,
|
7161 7807 | ));
|
7162 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7808 + | use ::http_body_util::BodyExt;
|
7809 + | let body = http_response
|
7810 + | .into_body()
|
7811 + | .collect()
|
7163 7812 | .await
|
7164 - | .expect("unable to extract body to bytes");
|
7813 + | .expect("unable to collect body")
|
7814 + | .to_bytes();
|
7165 7815 | ::aws_smithy_protocol_test::assert_ok(
|
7166 7816 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 26 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 26 at '/map' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7167 7817 | );
|
7168 7818 | }
|
7169 7819 | }
|
7170 7820 |
|
7171 7821 | /// When a map member's value does not fit within length bounds,
|
7172 7822 | /// the response should be a 400 ValidationException.
|
7173 7823 | /// Test ID: RestJsonMalformedLengthMapValue_case0
|
7174 7824 | #[::tokio::test]
|
7175 7825 | #[::tracing_test::traced_test]
|
7176 7826 | async fn rest_json_malformed_length_map_value_case0_malformed_request() {
|
7177 7827 | {
|
7178 7828 | #[allow(unused_mut)]
|
7179 - | let mut http_request = http::Request::builder()
|
7829 + | let mut http_request = ::http_1x::Request::builder()
|
7180 7830 | .uri("/MalformedLength")
|
7181 7831 | .method("POST")
|
7182 7832 | .header("content-type", "application/json")
|
7183 - | .body(::aws_smithy_http_server::body::Body::from(
|
7184 - | ::bytes::Bytes::copy_from_slice(
|
7185 - | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abc\": [\"def\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7186 - | )
|
7187 - | )).unwrap();
|
7833 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
7834 + | ::bytes::Bytes::copy_from_slice(
|
7835 + | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abc\": [\"def\"], \"bcd\": [\"abc\", \"def\", \"efg\"], \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7836 + | )
|
7837 + | ))).unwrap();
|
7188 7838 | #[allow(unused_mut)]
|
7189 7839 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7190 7840 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7191 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7841 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7192 7842 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
7193 7843 | let sender = sender.clone();
|
7194 7844 | async move {
|
7195 7845 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
7196 7846 | sender.send(()).await.expect("receiver dropped early");
|
7197 7847 | result
|
7198 7848 | }
|
7199 7849 | })
|
7200 7850 | .build_unchecked();
|
7201 7851 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7202 7852 | .await
|
7203 7853 | .expect("unable to make an HTTP request");
|
7204 7854 | ::pretty_assertions::assert_eq!(
|
7205 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7855 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7206 7856 | http_response.status()
|
7207 7857 | );
|
7208 7858 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7209 7859 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7210 7860 | http_response.headers(),
|
7211 7861 | expected_headers,
|
7212 7862 | ));
|
7213 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7863 + | use ::http_body_util::BodyExt;
|
7864 + | let body = http_response
|
7865 + | .into_body()
|
7866 + | .collect()
|
7214 7867 | .await
|
7215 - | .expect("unable to extract body to bytes");
|
7868 + | .expect("unable to collect body")
|
7869 + | .to_bytes();
|
7216 7870 | ::aws_smithy_protocol_test::assert_ok(
|
7217 7871 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 1 at '/map/abc' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 1 at '/map/abc' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7218 7872 | );
|
7219 7873 | }
|
7220 7874 | }
|
7221 7875 |
|
7222 7876 | /// When a map member's value does not fit within length bounds,
|
7223 7877 | /// the response should be a 400 ValidationException.
|
7224 7878 | /// Test ID: RestJsonMalformedLengthMapValue_case1
|
7225 7879 | #[::tokio::test]
|
7226 7880 | #[::tracing_test::traced_test]
|
7227 7881 | async fn rest_json_malformed_length_map_value_case1_malformed_request() {
|
7228 7882 | {
|
7229 7883 | #[allow(unused_mut)]
|
7230 - | let mut http_request = http::Request::builder()
|
7884 + | let mut http_request = ::http_1x::Request::builder()
|
7231 7885 | .uri("/MalformedLength")
|
7232 7886 | .method("POST")
|
7233 7887 | .header("content-type", "application/json")
|
7234 - | .body(::aws_smithy_http_server::body::Body::from(
|
7235 - | ::bytes::Bytes::copy_from_slice(
|
7236 - | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\", \"def\", \"efg\", \"fgh\", \"def\", \"efg\", \"fgh\", \"def\"],\n \"bcd\": [\"abc\", \"def\", \"efg\"],\n \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7237 - | )
|
7238 - | )).unwrap();
|
7888 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
7889 + | ::bytes::Bytes::copy_from_slice(
|
7890 + | &::aws_smithy_protocol_test::decode_body_data("{ \"map\" : {\"abc\": [\"def\", \"efg\", \"fgh\", \"def\", \"efg\", \"fgh\", \"def\", \"efg\", \"fgh\", \"def\"],\n \"bcd\": [\"abc\", \"def\", \"efg\"],\n \"cde\": [\"abc\", \"def\", \"efg\"]} }".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("unknown"))
|
7891 + | )
|
7892 + | ))).unwrap();
|
7239 7893 | #[allow(unused_mut)]
|
7240 7894 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7241 7895 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7242 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
7896 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7243 7897 | .malformed_length(move |input: crate::input::MalformedLengthInput| {
|
7244 7898 | let sender = sender.clone();
|
7245 7899 | async move {
|
7246 7900 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLengthOutput, crate::error::MalformedLengthError> };
|
7247 7901 | sender.send(()).await.expect("receiver dropped early");
|
7248 7902 | result
|
7249 7903 | }
|
7250 7904 | })
|
7251 7905 | .build_unchecked();
|
7252 7906 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7253 7907 | .await
|
7254 7908 | .expect("unable to make an HTTP request");
|
7255 7909 | ::pretty_assertions::assert_eq!(
|
7256 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7910 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7257 7911 | http_response.status()
|
7258 7912 | );
|
7259 7913 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7260 7914 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7261 7915 | http_response.headers(),
|
7262 7916 | expected_headers,
|
7263 7917 | ));
|
7264 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
7918 + | use ::http_body_util::BodyExt;
|
7919 + | let body = http_response
|
7920 + | .into_body()
|
7921 + | .collect()
|
7265 7922 | .await
|
7266 - | .expect("unable to extract body to bytes");
|
7923 + | .expect("unable to collect body")
|
7924 + | .to_bytes();
|
7267 7925 | ::aws_smithy_protocol_test::assert_ok(
|
7268 7926 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value with length 10 at '/map/abc' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\",\n \"fieldList\" : [{\"message\": \"Value with length 10 at '/map/abc' failed to satisfy constraint: Member must have length between 2 and 8, inclusive\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7269 7927 | );
|
7270 7928 | }
|
7271 7929 | }
|
7272 7930 | }
|
7273 7931 |
|
7274 7932 | ::pin_project_lite::pin_project! {
|
7275 7933 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
7276 7934 | /// [`MalformedEnumInput`](crate::input::MalformedEnumInput) using modelled bindings.
|
7277 7935 | pub struct MalformedEnumInputFuture {
|
7278 7936 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedEnumInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
7279 7937 | }
|
7280 7938 | }
|
7281 7939 |
|
7282 7940 | impl std::future::Future for MalformedEnumInputFuture {
|
7283 7941 | type Output = Result<
|
7284 7942 | crate::input::MalformedEnumInput,
|
7285 7943 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
7286 7944 | >;
|
7287 7945 |
|
7288 7946 | fn poll(
|
7289 7947 | self: std::pin::Pin<&mut Self>,
|
7290 7948 | cx: &mut std::task::Context<'_>,
|
7291 7949 | ) -> std::task::Poll<Self::Output> {
|
7292 7950 | let this = self.project();
|
7293 7951 | this.inner.as_mut().poll(cx)
|
7294 7952 | }
|
7295 7953 | }
|
7296 7954 |
|
7297 7955 | impl<B>
|
7298 7956 | ::aws_smithy_http_server::request::FromRequest<
|
7299 7957 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7300 7958 | B,
|
7301 7959 | > for crate::input::MalformedEnumInput
|
7302 7960 | where
|
7303 7961 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
7304 7962 | B: 'static,
|
7305 7963 |
|
7306 7964 | B::Data: Send,
|
7307 7965 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
7308 7966 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
7309 7967 | {
|
7310 7968 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
7311 7969 | type Future = MalformedEnumInputFuture;
|
7312 7970 |
|
7313 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
7971 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
7314 7972 | let fut = async move {
|
7315 7973 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
7316 7974 | request.headers(),
|
7317 7975 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
7318 7976 | ) {
|
7319 7977 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
7320 7978 | }
|
7321 7979 | crate::protocol_serde::shape_malformed_enum::de_malformed_enum_http_request(request)
|
7322 7980 | .await
|
7323 7981 | };
|
7378 8036 | /// When a string member does not contain a valid enum value,
|
7379 8037 | /// the response should be a 400 ValidationException. Internal-only
|
7380 8038 | /// enum values are excluded from the response message.
|
7381 8039 | /// Test ID: RestJsonMalformedEnumString_case0
|
7382 8040 | #[::tokio::test]
|
7383 8041 | #[::tracing_test::traced_test]
|
7384 8042 | #[should_panic]
|
7385 8043 | async fn rest_json_malformed_enum_string_case0_malformed_request() {
|
7386 8044 | {
|
7387 8045 | #[allow(unused_mut)]
|
7388 - | let mut http_request = http::Request::builder()
|
8046 + | let mut http_request = ::http_1x::Request::builder()
|
7389 8047 | .uri("/MalformedEnum")
|
7390 8048 | .method("POST")
|
7391 8049 | .header("content-type", "application/json")
|
7392 - | .body(::aws_smithy_http_server::body::Body::from(
|
7393 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7394 - | "{ \"string\" : \"ABC\" }".as_bytes(),
|
7395 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8050 + | .body(::aws_smithy_http_server::body::boxed(
|
8051 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
8052 + | &::aws_smithy_protocol_test::decode_body_data(
|
8053 + | "{ \"string\" : \"ABC\" }".as_bytes(),
|
8054 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8055 + | ),
|
7396 8056 | )),
|
7397 8057 | ))
|
7398 8058 | .unwrap();
|
7399 8059 | #[allow(unused_mut)]
|
7400 8060 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7401 8061 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7402 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
8062 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7403 8063 | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7404 8064 | let sender = sender.clone();
|
7405 8065 | async move {
|
7406 8066 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7407 8067 | sender.send(()).await.expect("receiver dropped early");
|
7408 8068 | result
|
7409 8069 | }
|
7410 8070 | })
|
7411 8071 | .build_unchecked();
|
7412 8072 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7413 8073 | .await
|
7414 8074 | .expect("unable to make an HTTP request");
|
7415 8075 | ::pretty_assertions::assert_eq!(
|
7416 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8076 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7417 8077 | http_response.status()
|
7418 8078 | );
|
7419 8079 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7420 8080 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7421 8081 | http_response.headers(),
|
7422 8082 | expected_headers,
|
7423 8083 | ));
|
7424 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8084 + | use ::http_body_util::BodyExt;
|
8085 + | let body = http_response
|
8086 + | .into_body()
|
8087 + | .collect()
|
7425 8088 | .await
|
7426 - | .expect("unable to extract body to bytes");
|
8089 + | .expect("unable to collect body")
|
8090 + | .to_bytes();
|
7427 8091 | ::aws_smithy_protocol_test::assert_ok(
|
7428 8092 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7429 8093 | );
|
7430 8094 | }
|
7431 8095 | }
|
7432 8096 |
|
7433 8097 | /// When a string member does not contain a valid enum value,
|
7434 8098 | /// the response should be a 400 ValidationException. Internal-only
|
7435 8099 | /// enum values are excluded from the response message.
|
7436 8100 | /// Test ID: RestJsonMalformedEnumString_case1
|
7437 8101 | #[::tokio::test]
|
7438 8102 | #[::tracing_test::traced_test]
|
7439 8103 | #[should_panic]
|
7440 8104 | async fn rest_json_malformed_enum_string_case1_malformed_request() {
|
7441 8105 | {
|
7442 8106 | #[allow(unused_mut)]
|
7443 - | let mut http_request = http::Request::builder()
|
8107 + | let mut http_request = ::http_1x::Request::builder()
|
7444 8108 | .uri("/MalformedEnum")
|
7445 8109 | .method("POST")
|
7446 8110 | .header("content-type", "application/json")
|
7447 - | .body(::aws_smithy_http_server::body::Body::from(
|
7448 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7449 - | "{ \"string\" : \"XYZ\" }".as_bytes(),
|
7450 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8111 + | .body(::aws_smithy_http_server::body::boxed(
|
8112 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
8113 + | &::aws_smithy_protocol_test::decode_body_data(
|
8114 + | "{ \"string\" : \"XYZ\" }".as_bytes(),
|
8115 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8116 + | ),
|
7451 8117 | )),
|
7452 8118 | ))
|
7453 8119 | .unwrap();
|
7454 8120 | #[allow(unused_mut)]
|
7455 8121 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7456 8122 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7457 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
8123 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7458 8124 | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7459 8125 | let sender = sender.clone();
|
7460 8126 | async move {
|
7461 8127 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7462 8128 | sender.send(()).await.expect("receiver dropped early");
|
7463 8129 | result
|
7464 8130 | }
|
7465 8131 | })
|
7466 8132 | .build_unchecked();
|
7467 8133 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7468 8134 | .await
|
7469 8135 | .expect("unable to make an HTTP request");
|
7470 8136 | ::pretty_assertions::assert_eq!(
|
7471 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8137 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7472 8138 | http_response.status()
|
7473 8139 | );
|
7474 8140 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7475 8141 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7476 8142 | http_response.headers(),
|
7477 8143 | expected_headers,
|
7478 8144 | ));
|
7479 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8145 + | use ::http_body_util::BodyExt;
|
8146 + | let body = http_response
|
8147 + | .into_body()
|
8148 + | .collect()
|
7480 8149 | .await
|
7481 - | .expect("unable to extract body to bytes");
|
8150 + | .expect("unable to collect body")
|
8151 + | .to_bytes();
|
7482 8152 | ::aws_smithy_protocol_test::assert_ok(
|
7483 8153 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/string' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/string\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7484 8154 | );
|
7485 8155 | }
|
7486 8156 | }
|
7487 8157 |
|
7488 8158 | /// When a string member does not contain a valid enum value,
|
7489 8159 | /// the response should be a 400 ValidationException. Internal-only
|
7490 8160 | /// enum values are excluded from the response message.
|
7491 8161 | /// Test ID: RestJsonMalformedEnumTraitString_case0
|
7492 8162 | #[::tokio::test]
|
7493 8163 | #[::tracing_test::traced_test]
|
7494 8164 | #[should_panic]
|
7495 8165 | async fn rest_json_malformed_enum_trait_string_case0_malformed_request() {
|
7496 8166 | {
|
7497 8167 | #[allow(unused_mut)]
|
7498 - | let mut http_request = http::Request::builder()
|
8168 + | let mut http_request = ::http_1x::Request::builder()
|
7499 8169 | .uri("/MalformedEnum")
|
7500 8170 | .method("POST")
|
7501 8171 | .header("content-type", "application/json")
|
7502 - | .body(::aws_smithy_http_server::body::Body::from(
|
7503 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7504 - | "{ \"stringWithEnumTrait\" : \"ABC\" }".as_bytes(),
|
7505 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8172 + | .body(::aws_smithy_http_server::body::boxed(
|
8173 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
8174 + | &::aws_smithy_protocol_test::decode_body_data(
|
8175 + | "{ \"stringWithEnumTrait\" : \"ABC\" }".as_bytes(),
|
8176 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8177 + | ),
|
7506 8178 | )),
|
7507 8179 | ))
|
7508 8180 | .unwrap();
|
7509 8181 | #[allow(unused_mut)]
|
7510 8182 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7511 8183 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7512 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
8184 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7513 8185 | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7514 8186 | let sender = sender.clone();
|
7515 8187 | async move {
|
7516 8188 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7517 8189 | sender.send(()).await.expect("receiver dropped early");
|
7518 8190 | result
|
7519 8191 | }
|
7520 8192 | })
|
7521 8193 | .build_unchecked();
|
7522 8194 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7523 8195 | .await
|
7524 8196 | .expect("unable to make an HTTP request");
|
7525 8197 | ::pretty_assertions::assert_eq!(
|
7526 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8198 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7527 8199 | http_response.status()
|
7528 8200 | );
|
7529 8201 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7530 8202 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7531 8203 | http_response.headers(),
|
7532 8204 | expected_headers,
|
7533 8205 | ));
|
7534 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8206 + | use ::http_body_util::BodyExt;
|
8207 + | let body = http_response
|
8208 + | .into_body()
|
8209 + | .collect()
|
7535 8210 | .await
|
7536 - | .expect("unable to extract body to bytes");
|
8211 + | .expect("unable to collect body")
|
8212 + | .to_bytes();
|
7537 8213 | ::aws_smithy_protocol_test::assert_ok(
|
7538 8214 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/stringWithEnumTrait' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\",\n \"fieldList\" : [{\"message\": \"Value at '/stringWithEnumTrait' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\", \"path\": \"/stringWithEnumTrait\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7539 8215 | );
|
7540 8216 | }
|
7541 8217 | }
|
7542 8218 |
|
7543 8219 | /// When a string member does not contain a valid enum value,
|
7544 8220 | /// the response should be a 400 ValidationException. Internal-only
|
7545 8221 | /// enum values are excluded from the response message.
|
7546 8222 | /// Test ID: RestJsonMalformedEnumTraitString_case1
|
7547 8223 | #[::tokio::test]
|
7548 8224 | #[::tracing_test::traced_test]
|
7549 8225 | #[should_panic]
|
7550 8226 | async fn rest_json_malformed_enum_trait_string_case1_malformed_request() {
|
7551 8227 | {
|
7552 8228 | #[allow(unused_mut)]
|
7553 - | let mut http_request = http::Request::builder()
|
8229 + | let mut http_request = ::http_1x::Request::builder()
|
7554 8230 | .uri("/MalformedEnum")
|
7555 8231 | .method("POST")
|
7556 8232 | .header("content-type", "application/json")
|
7557 - | .body(::aws_smithy_http_server::body::Body::from(
|
7558 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7559 - | "{ \"stringWithEnumTrait\" : \"XYZ\" }".as_bytes(),
|
7560 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8233 + | .body(::aws_smithy_http_server::body::boxed(
|
8234 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
8235 + | &::aws_smithy_protocol_test::decode_body_data(
|
8236 + | "{ \"stringWithEnumTrait\" : \"XYZ\" }".as_bytes(),
|
8237 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8238 + | ),
|
7561 8239 | )),
|
7562 8240 | ))
|
7563 8241 | .unwrap();
|
7564 8242 | #[allow(unused_mut)]
|
7565 8243 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7566 8244 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7567 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
8245 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7568 8246 | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7569 8247 | let sender = sender.clone();
|
7570 8248 | async move {
|
7571 8249 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7572 8250 | sender.send(()).await.expect("receiver dropped early");
|
7573 8251 | result
|
7574 8252 | }
|
7575 8253 | })
|
7576 8254 | .build_unchecked();
|
7577 8255 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7578 8256 | .await
|
7579 8257 | .expect("unable to make an HTTP request");
|
7580 8258 | ::pretty_assertions::assert_eq!(
|
7581 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8259 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7582 8260 | http_response.status()
|
7583 8261 | );
|
7584 8262 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7585 8263 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7586 8264 | http_response.headers(),
|
7587 8265 | expected_headers,
|
7588 8266 | ));
|
7589 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8267 + | use ::http_body_util::BodyExt;
|
8268 + | let body = http_response
|
8269 + | .into_body()
|
8270 + | .collect()
|
7590 8271 | .await
|
7591 - | .expect("unable to extract body to bytes");
|
8272 + | .expect("unable to collect body")
|
8273 + | .to_bytes();
|
7592 8274 | ::aws_smithy_protocol_test::assert_ok(
|
7593 8275 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/stringWithEnumTrait' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\",\n \"fieldList\" : [{\"message\": \"Value at '/stringWithEnumTrait' failed to satisfy constraint: Member must satisfy enum value set: [abc, def]\", \"path\": \"/stringWithEnumTrait\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7594 8276 | );
|
7595 8277 | }
|
7596 8278 | }
|
7597 8279 |
|
7598 8280 | /// When a list member value does not contain a valid enum value,
|
7599 8281 | /// the response should be a 400 ValidationException. Internal-only
|
7600 8282 | /// enum values are excluded from the response message.
|
7601 8283 | /// Test ID: RestJsonMalformedEnumList_case0
|
7602 8284 | #[::tokio::test]
|
7603 8285 | #[::tracing_test::traced_test]
|
7604 8286 | #[should_panic]
|
7605 8287 | async fn rest_json_malformed_enum_list_case0_malformed_request() {
|
7606 8288 | {
|
7607 8289 | #[allow(unused_mut)]
|
7608 - | let mut http_request = http::Request::builder()
|
8290 + | let mut http_request = ::http_1x::Request::builder()
|
7609 8291 | .uri("/MalformedEnum")
|
7610 8292 | .method("POST")
|
7611 8293 | .header("content-type", "application/json")
|
7612 - | .body(::aws_smithy_http_server::body::Body::from(
|
7613 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7614 - | "{ \"list\" : [\"ABC\"] }".as_bytes(),
|
7615 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8294 + | .body(::aws_smithy_http_server::body::boxed(
|
8295 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
8296 + | &::aws_smithy_protocol_test::decode_body_data(
|
8297 + | "{ \"list\" : [\"ABC\"] }".as_bytes(),
|
8298 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8299 + | ),
|
7616 8300 | )),
|
7617 8301 | ))
|
7618 8302 | .unwrap();
|
7619 8303 | #[allow(unused_mut)]
|
7620 8304 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7621 8305 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7622 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
8306 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7623 8307 | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7624 8308 | let sender = sender.clone();
|
7625 8309 | async move {
|
7626 8310 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7627 8311 | sender.send(()).await.expect("receiver dropped early");
|
7628 8312 | result
|
7629 8313 | }
|
7630 8314 | })
|
7631 8315 | .build_unchecked();
|
7632 8316 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7633 8317 | .await
|
7634 8318 | .expect("unable to make an HTTP request");
|
7635 8319 | ::pretty_assertions::assert_eq!(
|
7636 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8320 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7637 8321 | http_response.status()
|
7638 8322 | );
|
7639 8323 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7640 8324 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7641 8325 | http_response.headers(),
|
7642 8326 | expected_headers,
|
7643 8327 | ));
|
7644 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8328 + | use ::http_body_util::BodyExt;
|
8329 + | let body = http_response
|
8330 + | .into_body()
|
8331 + | .collect()
|
7645 8332 | .await
|
7646 - | .expect("unable to extract body to bytes");
|
8333 + | .expect("unable to collect body")
|
8334 + | .to_bytes();
|
7647 8335 | ::aws_smithy_protocol_test::assert_ok(
|
7648 8336 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7649 8337 | );
|
7650 8338 | }
|
7651 8339 | }
|
7652 8340 |
|
7653 8341 | /// When a list member value does not contain a valid enum value,
|
7654 8342 | /// the response should be a 400 ValidationException. Internal-only
|
7655 8343 | /// enum values are excluded from the response message.
|
7656 8344 | /// Test ID: RestJsonMalformedEnumList_case1
|
7657 8345 | #[::tokio::test]
|
7658 8346 | #[::tracing_test::traced_test]
|
7659 8347 | #[should_panic]
|
7660 8348 | async fn rest_json_malformed_enum_list_case1_malformed_request() {
|
7661 8349 | {
|
7662 8350 | #[allow(unused_mut)]
|
7663 - | let mut http_request = http::Request::builder()
|
8351 + | let mut http_request = ::http_1x::Request::builder()
|
7664 8352 | .uri("/MalformedEnum")
|
7665 8353 | .method("POST")
|
7666 8354 | .header("content-type", "application/json")
|
7667 - | .body(::aws_smithy_http_server::body::Body::from(
|
7668 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7669 - | "{ \"list\" : [\"XYZ\"] }".as_bytes(),
|
7670 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8355 + | .body(::aws_smithy_http_server::body::boxed(
|
8356 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
8357 + | &::aws_smithy_protocol_test::decode_body_data(
|
8358 + | "{ \"list\" : [\"XYZ\"] }".as_bytes(),
|
8359 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8360 + | ),
|
7671 8361 | )),
|
7672 8362 | ))
|
7673 8363 | .unwrap();
|
7674 8364 | #[allow(unused_mut)]
|
7675 8365 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7676 8366 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7677 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
8367 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7678 8368 | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7679 8369 | let sender = sender.clone();
|
7680 8370 | async move {
|
7681 8371 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7682 8372 | sender.send(()).await.expect("receiver dropped early");
|
7683 8373 | result
|
7684 8374 | }
|
7685 8375 | })
|
7686 8376 | .build_unchecked();
|
7687 8377 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7688 8378 | .await
|
7689 8379 | .expect("unable to make an HTTP request");
|
7690 8380 | ::pretty_assertions::assert_eq!(
|
7691 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8381 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7692 8382 | http_response.status()
|
7693 8383 | );
|
7694 8384 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7695 8385 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7696 8386 | http_response.headers(),
|
7697 8387 | expected_headers,
|
7698 8388 | ));
|
7699 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8389 + | use ::http_body_util::BodyExt;
|
8390 + | let body = http_response
|
8391 + | .into_body()
|
8392 + | .collect()
|
7700 8393 | .await
|
7701 - | .expect("unable to extract body to bytes");
|
8394 + | .expect("unable to collect body")
|
8395 + | .to_bytes();
|
7702 8396 | ::aws_smithy_protocol_test::assert_ok(
|
7703 8397 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/list/0' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/list/0' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/list/0\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7704 8398 | );
|
7705 8399 | }
|
7706 8400 | }
|
7707 8401 |
|
7708 8402 | /// When a map member's key does not contain a valid enum value,
|
7709 8403 | /// the response should be a 400 ValidationException. Internal-only
|
7710 8404 | /// enum values are excluded from the response message.
|
7711 8405 | /// Test ID: RestJsonMalformedEnumMapKey_case0
|
7712 8406 | #[::tokio::test]
|
7713 8407 | #[::tracing_test::traced_test]
|
7714 8408 | #[should_panic]
|
7715 8409 | async fn rest_json_malformed_enum_map_key_case0_malformed_request() {
|
7716 8410 | {
|
7717 8411 | #[allow(unused_mut)]
|
7718 - | let mut http_request = http::Request::builder()
|
8412 + | let mut http_request = ::http_1x::Request::builder()
|
7719 8413 | .uri("/MalformedEnum")
|
7720 8414 | .method("POST")
|
7721 8415 | .header("content-type", "application/json")
|
7722 - | .body(::aws_smithy_http_server::body::Body::from(
|
7723 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7724 - | "{ \"map\" : { \"ABC\" : \"abc\" } }".as_bytes(),
|
7725 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8416 + | .body(::aws_smithy_http_server::body::boxed(
|
8417 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
8418 + | &::aws_smithy_protocol_test::decode_body_data(
|
8419 + | "{ \"map\" : { \"ABC\" : \"abc\" } }".as_bytes(),
|
8420 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8421 + | ),
|
7726 8422 | )),
|
7727 8423 | ))
|
7728 8424 | .unwrap();
|
7729 8425 | #[allow(unused_mut)]
|
7730 8426 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7731 8427 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7732 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
8428 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7733 8429 | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7734 8430 | let sender = sender.clone();
|
7735 8431 | async move {
|
7736 8432 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7737 8433 | sender.send(()).await.expect("receiver dropped early");
|
7738 8434 | result
|
7739 8435 | }
|
7740 8436 | })
|
7741 8437 | .build_unchecked();
|
7742 8438 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7743 8439 | .await
|
7744 8440 | .expect("unable to make an HTTP request");
|
7745 8441 | ::pretty_assertions::assert_eq!(
|
7746 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8442 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7747 8443 | http_response.status()
|
7748 8444 | );
|
7749 8445 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7750 8446 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7751 8447 | http_response.headers(),
|
7752 8448 | expected_headers,
|
7753 8449 | ));
|
7754 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8450 + | use ::http_body_util::BodyExt;
|
8451 + | let body = http_response
|
8452 + | .into_body()
|
8453 + | .collect()
|
7755 8454 | .await
|
7756 - | .expect("unable to extract body to bytes");
|
8455 + | .expect("unable to collect body")
|
8456 + | .to_bytes();
|
7757 8457 | ::aws_smithy_protocol_test::assert_ok(
|
7758 8458 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7759 8459 | );
|
7760 8460 | }
|
7761 8461 | }
|
7762 8462 |
|
7763 8463 | /// When a map member's key does not contain a valid enum value,
|
7764 8464 | /// the response should be a 400 ValidationException. Internal-only
|
7765 8465 | /// enum values are excluded from the response message.
|
7766 8466 | /// Test ID: RestJsonMalformedEnumMapKey_case1
|
7767 8467 | #[::tokio::test]
|
7768 8468 | #[::tracing_test::traced_test]
|
7769 8469 | #[should_panic]
|
7770 8470 | async fn rest_json_malformed_enum_map_key_case1_malformed_request() {
|
7771 8471 | {
|
7772 8472 | #[allow(unused_mut)]
|
7773 - | let mut http_request = http::Request::builder()
|
8473 + | let mut http_request = ::http_1x::Request::builder()
|
7774 8474 | .uri("/MalformedEnum")
|
7775 8475 | .method("POST")
|
7776 8476 | .header("content-type", "application/json")
|
7777 - | .body(::aws_smithy_http_server::body::Body::from(
|
7778 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7779 - | "{ \"map\" : { \"XYZ\" : \"abc\" } }".as_bytes(),
|
7780 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8477 + | .body(::aws_smithy_http_server::body::boxed(
|
8478 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
8479 + | &::aws_smithy_protocol_test::decode_body_data(
|
8480 + | "{ \"map\" : { \"XYZ\" : \"abc\" } }".as_bytes(),
|
8481 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8482 + | ),
|
7781 8483 | )),
|
7782 8484 | ))
|
7783 8485 | .unwrap();
|
7784 8486 | #[allow(unused_mut)]
|
7785 8487 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7786 8488 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7787 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
8489 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7788 8490 | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7789 8491 | let sender = sender.clone();
|
7790 8492 | async move {
|
7791 8493 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7792 8494 | sender.send(()).await.expect("receiver dropped early");
|
7793 8495 | result
|
7794 8496 | }
|
7795 8497 | })
|
7796 8498 | .build_unchecked();
|
7797 8499 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7798 8500 | .await
|
7799 8501 | .expect("unable to make an HTTP request");
|
7800 8502 | ::pretty_assertions::assert_eq!(
|
7801 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8503 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7802 8504 | http_response.status()
|
7803 8505 | );
|
7804 8506 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7805 8507 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7806 8508 | http_response.headers(),
|
7807 8509 | expected_headers,
|
7808 8510 | ));
|
7809 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8511 + | use ::http_body_util::BodyExt;
|
8512 + | let body = http_response
|
8513 + | .into_body()
|
8514 + | .collect()
|
7810 8515 | .await
|
7811 - | .expect("unable to extract body to bytes");
|
8516 + | .expect("unable to collect body")
|
8517 + | .to_bytes();
|
7812 8518 | ::aws_smithy_protocol_test::assert_ok(
|
7813 8519 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/map' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/map\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7814 8520 | );
|
7815 8521 | }
|
7816 8522 | }
|
7817 8523 |
|
7818 8524 | /// When a map member's value does not contain a valid enum value,
|
7819 8525 | /// the response should be a 400 ValidationException. Internal-only
|
7820 8526 | /// enum values are excluded from the response message.
|
7821 8527 | /// Test ID: RestJsonMalformedEnumMapValue_case0
|
7822 8528 | #[::tokio::test]
|
7823 8529 | #[::tracing_test::traced_test]
|
7824 8530 | #[should_panic]
|
7825 8531 | async fn rest_json_malformed_enum_map_value_case0_malformed_request() {
|
7826 8532 | {
|
7827 8533 | #[allow(unused_mut)]
|
7828 - | let mut http_request = http::Request::builder()
|
8534 + | let mut http_request = ::http_1x::Request::builder()
|
7829 8535 | .uri("/MalformedEnum")
|
7830 8536 | .method("POST")
|
7831 8537 | .header("content-type", "application/json")
|
7832 - | .body(::aws_smithy_http_server::body::Body::from(
|
7833 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7834 - | "{ \"map\" : { \"abc\": \"ABC\" } }".as_bytes(),
|
7835 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8538 + | .body(::aws_smithy_http_server::body::boxed(
|
8539 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
8540 + | &::aws_smithy_protocol_test::decode_body_data(
|
8541 + | "{ \"map\" : { \"abc\": \"ABC\" } }".as_bytes(),
|
8542 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8543 + | ),
|
7836 8544 | )),
|
7837 8545 | ))
|
7838 8546 | .unwrap();
|
7839 8547 | #[allow(unused_mut)]
|
7840 8548 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7841 8549 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7842 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
8550 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7843 8551 | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7844 8552 | let sender = sender.clone();
|
7845 8553 | async move {
|
7846 8554 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7847 8555 | sender.send(()).await.expect("receiver dropped early");
|
7848 8556 | result
|
7849 8557 | }
|
7850 8558 | })
|
7851 8559 | .build_unchecked();
|
7852 8560 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7853 8561 | .await
|
7854 8562 | .expect("unable to make an HTTP request");
|
7855 8563 | ::pretty_assertions::assert_eq!(
|
7856 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8564 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7857 8565 | http_response.status()
|
7858 8566 | );
|
7859 8567 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7860 8568 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7861 8569 | http_response.headers(),
|
7862 8570 | expected_headers,
|
7863 8571 | ));
|
7864 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8572 + | use ::http_body_util::BodyExt;
|
8573 + | let body = http_response
|
8574 + | .into_body()
|
8575 + | .collect()
|
7865 8576 | .await
|
7866 - | .expect("unable to extract body to bytes");
|
8577 + | .expect("unable to collect body")
|
8578 + | .to_bytes();
|
7867 8579 | ::aws_smithy_protocol_test::assert_ok(
|
7868 8580 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/abc' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/map/abc' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7869 8581 | );
|
7870 8582 | }
|
7871 8583 | }
|
7872 8584 |
|
7873 8585 | /// When a map member's value does not contain a valid enum value,
|
7874 8586 | /// the response should be a 400 ValidationException. Internal-only
|
7875 8587 | /// enum values are excluded from the response message.
|
7876 8588 | /// Test ID: RestJsonMalformedEnumMapValue_case1
|
7877 8589 | #[::tokio::test]
|
7878 8590 | #[::tracing_test::traced_test]
|
7879 8591 | #[should_panic]
|
7880 8592 | async fn rest_json_malformed_enum_map_value_case1_malformed_request() {
|
7881 8593 | {
|
7882 8594 | #[allow(unused_mut)]
|
7883 - | let mut http_request = http::Request::builder()
|
8595 + | let mut http_request = ::http_1x::Request::builder()
|
7884 8596 | .uri("/MalformedEnum")
|
7885 8597 | .method("POST")
|
7886 8598 | .header("content-type", "application/json")
|
7887 - | .body(::aws_smithy_http_server::body::Body::from(
|
7888 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7889 - | "{ \"map\" : { \"abc\": \"XYZ\" } }".as_bytes(),
|
7890 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8599 + | .body(::aws_smithy_http_server::body::boxed(
|
8600 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
8601 + | &::aws_smithy_protocol_test::decode_body_data(
|
8602 + | "{ \"map\" : { \"abc\": \"XYZ\" } }".as_bytes(),
|
8603 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8604 + | ),
|
7891 8605 | )),
|
7892 8606 | ))
|
7893 8607 | .unwrap();
|
7894 8608 | #[allow(unused_mut)]
|
7895 8609 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7896 8610 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7897 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
8611 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7898 8612 | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7899 8613 | let sender = sender.clone();
|
7900 8614 | async move {
|
7901 8615 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7902 8616 | sender.send(()).await.expect("receiver dropped early");
|
7903 8617 | result
|
7904 8618 | }
|
7905 8619 | })
|
7906 8620 | .build_unchecked();
|
7907 8621 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7908 8622 | .await
|
7909 8623 | .expect("unable to make an HTTP request");
|
7910 8624 | ::pretty_assertions::assert_eq!(
|
7911 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8625 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7912 8626 | http_response.status()
|
7913 8627 | );
|
7914 8628 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7915 8629 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7916 8630 | http_response.headers(),
|
7917 8631 | expected_headers,
|
7918 8632 | ));
|
7919 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8633 + | use ::http_body_util::BodyExt;
|
8634 + | let body = http_response
|
8635 + | .into_body()
|
8636 + | .collect()
|
7920 8637 | .await
|
7921 - | .expect("unable to extract body to bytes");
|
8638 + | .expect("unable to collect body")
|
8639 + | .to_bytes();
|
7922 8640 | ::aws_smithy_protocol_test::assert_ok(
|
7923 8641 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/map/abc' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/map/abc' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/map/abc\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7924 8642 | );
|
7925 8643 | }
|
7926 8644 | }
|
7927 8645 |
|
7928 8646 | /// When a union member's value does not contain a valid enum value,
|
7929 8647 | /// the response should be a 400 ValidationException. Internal-only
|
7930 8648 | /// enum values are excluded from the response message.
|
7931 8649 | /// Test ID: RestJsonMalformedEnumUnion_case0
|
7932 8650 | #[::tokio::test]
|
7933 8651 | #[::tracing_test::traced_test]
|
7934 8652 | #[should_panic]
|
7935 8653 | async fn rest_json_malformed_enum_union_case0_malformed_request() {
|
7936 8654 | {
|
7937 8655 | #[allow(unused_mut)]
|
7938 - | let mut http_request = http::Request::builder()
|
8656 + | let mut http_request = ::http_1x::Request::builder()
|
7939 8657 | .uri("/MalformedEnum")
|
7940 8658 | .method("POST")
|
7941 8659 | .header("content-type", "application/json")
|
7942 - | .body(::aws_smithy_http_server::body::Body::from(
|
7943 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7944 - | "{ \"union\" : { \"first\": \"ABC\" } }".as_bytes(),
|
7945 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8660 + | .body(::aws_smithy_http_server::body::boxed(
|
8661 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
8662 + | &::aws_smithy_protocol_test::decode_body_data(
|
8663 + | "{ \"union\" : { \"first\": \"ABC\" } }".as_bytes(),
|
8664 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8665 + | ),
|
7946 8666 | )),
|
7947 8667 | ))
|
7948 8668 | .unwrap();
|
7949 8669 | #[allow(unused_mut)]
|
7950 8670 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7951 8671 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
7952 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
8672 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7953 8673 | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
7954 8674 | let sender = sender.clone();
|
7955 8675 | async move {
|
7956 8676 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
7957 8677 | sender.send(()).await.expect("receiver dropped early");
|
7958 8678 | result
|
7959 8679 | }
|
7960 8680 | })
|
7961 8681 | .build_unchecked();
|
7962 8682 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7963 8683 | .await
|
7964 8684 | .expect("unable to make an HTTP request");
|
7965 8685 | ::pretty_assertions::assert_eq!(
|
7966 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8686 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7967 8687 | http_response.status()
|
7968 8688 | );
|
7969 8689 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
7970 8690 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7971 8691 | http_response.headers(),
|
7972 8692 | expected_headers,
|
7973 8693 | ));
|
7974 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8694 + | use ::http_body_util::BodyExt;
|
8695 + | let body = http_response
|
8696 + | .into_body()
|
8697 + | .collect()
|
7975 8698 | .await
|
7976 - | .expect("unable to extract body to bytes");
|
8699 + | .expect("unable to collect body")
|
8700 + | .to_bytes();
|
7977 8701 | ::aws_smithy_protocol_test::assert_ok(
|
7978 8702 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
7979 8703 | );
|
7980 8704 | }
|
7981 8705 | }
|
7982 8706 |
|
7983 8707 | /// When a union member's value does not contain a valid enum value,
|
7984 8708 | /// the response should be a 400 ValidationException. Internal-only
|
7985 8709 | /// enum values are excluded from the response message.
|
7986 8710 | /// Test ID: RestJsonMalformedEnumUnion_case1
|
7987 8711 | #[::tokio::test]
|
7988 8712 | #[::tracing_test::traced_test]
|
7989 8713 | #[should_panic]
|
7990 8714 | async fn rest_json_malformed_enum_union_case1_malformed_request() {
|
7991 8715 | {
|
7992 8716 | #[allow(unused_mut)]
|
7993 - | let mut http_request = http::Request::builder()
|
8717 + | let mut http_request = ::http_1x::Request::builder()
|
7994 8718 | .uri("/MalformedEnum")
|
7995 8719 | .method("POST")
|
7996 8720 | .header("content-type", "application/json")
|
7997 - | .body(::aws_smithy_http_server::body::Body::from(
|
7998 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
7999 - | "{ \"union\" : { \"first\": \"XYZ\" } }".as_bytes(),
|
8000 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8721 + | .body(::aws_smithy_http_server::body::boxed(
|
8722 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
8723 + | &::aws_smithy_protocol_test::decode_body_data(
|
8724 + | "{ \"union\" : { \"first\": \"XYZ\" } }".as_bytes(),
|
8725 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
8726 + | ),
|
8001 8727 | )),
|
8002 8728 | ))
|
8003 8729 | .unwrap();
|
8004 8730 | #[allow(unused_mut)]
|
8005 8731 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8006 8732 | let config = crate::service::RestJsonValidationConfig::builder().build();
|
8007 - | let service = crate::service::RestJsonValidation::builder::<::hyper::body::Body, _, _, _>(config)
|
8733 + | let service = crate::service::RestJsonValidation::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8008 8734 | .malformed_enum(move |input: crate::input::MalformedEnumInput| {
|
8009 8735 | let sender = sender.clone();
|
8010 8736 | async move {
|
8011 8737 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedEnumOutput, crate::error::MalformedEnumError> };
|
8012 8738 | sender.send(()).await.expect("receiver dropped early");
|
8013 8739 | result
|
8014 8740 | }
|
8015 8741 | })
|
8016 8742 | .build_unchecked();
|
8017 8743 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8018 8744 | .await
|
8019 8745 | .expect("unable to make an HTTP request");
|
8020 8746 | ::pretty_assertions::assert_eq!(
|
8021 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8747 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8022 8748 | http_response.status()
|
8023 8749 | );
|
8024 8750 | let expected_headers = [("x-amzn-errortype", "ValidationException")];
|
8025 8751 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8026 8752 | http_response.headers(),
|
8027 8753 | expected_headers,
|
8028 8754 | ));
|
8029 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
8755 + | use ::http_body_util::BodyExt;
|
8756 + | let body = http_response
|
8757 + | .into_body()
|
8758 + | .collect()
|
8030 8759 | .await
|
8031 - | .expect("unable to extract body to bytes");
|
8760 + | .expect("unable to collect body")
|
8761 + | .to_bytes();
|
8032 8762 | ::aws_smithy_protocol_test::assert_ok(
|
8033 8763 | ::aws_smithy_protocol_test::validate_body(&body, "{ \"message\" : \"1 validation error detected. Value at '/union/first' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\",\n \"fieldList\" : [{\"message\": \"Value at '/union/first' failed to satisfy constraint: Member must satisfy enum value set: [abc, def, jkl]\", \"path\": \"/union/first\"}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
8034 8764 | );
|
8035 8765 | }
|
8036 8766 | }
|
8037 8767 | }
|