672 691 | let json_bytes = br#"null"#;
|
673 692 | let mut tokens =
|
674 693 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
675 694 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
676 695 | .expect("well formed json")
|
677 696 | }),
|
678 697 | };
|
679 698 | use ::aws_smithy_http_server::response::IntoResponse;
|
680 699 | let http_response = output.into_response();
|
681 700 | ::pretty_assertions::assert_eq!(
|
682 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
701 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
683 702 | http_response.status()
|
684 703 | );
|
685 704 | let expected_headers = [("Content-Type", "application/json")];
|
686 705 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
687 706 | http_response.headers(),
|
688 707 | expected_headers,
|
689 708 | ));
|
690 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
709 + | use ::http_body_util::BodyExt;
|
710 + | let body = http_response
|
711 + | .into_body()
|
712 + | .collect()
|
691 713 | .await
|
692 - | .expect("unable to extract body to bytes");
|
714 + | .expect("unable to collect body")
|
715 + | .to_bytes();
|
693 716 | ::aws_smithy_protocol_test::assert_ok(
|
694 717 | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"defaultString\": \"hi\",\n \"defaultBoolean\": true,\n \"defaultList\": [],\n \"defaultDocumentMap\": {},\n \"defaultDocumentString\": \"hi\",\n \"defaultDocumentBoolean\": true,\n \"defaultDocumentList\": [],\n \"defaultTimestamp\": 0,\n \"defaultBlob\": \"YWJj\",\n \"defaultByte\": 1,\n \"defaultShort\": 1,\n \"defaultInteger\": 10,\n \"defaultLong\": 100,\n \"defaultFloat\": 1.0,\n \"defaultDouble\": 1.0,\n \"defaultMap\": {},\n \"defaultEnum\": \"FOO\",\n \"defaultIntEnum\": 1,\n \"emptyString\": \"\",\n \"falseBoolean\": false,\n \"emptyBlob\": \"\",\n \"zeroByte\": 0,\n \"zeroShort\": 0,\n \"zeroInteger\": 0,\n \"zeroLong\": 0,\n \"zeroFloat\": 0.0,\n \"zeroDouble\": 0.0\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
695 718 | );
|
696 719 | }
|
720 + |
|
721 + | /* ProtocolTestGenerator.kt:98 */
|
697 722 | }
|
698 723 |
|
724 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
699 725 | ::pin_project_lite::pin_project! {
|
700 726 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
701 727 | /// [`ContentTypeParametersInput`](crate::input::ContentTypeParametersInput) using modelled bindings.
|
702 728 | pub struct ContentTypeParametersInputFuture {
|
703 729 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::ContentTypeParametersInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
704 730 | }
|
705 731 | }
|
706 732 |
|
707 733 | impl std::future::Future for ContentTypeParametersInputFuture {
|
708 734 | type Output = Result<
|
709 735 | crate::input::ContentTypeParametersInput,
|
710 736 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
711 737 | >;
|
712 738 |
|
713 739 | fn poll(
|
714 740 | self: std::pin::Pin<&mut Self>,
|
715 741 | cx: &mut std::task::Context<'_>,
|
716 742 | ) -> std::task::Poll<Self::Output> {
|
717 743 | let this = self.project();
|
718 744 | this.inner.as_mut().poll(cx)
|
719 745 | }
|
720 746 | }
|
721 747 |
|
722 748 | impl<B>
|
723 749 | ::aws_smithy_http_server::request::FromRequest<
|
724 750 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
725 751 | B,
|
726 752 | > for crate::input::ContentTypeParametersInput
|
727 753 | where
|
728 754 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
729 755 | B: 'static,
|
730 756 |
|
731 757 | B::Data: Send,
|
732 758 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
733 759 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
734 760 | {
|
735 761 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
736 762 | type Future = ContentTypeParametersInputFuture;
|
737 763 |
|
738 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
764 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
739 765 | let fut = async move {
|
740 766 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
741 767 | request.headers(),
|
742 768 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
743 769 | ) {
|
744 770 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
745 771 | }
|
746 772 | crate::protocol_serde::shape_content_type_parameters::de_content_type_parameters_http_request(request)
|
747 773 | .await
|
748 774 | };
|
749 775 | use ::futures_util::future::TryFutureExt;
|
750 776 | let fut = fut.map_err(
|
751 777 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
752 778 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
753 779 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
754 780 | e,
|
755 781 | )
|
756 782 | },
|
757 783 | );
|
758 784 | ContentTypeParametersInputFuture {
|
759 785 | inner: Box::pin(fut),
|
760 786 | }
|
761 787 | }
|
762 788 | }
|
789 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
763 790 | impl
|
764 791 | ::aws_smithy_http_server::response::IntoResponse<
|
765 792 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
766 793 | > for crate::output::ContentTypeParametersOutput
|
767 794 | {
|
768 795 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
769 796 | match crate::protocol_serde::shape_content_type_parameters::ser_content_type_parameters_http_response(self) {
|
770 797 | Ok(response) => response,
|
771 798 | Err(e) => {
|
772 799 | ::tracing::error!(error = %e, "failed to serialize response");
|
773 800 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
774 801 | }
|
775 802 | }
|
776 803 | }
|
777 804 | }
|
778 805 |
|
806 + | /* RustType.kt:534 */
|
779 807 | #[allow(unreachable_code, unused_variables)]
|
808 + | /* RustType.kt:534 */
|
780 809 | #[cfg(test)]
|
810 + | /* ProtocolTestGenerator.kt:98 */
|
781 811 | mod content_type_parameters_test {
|
782 812 |
|
783 813 | /// A server should ignore parameters added to the content type
|
784 814 | /// Test ID: RestJsonMustSupportParametersInContentType
|
785 815 | #[::tokio::test]
|
786 816 | #[::tracing_test::traced_test]
|
787 817 | async fn rest_json_must_support_parameters_in_content_type_request() {
|
788 818 | #[allow(unused_mut)]
|
789 - | let mut http_request = http::Request::builder()
|
819 + | let mut http_request = ::http_1x::Request::builder()
|
790 820 | .uri("/ContentTypeParameters")
|
791 821 | .method("POST")
|
792 822 | .header("Content-Type", "application/json; charset=utf-8")
|
793 - | .body(::aws_smithy_http_server::body::Body::from(
|
794 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
795 - | "{\"value\":5}".as_bytes(),
|
796 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
823 + | .body(::aws_smithy_http_server::body::boxed(
|
824 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
825 + | &::aws_smithy_protocol_test::decode_body_data(
|
826 + | "{\"value\":5}".as_bytes(),
|
827 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
828 + | ),
|
797 829 | )),
|
798 830 | ))
|
799 831 | .unwrap();
|
800 832 | #[allow(unused_mut)]
|
801 833 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
802 834 | let config = crate::service::RestJsonConfig::builder().build();
|
803 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
835 + | let service =
|
836 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
837 + | config,
|
838 + | )
|
804 839 | .content_type_parameters(move |input: crate::input::ContentTypeParametersInput| {
|
805 840 | let sender = sender.clone();
|
806 841 | async move {
|
807 842 | let result = {
|
808 843 | let expected = crate::input::ContentTypeParametersInput {
|
809 844 | value: ::std::option::Option::Some(5),
|
810 845 | };
|
811 846 | ::pretty_assertions::assert_eq!(input, expected);
|
812 847 | let output = crate::output::ContentTypeParametersOutput {};
|
813 848 | output
|
814 849 | };
|
815 850 | sender.send(()).await.expect("receiver dropped early");
|
816 851 | result
|
817 852 | }
|
818 853 | })
|
819 854 | .build_unchecked();
|
820 855 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
821 856 | .await
|
822 857 | .expect("unable to make an HTTP request");
|
823 858 | assert!(
|
824 859 | receiver.recv().await.is_some(),
|
825 860 | "we expected operation handler to be invoked but it was not entered"
|
826 861 | );
|
827 862 | }
|
863 + |
|
864 + | /* ProtocolTestGenerator.kt:98 */
|
828 865 | }
|
829 866 |
|
867 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
830 868 | ::pin_project_lite::pin_project! {
|
831 869 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
832 870 | /// [`PutWithContentEncodingInput`](crate::input::PutWithContentEncodingInput) using modelled bindings.
|
833 871 | pub struct PutWithContentEncodingInputFuture {
|
834 872 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PutWithContentEncodingInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
835 873 | }
|
836 874 | }
|
837 875 |
|
838 876 | impl std::future::Future for PutWithContentEncodingInputFuture {
|
839 877 | type Output = Result<
|
840 878 | crate::input::PutWithContentEncodingInput,
|
841 879 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
842 880 | >;
|
843 881 |
|
844 882 | fn poll(
|
845 883 | self: std::pin::Pin<&mut Self>,
|
846 884 | cx: &mut std::task::Context<'_>,
|
847 885 | ) -> std::task::Poll<Self::Output> {
|
848 886 | let this = self.project();
|
849 887 | this.inner.as_mut().poll(cx)
|
850 888 | }
|
851 889 | }
|
852 890 |
|
853 891 | impl<B>
|
854 892 | ::aws_smithy_http_server::request::FromRequest<
|
855 893 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
856 894 | B,
|
857 895 | > for crate::input::PutWithContentEncodingInput
|
858 896 | where
|
859 897 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
860 898 | B: 'static,
|
861 899 |
|
862 900 | B::Data: Send,
|
863 901 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
864 902 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
865 903 | {
|
866 904 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
867 905 | type Future = PutWithContentEncodingInputFuture;
|
868 906 |
|
869 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
907 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
870 908 | let fut = async move {
|
871 909 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
872 910 | request.headers(),
|
873 911 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
874 912 | ) {
|
875 913 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
876 914 | }
|
877 915 | crate::protocol_serde::shape_put_with_content_encoding::de_put_with_content_encoding_http_request(request)
|
878 916 | .await
|
879 917 | };
|
880 918 | use ::futures_util::future::TryFutureExt;
|
881 919 | let fut = fut.map_err(
|
882 920 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
883 921 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
884 922 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
885 923 | e,
|
886 924 | )
|
887 925 | },
|
888 926 | );
|
889 927 | PutWithContentEncodingInputFuture {
|
890 928 | inner: Box::pin(fut),
|
891 929 | }
|
892 930 | }
|
893 931 | }
|
932 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
894 933 | impl
|
895 934 | ::aws_smithy_http_server::response::IntoResponse<
|
896 935 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
897 936 | > for crate::output::PutWithContentEncodingOutput
|
898 937 | {
|
899 938 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
900 939 | match crate::protocol_serde::shape_put_with_content_encoding::ser_put_with_content_encoding_http_response(self) {
|
901 940 | Ok(response) => response,
|
902 941 | Err(e) => {
|
903 942 | ::tracing::error!(error = %e, "failed to serialize response");
|
904 943 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
905 944 | }
|
906 945 | }
|
907 946 | }
|
908 947 | }
|
909 948 |
|
949 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
910 950 | ::pin_project_lite::pin_project! {
|
911 951 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
912 952 | /// [`FractionalSecondsInput`](crate::input::FractionalSecondsInput) using modelled bindings.
|
913 953 | pub struct FractionalSecondsInputFuture {
|
914 954 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::FractionalSecondsInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
915 955 | }
|
916 956 | }
|
917 957 |
|
918 958 | impl std::future::Future for FractionalSecondsInputFuture {
|
919 959 | type Output = Result<
|
920 960 | crate::input::FractionalSecondsInput,
|
921 961 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
922 962 | >;
|
923 963 |
|
924 964 | fn poll(
|
925 965 | self: std::pin::Pin<&mut Self>,
|
926 966 | cx: &mut std::task::Context<'_>,
|
927 967 | ) -> std::task::Poll<Self::Output> {
|
928 968 | let this = self.project();
|
929 969 | this.inner.as_mut().poll(cx)
|
930 970 | }
|
931 971 | }
|
932 972 |
|
933 973 | impl<B>
|
934 974 | ::aws_smithy_http_server::request::FromRequest<
|
935 975 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
936 976 | B,
|
937 977 | > for crate::input::FractionalSecondsInput
|
938 978 | where
|
939 979 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
940 980 | B: 'static,
|
941 981 |
|
942 982 | B::Data: Send,
|
943 983 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
944 984 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
945 985 | {
|
946 986 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
947 987 | type Future = FractionalSecondsInputFuture;
|
948 988 |
|
949 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
989 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
950 990 | let fut = async move {
|
951 991 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
952 992 | request.headers(),
|
953 993 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
954 994 | ) {
|
955 995 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
956 996 | }
|
957 997 | crate::protocol_serde::shape_fractional_seconds::de_fractional_seconds_http_request(
|
958 998 | request,
|
959 999 | )
|
960 1000 | .await
|
961 1001 | };
|
962 1002 | use ::futures_util::future::TryFutureExt;
|
963 1003 | let fut = fut.map_err(
|
964 1004 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
965 1005 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
966 1006 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
967 1007 | e,
|
968 1008 | )
|
969 1009 | },
|
970 1010 | );
|
971 1011 | FractionalSecondsInputFuture {
|
972 1012 | inner: Box::pin(fut),
|
973 1013 | }
|
974 1014 | }
|
975 1015 | }
|
1016 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
976 1017 | impl
|
977 1018 | ::aws_smithy_http_server::response::IntoResponse<
|
978 1019 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
979 1020 | > for crate::output::FractionalSecondsOutput
|
980 1021 | {
|
981 1022 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
982 1023 | match crate::protocol_serde::shape_fractional_seconds::ser_fractional_seconds_http_response(
|
983 1024 | self,
|
984 1025 | ) {
|
985 1026 | Ok(response) => response,
|
986 1027 | Err(e) => {
|
987 1028 | ::tracing::error!(error = %e, "failed to serialize response");
|
988 1029 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
989 1030 | }
|
990 1031 | }
|
991 1032 | }
|
992 1033 | }
|
993 1034 |
|
1035 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
994 1036 | ::pin_project_lite::pin_project! {
|
995 1037 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
996 1038 | /// [`DatetimeOffsetsInput`](crate::input::DatetimeOffsetsInput) using modelled bindings.
|
997 1039 | pub struct DatetimeOffsetsInputFuture {
|
998 1040 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::DatetimeOffsetsInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
999 1041 | }
|
1000 1042 | }
|
1001 1043 |
|
1002 1044 | impl std::future::Future for DatetimeOffsetsInputFuture {
|
1003 1045 | type Output = Result<
|
1004 1046 | crate::input::DatetimeOffsetsInput,
|
1005 1047 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
1006 1048 | >;
|
1007 1049 |
|
1008 1050 | fn poll(
|
1009 1051 | self: std::pin::Pin<&mut Self>,
|
1010 1052 | cx: &mut std::task::Context<'_>,
|
1011 1053 | ) -> std::task::Poll<Self::Output> {
|
1012 1054 | let this = self.project();
|
1013 1055 | this.inner.as_mut().poll(cx)
|
1014 1056 | }
|
1015 1057 | }
|
1016 1058 |
|
1017 1059 | impl<B>
|
1018 1060 | ::aws_smithy_http_server::request::FromRequest<
|
1019 1061 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1020 1062 | B,
|
1021 1063 | > for crate::input::DatetimeOffsetsInput
|
1022 1064 | where
|
1023 1065 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1024 1066 | B: 'static,
|
1025 1067 |
|
1026 1068 | B::Data: Send,
|
1027 1069 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
1028 1070 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1029 1071 | {
|
1030 1072 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
1031 1073 | type Future = DatetimeOffsetsInputFuture;
|
1032 1074 |
|
1033 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1075 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
1034 1076 | let fut = async move {
|
1035 1077 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
1036 1078 | request.headers(),
|
1037 1079 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
1038 1080 | ) {
|
1039 1081 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
1040 1082 | }
|
1041 1083 | crate::protocol_serde::shape_datetime_offsets::de_datetime_offsets_http_request(request)
|
1042 1084 | .await
|
1043 1085 | };
|
1044 1086 | use ::futures_util::future::TryFutureExt;
|
1045 1087 | let fut = fut.map_err(
|
1046 1088 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
1047 1089 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1048 1090 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
1049 1091 | e,
|
1050 1092 | )
|
1051 1093 | },
|
1052 1094 | );
|
1053 1095 | DatetimeOffsetsInputFuture {
|
1054 1096 | inner: Box::pin(fut),
|
1055 1097 | }
|
1056 1098 | }
|
1057 1099 | }
|
1100 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
1058 1101 | impl
|
1059 1102 | ::aws_smithy_http_server::response::IntoResponse<
|
1060 1103 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1061 1104 | > for crate::output::DatetimeOffsetsOutput
|
1062 1105 | {
|
1063 1106 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1064 1107 | match crate::protocol_serde::shape_datetime_offsets::ser_datetime_offsets_http_response(
|
1065 1108 | self,
|
1066 1109 | ) {
|
1067 1110 | Ok(response) => response,
|
1068 1111 | Err(e) => {
|
1069 1112 | ::tracing::error!(error = %e, "failed to serialize response");
|
1070 1113 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
1071 1114 | }
|
1072 1115 | }
|
1073 1116 | }
|
1074 1117 | }
|
1075 1118 |
|
1119 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
1076 1120 | ::pin_project_lite::pin_project! {
|
1077 1121 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1078 1122 | /// [`TestPostNoInputNoPayloadInput`](crate::input::TestPostNoInputNoPayloadInput) using modelled bindings.
|
1079 1123 | pub struct TestPostNoInputNoPayloadInputFuture {
|
1080 1124 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::TestPostNoInputNoPayloadInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
1081 1125 | }
|
1082 1126 | }
|
1083 1127 |
|
1084 1128 | impl std::future::Future for TestPostNoInputNoPayloadInputFuture {
|
1085 1129 | type Output = Result<
|
1086 1130 | crate::input::TestPostNoInputNoPayloadInput,
|
1087 1131 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
1088 1132 | >;
|
1089 1133 |
|
1090 1134 | fn poll(
|
1091 1135 | self: std::pin::Pin<&mut Self>,
|
1092 1136 | cx: &mut std::task::Context<'_>,
|
1093 1137 | ) -> std::task::Poll<Self::Output> {
|
1094 1138 | let this = self.project();
|
1095 1139 | this.inner.as_mut().poll(cx)
|
1096 1140 | }
|
1097 1141 | }
|
1098 1142 |
|
1099 1143 | impl<B>
|
1100 1144 | ::aws_smithy_http_server::request::FromRequest<
|
1101 1145 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1102 1146 | B,
|
1103 1147 | > for crate::input::TestPostNoInputNoPayloadInput
|
1104 1148 | where
|
1105 1149 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1106 1150 | B: 'static,
|
1107 1151 |
|
1108 1152 | B::Data: Send,
|
1109 1153 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
1110 1154 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1111 1155 | {
|
1112 1156 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
1113 1157 | type Future = TestPostNoInputNoPayloadInputFuture;
|
1114 1158 |
|
1115 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1159 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
1116 1160 | let fut = async move {
|
1117 1161 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
1118 1162 | request.headers(),
|
1119 1163 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
1120 1164 | ) {
|
1121 1165 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
1122 1166 | }
|
1123 1167 | crate::protocol_serde::shape_test_post_no_input_no_payload::de_test_post_no_input_no_payload_http_request(request)
|
1124 1168 | .await
|
1125 1169 | };
|
1126 1170 | use ::futures_util::future::TryFutureExt;
|
1127 1171 | let fut = fut.map_err(
|
1128 1172 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
1129 1173 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1130 1174 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
1131 1175 | e,
|
1132 1176 | )
|
1133 1177 | },
|
1134 1178 | );
|
1135 1179 | TestPostNoInputNoPayloadInputFuture {
|
1136 1180 | inner: Box::pin(fut),
|
1137 1181 | }
|
1138 1182 | }
|
1139 1183 | }
|
1184 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
1140 1185 | impl
|
1141 1186 | ::aws_smithy_http_server::response::IntoResponse<
|
1142 1187 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1143 1188 | > for crate::output::TestPostNoInputNoPayloadOutput
|
1144 1189 | {
|
1145 1190 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1146 1191 | match crate::protocol_serde::shape_test_post_no_input_no_payload::ser_test_post_no_input_no_payload_http_response(self) {
|
1147 1192 | Ok(response) => response,
|
1148 1193 | Err(e) => {
|
1149 1194 | ::tracing::error!(error = %e, "failed to serialize response");
|
1150 1195 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
1151 1196 | }
|
1152 1197 | }
|
1153 1198 | }
|
1154 1199 | }
|
1155 1200 |
|
1201 + | /* RustType.kt:534 */
|
1156 1202 | #[allow(unreachable_code, unused_variables)]
|
1203 + | /* RustType.kt:534 */
|
1157 1204 | #[cfg(test)]
|
1205 + | /* ProtocolTestGenerator.kt:98 */
|
1158 1206 | mod test_post_no_input_no_payload_test {
|
1159 1207 |
|
1160 1208 | /// Serializes a POST request for an operation with no input, and therefore no modeled body
|
1161 1209 | /// Test ID: RestJsonHttpPostWithNoInput
|
1162 1210 | #[::tokio::test]
|
1163 1211 | #[::tracing_test::traced_test]
|
1164 1212 | async fn rest_json_http_post_with_no_input_request() {
|
1165 1213 | #[allow(unused_mut)]
|
1166 - | let mut http_request = http::Request::builder()
|
1214 + | let mut http_request = ::http_1x::Request::builder()
|
1167 1215 | .uri("/no_input_no_payload")
|
1168 1216 | .method("POST")
|
1169 - | .body(::aws_smithy_http_server::body::Body::from(
|
1170 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1171 - | "".as_bytes(),
|
1172 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1217 + | .body(::aws_smithy_http_server::body::boxed(
|
1218 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1219 + | &::aws_smithy_protocol_test::decode_body_data(
|
1220 + | "".as_bytes(),
|
1221 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1222 + | ),
|
1173 1223 | )),
|
1174 1224 | ))
|
1175 1225 | .unwrap();
|
1176 1226 | #[allow(unused_mut)]
|
1177 1227 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1178 1228 | let config = crate::service::RestJsonConfig::builder().build();
|
1179 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
1180 - | .test_post_no_input_no_payload(
|
1181 - | move |input: crate::input::TestPostNoInputNoPayloadInput| {
|
1182 - | let sender = sender.clone();
|
1183 - | async move {
|
1184 - | let result = {
|
1185 - | let expected = crate::input::TestPostNoInputNoPayloadInput {};
|
1186 - | ::pretty_assertions::assert_eq!(input, expected);
|
1187 - | let output = crate::output::TestPostNoInputNoPayloadOutput {
|
1188 - | test_id: ::std::option::Option::None,
|
1189 - | };
|
1190 - | output
|
1191 - | };
|
1192 - | sender.send(()).await.expect("receiver dropped early");
|
1193 - | result
|
1194 - | }
|
1195 - | },
|
1196 - | )
|
1197 - | .build_unchecked();
|
1229 + | let service = crate::service::RestJson::builder::<
|
1230 + | ::aws_smithy_http_server::body::BoxBody,
|
1231 + | _,
|
1232 + | _,
|
1233 + | _,
|
1234 + | >(config)
|
1235 + | .test_post_no_input_no_payload(move |input: crate::input::TestPostNoInputNoPayloadInput| {
|
1236 + | let sender = sender.clone();
|
1237 + | async move {
|
1238 + | let result = {
|
1239 + | let expected = crate::input::TestPostNoInputNoPayloadInput {};
|
1240 + | ::pretty_assertions::assert_eq!(input, expected);
|
1241 + | let output = crate::output::TestPostNoInputNoPayloadOutput {
|
1242 + | test_id: ::std::option::Option::None,
|
1243 + | };
|
1244 + | output
|
1245 + | };
|
1246 + | sender.send(()).await.expect("receiver dropped early");
|
1247 + | result
|
1248 + | }
|
1249 + | })
|
1250 + | .build_unchecked();
|
1198 1251 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1199 1252 | .await
|
1200 1253 | .expect("unable to make an HTTP request");
|
1201 1254 | assert!(
|
1202 1255 | receiver.recv().await.is_some(),
|
1203 1256 | "we expected operation handler to be invoked but it was not entered"
|
1204 1257 | );
|
1205 1258 | }
|
1259 + |
|
1260 + | /* ProtocolTestGenerator.kt:98 */
|
1206 1261 | }
|
1207 1262 |
|
1263 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
1208 1264 | ::pin_project_lite::pin_project! {
|
1209 1265 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1210 1266 | /// [`TestGetNoInputNoPayloadInput`](crate::input::TestGetNoInputNoPayloadInput) using modelled bindings.
|
1211 1267 | pub struct TestGetNoInputNoPayloadInputFuture {
|
1212 1268 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::TestGetNoInputNoPayloadInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
1213 1269 | }
|
1214 1270 | }
|
1215 1271 |
|
1216 1272 | impl std::future::Future for TestGetNoInputNoPayloadInputFuture {
|
1217 1273 | type Output = Result<
|
1218 1274 | crate::input::TestGetNoInputNoPayloadInput,
|
1219 1275 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
1220 1276 | >;
|
1221 1277 |
|
1222 1278 | fn poll(
|
1223 1279 | self: std::pin::Pin<&mut Self>,
|
1224 1280 | cx: &mut std::task::Context<'_>,
|
1225 1281 | ) -> std::task::Poll<Self::Output> {
|
1226 1282 | let this = self.project();
|
1227 1283 | this.inner.as_mut().poll(cx)
|
1228 1284 | }
|
1229 1285 | }
|
1230 1286 |
|
1231 1287 | impl<B>
|
1232 1288 | ::aws_smithy_http_server::request::FromRequest<
|
1233 1289 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1234 1290 | B,
|
1235 1291 | > for crate::input::TestGetNoInputNoPayloadInput
|
1236 1292 | where
|
1237 1293 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1238 1294 | B: 'static,
|
1239 1295 |
|
1240 1296 | B::Data: Send,
|
1241 1297 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
1242 1298 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1243 1299 | {
|
1244 1300 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
1245 1301 | type Future = TestGetNoInputNoPayloadInputFuture;
|
1246 1302 |
|
1247 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1303 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
1248 1304 | let fut = async move {
|
1249 1305 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
1250 1306 | request.headers(),
|
1251 1307 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
1252 1308 | ) {
|
1253 1309 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
1254 1310 | }
|
1255 1311 | crate::protocol_serde::shape_test_get_no_input_no_payload::de_test_get_no_input_no_payload_http_request(request)
|
1256 1312 | .await
|
1257 1313 | };
|
1258 1314 | use ::futures_util::future::TryFutureExt;
|
1259 1315 | let fut = fut.map_err(
|
1260 1316 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
1261 1317 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1262 1318 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
1263 1319 | e,
|
1264 1320 | )
|
1265 1321 | },
|
1266 1322 | );
|
1267 1323 | TestGetNoInputNoPayloadInputFuture {
|
1268 1324 | inner: Box::pin(fut),
|
1269 1325 | }
|
1270 1326 | }
|
1271 1327 | }
|
1328 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
1272 1329 | impl
|
1273 1330 | ::aws_smithy_http_server::response::IntoResponse<
|
1274 1331 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1275 1332 | > for crate::output::TestGetNoInputNoPayloadOutput
|
1276 1333 | {
|
1277 1334 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1278 1335 | match crate::protocol_serde::shape_test_get_no_input_no_payload::ser_test_get_no_input_no_payload_http_response(self) {
|
1279 1336 | Ok(response) => response,
|
1280 1337 | Err(e) => {
|
1281 1338 | ::tracing::error!(error = %e, "failed to serialize response");
|
1282 1339 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
1283 1340 | }
|
1284 1341 | }
|
1285 1342 | }
|
1286 1343 | }
|
1287 1344 |
|
1345 + | /* RustType.kt:534 */
|
1288 1346 | #[allow(unreachable_code, unused_variables)]
|
1347 + | /* RustType.kt:534 */
|
1289 1348 | #[cfg(test)]
|
1349 + | /* ProtocolTestGenerator.kt:98 */
|
1290 1350 | mod test_get_no_input_no_payload_test {
|
1291 1351 |
|
1292 1352 | /// Serializes a GET request for an operation with no input, and therefore no modeled body
|
1293 1353 | /// Test ID: RestJsonHttpGetWithNoInput
|
1294 1354 | #[::tokio::test]
|
1295 1355 | #[::tracing_test::traced_test]
|
1296 1356 | async fn rest_json_http_get_with_no_input_request() {
|
1297 1357 | #[allow(unused_mut)]
|
1298 - | let mut http_request = http::Request::builder()
|
1358 + | let mut http_request = ::http_1x::Request::builder()
|
1299 1359 | .uri("/no_input_no_payload")
|
1300 1360 | .method("GET")
|
1301 - | .body(::aws_smithy_http_server::body::Body::from(
|
1302 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1303 - | "".as_bytes(),
|
1304 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1361 + | .body(::aws_smithy_http_server::body::boxed(
|
1362 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1363 + | &::aws_smithy_protocol_test::decode_body_data(
|
1364 + | "".as_bytes(),
|
1365 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1366 + | ),
|
1305 1367 | )),
|
1306 1368 | ))
|
1307 1369 | .unwrap();
|
1308 1370 | #[allow(unused_mut)]
|
1309 1371 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1310 1372 | let config = crate::service::RestJsonConfig::builder().build();
|
1311 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
1312 - | .test_get_no_input_no_payload(
|
1313 - | move |input: crate::input::TestGetNoInputNoPayloadInput| {
|
1314 - | let sender = sender.clone();
|
1315 - | async move {
|
1316 - | let result = {
|
1317 - | let expected = crate::input::TestGetNoInputNoPayloadInput {};
|
1318 - | ::pretty_assertions::assert_eq!(input, expected);
|
1319 - | let output = crate::output::TestGetNoInputNoPayloadOutput {
|
1320 - | test_id: ::std::option::Option::None,
|
1321 - | };
|
1322 - | output
|
1323 - | };
|
1324 - | sender.send(()).await.expect("receiver dropped early");
|
1325 - | result
|
1326 - | }
|
1327 - | },
|
1328 - | )
|
1329 - | .build_unchecked();
|
1373 + | let service = crate::service::RestJson::builder::<
|
1374 + | ::aws_smithy_http_server::body::BoxBody,
|
1375 + | _,
|
1376 + | _,
|
1377 + | _,
|
1378 + | >(config)
|
1379 + | .test_get_no_input_no_payload(move |input: crate::input::TestGetNoInputNoPayloadInput| {
|
1380 + | let sender = sender.clone();
|
1381 + | async move {
|
1382 + | let result = {
|
1383 + | let expected = crate::input::TestGetNoInputNoPayloadInput {};
|
1384 + | ::pretty_assertions::assert_eq!(input, expected);
|
1385 + | let output = crate::output::TestGetNoInputNoPayloadOutput {
|
1386 + | test_id: ::std::option::Option::None,
|
1387 + | };
|
1388 + | output
|
1389 + | };
|
1390 + | sender.send(()).await.expect("receiver dropped early");
|
1391 + | result
|
1392 + | }
|
1393 + | })
|
1394 + | .build_unchecked();
|
1330 1395 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1331 1396 | .await
|
1332 1397 | .expect("unable to make an HTTP request");
|
1333 1398 | assert!(
|
1334 1399 | receiver.recv().await.is_some(),
|
1335 1400 | "we expected operation handler to be invoked but it was not entered"
|
1336 1401 | );
|
1337 1402 | }
|
1403 + |
|
1404 + | /* ProtocolTestGenerator.kt:98 */
|
1338 1405 | }
|
1339 1406 |
|
1407 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
1340 1408 | ::pin_project_lite::pin_project! {
|
1341 1409 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1342 1410 | /// [`TestPostNoPayloadInput`](crate::input::TestPostNoPayloadInput) using modelled bindings.
|
1343 1411 | pub struct TestPostNoPayloadInputFuture {
|
1344 1412 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::TestPostNoPayloadInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
1345 1413 | }
|
1346 1414 | }
|
1347 1415 |
|
1348 1416 | impl std::future::Future for TestPostNoPayloadInputFuture {
|
1349 1417 | type Output = Result<
|
1350 1418 | crate::input::TestPostNoPayloadInput,
|
1351 1419 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
1352 1420 | >;
|
1353 1421 |
|
1354 1422 | fn poll(
|
1355 1423 | self: std::pin::Pin<&mut Self>,
|
1356 1424 | cx: &mut std::task::Context<'_>,
|
1357 1425 | ) -> std::task::Poll<Self::Output> {
|
1358 1426 | let this = self.project();
|
1359 1427 | this.inner.as_mut().poll(cx)
|
1360 1428 | }
|
1361 1429 | }
|
1362 1430 |
|
1363 1431 | impl<B>
|
1364 1432 | ::aws_smithy_http_server::request::FromRequest<
|
1365 1433 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1366 1434 | B,
|
1367 1435 | > for crate::input::TestPostNoPayloadInput
|
1368 1436 | where
|
1369 1437 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1370 1438 | B: 'static,
|
1371 1439 |
|
1372 1440 | B::Data: Send,
|
1373 1441 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
1374 1442 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1375 1443 | {
|
1376 1444 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
1377 1445 | type Future = TestPostNoPayloadInputFuture;
|
1378 1446 |
|
1379 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1447 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
1380 1448 | let fut = async move {
|
1381 1449 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
1382 1450 | request.headers(),
|
1383 1451 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
1384 1452 | ) {
|
1385 1453 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
1386 1454 | }
|
1387 1455 | crate::protocol_serde::shape_test_post_no_payload::de_test_post_no_payload_http_request(
|
1388 1456 | request,
|
1389 1457 | )
|
1390 1458 | .await
|
1391 1459 | };
|
1392 1460 | use ::futures_util::future::TryFutureExt;
|
1393 1461 | let fut = fut.map_err(
|
1394 1462 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
1395 1463 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1396 1464 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
1397 1465 | e,
|
1398 1466 | )
|
1399 1467 | },
|
1400 1468 | );
|
1401 1469 | TestPostNoPayloadInputFuture {
|
1402 1470 | inner: Box::pin(fut),
|
1403 1471 | }
|
1404 1472 | }
|
1405 1473 | }
|
1474 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
1406 1475 | impl
|
1407 1476 | ::aws_smithy_http_server::response::IntoResponse<
|
1408 1477 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1409 1478 | > for crate::output::TestPostNoPayloadOutput
|
1410 1479 | {
|
1411 1480 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1412 1481 | match crate::protocol_serde::shape_test_post_no_payload::ser_test_post_no_payload_http_response(self) {
|
1413 1482 | Ok(response) => response,
|
1414 1483 | Err(e) => {
|
1415 1484 | ::tracing::error!(error = %e, "failed to serialize response");
|
1416 1485 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
1417 1486 | }
|
1418 1487 | }
|
1419 1488 | }
|
1420 1489 | }
|
1421 1490 |
|
1491 + | /* RustType.kt:534 */
|
1422 1492 | #[allow(unreachable_code, unused_variables)]
|
1493 + | /* RustType.kt:534 */
|
1423 1494 | #[cfg(test)]
|
1495 + | /* ProtocolTestGenerator.kt:98 */
|
1424 1496 | mod test_post_no_payload_test {
|
1425 1497 |
|
1426 1498 | /// Serializes a POST request with no modeled body
|
1427 1499 | /// Test ID: RestJsonHttpPostWithNoModeledBody
|
1428 1500 | #[::tokio::test]
|
1429 1501 | #[::tracing_test::traced_test]
|
1430 1502 | async fn rest_json_http_post_with_no_modeled_body_request() {
|
1431 1503 | #[allow(unused_mut)]
|
1432 - | let mut http_request = http::Request::builder()
|
1504 + | let mut http_request = ::http_1x::Request::builder()
|
1433 1505 | .uri("/no_payload")
|
1434 1506 | .method("POST")
|
1435 - | .body(::aws_smithy_http_server::body::Body::from(
|
1436 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1437 - | "".as_bytes(),
|
1438 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1507 + | .body(::aws_smithy_http_server::body::boxed(
|
1508 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1509 + | &::aws_smithy_protocol_test::decode_body_data(
|
1510 + | "".as_bytes(),
|
1511 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1512 + | ),
|
1439 1513 | )),
|
1440 1514 | ))
|
1441 1515 | .unwrap();
|
1442 1516 | #[allow(unused_mut)]
|
1443 1517 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1444 1518 | let config = crate::service::RestJsonConfig::builder().build();
|
1445 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
1519 + | let service =
|
1520 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
1521 + | config,
|
1522 + | )
|
1446 1523 | .test_post_no_payload(move |input: crate::input::TestPostNoPayloadInput| {
|
1447 1524 | let sender = sender.clone();
|
1448 1525 | async move {
|
1449 1526 | let result = {
|
1450 1527 | let expected = crate::input::TestPostNoPayloadInput {
|
1451 1528 | test_id: ::std::option::Option::None,
|
1452 1529 | };
|
1453 1530 | ::pretty_assertions::assert_eq!(input, expected);
|
1454 1531 | let output = crate::output::TestPostNoPayloadOutput {
|
1455 1532 | test_id: ::std::option::Option::None,
|
1456 1533 | };
|
1457 1534 | output
|
1458 1535 | };
|
1459 1536 | sender.send(()).await.expect("receiver dropped early");
|
1460 1537 | result
|
1461 1538 | }
|
1462 1539 | })
|
1463 1540 | .build_unchecked();
|
1464 1541 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1465 1542 | .await
|
1466 1543 | .expect("unable to make an HTTP request");
|
1467 1544 | assert!(
|
1468 1545 | receiver.recv().await.is_some(),
|
1469 1546 | "we expected operation handler to be invoked but it was not entered"
|
1470 1547 | );
|
1471 1548 | }
|
1472 1549 |
|
1473 1550 | /// Serializes a POST request with header member but no modeled body
|
1474 1551 | /// Test ID: RestJsonHttpWithPostHeaderMemberNoModeledBody
|
1475 1552 | #[::tokio::test]
|
1476 1553 | #[::tracing_test::traced_test]
|
1477 1554 | async fn rest_json_http_with_post_header_member_no_modeled_body_request() {
|
1478 1555 | #[allow(unused_mut)]
|
1479 - | let mut http_request = http::Request::builder()
|
1556 + | let mut http_request = ::http_1x::Request::builder()
|
1480 1557 | .uri("/no_payload")
|
1481 1558 | .method("POST")
|
1482 1559 | .header("X-Amz-Test-Id", "t-12345")
|
1483 - | .body(::aws_smithy_http_server::body::Body::from(
|
1484 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1485 - | "".as_bytes(),
|
1486 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1560 + | .body(::aws_smithy_http_server::body::boxed(
|
1561 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1562 + | &::aws_smithy_protocol_test::decode_body_data(
|
1563 + | "".as_bytes(),
|
1564 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1565 + | ),
|
1487 1566 | )),
|
1488 1567 | ))
|
1489 1568 | .unwrap();
|
1490 1569 | #[allow(unused_mut)]
|
1491 1570 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1492 1571 | let config = crate::service::RestJsonConfig::builder().build();
|
1493 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
1572 + | let service =
|
1573 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
1574 + | config,
|
1575 + | )
|
1494 1576 | .test_post_no_payload(move |input: crate::input::TestPostNoPayloadInput| {
|
1495 1577 | let sender = sender.clone();
|
1496 1578 | async move {
|
1497 1579 | let result = {
|
1498 1580 | let expected = crate::input::TestPostNoPayloadInput {
|
1499 1581 | test_id: ::std::option::Option::Some("t-12345".to_owned()),
|
1500 1582 | };
|
1501 1583 | ::pretty_assertions::assert_eq!(input, expected);
|
1502 1584 | let output = crate::output::TestPostNoPayloadOutput {
|
1503 1585 | test_id: ::std::option::Option::None,
|
1504 1586 | };
|
1505 1587 | output
|
1506 1588 | };
|
1507 1589 | sender.send(()).await.expect("receiver dropped early");
|
1508 1590 | result
|
1509 1591 | }
|
1510 1592 | })
|
1511 1593 | .build_unchecked();
|
1512 1594 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1513 1595 | .await
|
1514 1596 | .expect("unable to make an HTTP request");
|
1515 1597 | assert!(
|
1516 1598 | receiver.recv().await.is_some(),
|
1517 1599 | "we expected operation handler to be invoked but it was not entered"
|
1518 1600 | );
|
1519 1601 | }
|
1602 + |
|
1603 + | /* ProtocolTestGenerator.kt:98 */
|
1520 1604 | }
|
1521 1605 |
|
1606 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
1522 1607 | ::pin_project_lite::pin_project! {
|
1523 1608 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1524 1609 | /// [`TestGetNoPayloadInput`](crate::input::TestGetNoPayloadInput) using modelled bindings.
|
1525 1610 | pub struct TestGetNoPayloadInputFuture {
|
1526 1611 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::TestGetNoPayloadInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
1527 1612 | }
|
1528 1613 | }
|
1529 1614 |
|
1530 1615 | impl std::future::Future for TestGetNoPayloadInputFuture {
|
1531 1616 | type Output = Result<
|
1532 1617 | crate::input::TestGetNoPayloadInput,
|
1533 1618 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
1534 1619 | >;
|
1535 1620 |
|
1536 1621 | fn poll(
|
1537 1622 | self: std::pin::Pin<&mut Self>,
|
1538 1623 | cx: &mut std::task::Context<'_>,
|
1539 1624 | ) -> std::task::Poll<Self::Output> {
|
1540 1625 | let this = self.project();
|
1541 1626 | this.inner.as_mut().poll(cx)
|
1542 1627 | }
|
1543 1628 | }
|
1544 1629 |
|
1545 1630 | impl<B>
|
1546 1631 | ::aws_smithy_http_server::request::FromRequest<
|
1547 1632 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1548 1633 | B,
|
1549 1634 | > for crate::input::TestGetNoPayloadInput
|
1550 1635 | where
|
1551 1636 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1552 1637 | B: 'static,
|
1553 1638 |
|
1554 1639 | B::Data: Send,
|
1555 1640 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
1556 1641 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1557 1642 | {
|
1558 1643 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
1559 1644 | type Future = TestGetNoPayloadInputFuture;
|
1560 1645 |
|
1561 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1646 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
1562 1647 | let fut = async move {
|
1563 1648 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
1564 1649 | request.headers(),
|
1565 1650 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
1566 1651 | ) {
|
1567 1652 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
1568 1653 | }
|
1569 1654 | crate::protocol_serde::shape_test_get_no_payload::de_test_get_no_payload_http_request(
|
1570 1655 | request,
|
1571 1656 | )
|
1572 1657 | .await
|
1573 1658 | };
|
1574 1659 | use ::futures_util::future::TryFutureExt;
|
1575 1660 | let fut = fut.map_err(
|
1576 1661 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
1577 1662 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1578 1663 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
1579 1664 | e,
|
1580 1665 | )
|
1581 1666 | },
|
1582 1667 | );
|
1583 1668 | TestGetNoPayloadInputFuture {
|
1584 1669 | inner: Box::pin(fut),
|
1585 1670 | }
|
1586 1671 | }
|
1587 1672 | }
|
1673 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
1588 1674 | impl
|
1589 1675 | ::aws_smithy_http_server::response::IntoResponse<
|
1590 1676 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1591 1677 | > for crate::output::TestGetNoPayloadOutput
|
1592 1678 | {
|
1593 1679 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1594 1680 | match crate::protocol_serde::shape_test_get_no_payload::ser_test_get_no_payload_http_response(self) {
|
1595 1681 | Ok(response) => response,
|
1596 1682 | Err(e) => {
|
1597 1683 | ::tracing::error!(error = %e, "failed to serialize response");
|
1598 1684 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
1599 1685 | }
|
1600 1686 | }
|
1601 1687 | }
|
1602 1688 | }
|
1603 1689 |
|
1690 + | /* RustType.kt:534 */
|
1604 1691 | #[allow(unreachable_code, unused_variables)]
|
1692 + | /* RustType.kt:534 */
|
1605 1693 | #[cfg(test)]
|
1694 + | /* ProtocolTestGenerator.kt:98 */
|
1606 1695 | mod test_get_no_payload_test {
|
1607 1696 |
|
1608 1697 | /// Serializes a GET request with no modeled body
|
1609 1698 | /// Test ID: RestJsonHttpGetWithNoModeledBody
|
1610 1699 | #[::tokio::test]
|
1611 1700 | #[::tracing_test::traced_test]
|
1612 1701 | async fn rest_json_http_get_with_no_modeled_body_request() {
|
1613 1702 | #[allow(unused_mut)]
|
1614 - | let mut http_request = http::Request::builder()
|
1703 + | let mut http_request = ::http_1x::Request::builder()
|
1615 1704 | .uri("/no_payload")
|
1616 1705 | .method("GET")
|
1617 - | .body(::aws_smithy_http_server::body::Body::from(
|
1618 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1619 - | "".as_bytes(),
|
1620 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1706 + | .body(::aws_smithy_http_server::body::boxed(
|
1707 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1708 + | &::aws_smithy_protocol_test::decode_body_data(
|
1709 + | "".as_bytes(),
|
1710 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1711 + | ),
|
1621 1712 | )),
|
1622 1713 | ))
|
1623 1714 | .unwrap();
|
1624 1715 | #[allow(unused_mut)]
|
1625 1716 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1626 1717 | let config = crate::service::RestJsonConfig::builder().build();
|
1627 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
1718 + | let service =
|
1719 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
1720 + | config,
|
1721 + | )
|
1628 1722 | .test_get_no_payload(move |input: crate::input::TestGetNoPayloadInput| {
|
1629 1723 | let sender = sender.clone();
|
1630 1724 | async move {
|
1631 1725 | let result = {
|
1632 1726 | let expected = crate::input::TestGetNoPayloadInput {
|
1633 1727 | test_id: ::std::option::Option::None,
|
1634 1728 | };
|
1635 1729 | ::pretty_assertions::assert_eq!(input, expected);
|
1636 1730 | let output = crate::output::TestGetNoPayloadOutput {
|
1637 1731 | test_id: ::std::option::Option::None,
|
1638 1732 | };
|
1639 1733 | output
|
1640 1734 | };
|
1641 1735 | sender.send(()).await.expect("receiver dropped early");
|
1642 1736 | result
|
1643 1737 | }
|
1644 1738 | })
|
1645 1739 | .build_unchecked();
|
1646 1740 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1647 1741 | .await
|
1648 1742 | .expect("unable to make an HTTP request");
|
1649 1743 | assert!(
|
1650 1744 | receiver.recv().await.is_some(),
|
1651 1745 | "we expected operation handler to be invoked but it was not entered"
|
1652 1746 | );
|
1653 1747 | }
|
1654 1748 |
|
1655 1749 | /// Serializes a GET request with header member but no modeled body
|
1656 1750 | /// Test ID: RestJsonHttpGetWithHeaderMemberNoModeledBody
|
1657 1751 | #[::tokio::test]
|
1658 1752 | #[::tracing_test::traced_test]
|
1659 1753 | async fn rest_json_http_get_with_header_member_no_modeled_body_request() {
|
1660 1754 | #[allow(unused_mut)]
|
1661 - | let mut http_request = http::Request::builder()
|
1755 + | let mut http_request = ::http_1x::Request::builder()
|
1662 1756 | .uri("/no_payload")
|
1663 1757 | .method("GET")
|
1664 1758 | .header("X-Amz-Test-Id", "t-12345")
|
1665 - | .body(::aws_smithy_http_server::body::Body::from(
|
1666 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1667 - | "".as_bytes(),
|
1668 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1759 + | .body(::aws_smithy_http_server::body::boxed(
|
1760 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1761 + | &::aws_smithy_protocol_test::decode_body_data(
|
1762 + | "".as_bytes(),
|
1763 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
1764 + | ),
|
1669 1765 | )),
|
1670 1766 | ))
|
1671 1767 | .unwrap();
|
1672 1768 | #[allow(unused_mut)]
|
1673 1769 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1674 1770 | let config = crate::service::RestJsonConfig::builder().build();
|
1675 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
1771 + | let service =
|
1772 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
1773 + | config,
|
1774 + | )
|
1676 1775 | .test_get_no_payload(move |input: crate::input::TestGetNoPayloadInput| {
|
1677 1776 | let sender = sender.clone();
|
1678 1777 | async move {
|
1679 1778 | let result = {
|
1680 1779 | let expected = crate::input::TestGetNoPayloadInput {
|
1681 1780 | test_id: ::std::option::Option::Some("t-12345".to_owned()),
|
1682 1781 | };
|
1683 1782 | ::pretty_assertions::assert_eq!(input, expected);
|
1684 1783 | let output = crate::output::TestGetNoPayloadOutput {
|
1685 1784 | test_id: ::std::option::Option::None,
|
1686 1785 | };
|
1687 1786 | output
|
1688 1787 | };
|
1689 1788 | sender.send(()).await.expect("receiver dropped early");
|
1690 1789 | result
|
1691 1790 | }
|
1692 1791 | })
|
1693 1792 | .build_unchecked();
|
1694 1793 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1695 1794 | .await
|
1696 1795 | .expect("unable to make an HTTP request");
|
1697 1796 | assert!(
|
1698 1797 | receiver.recv().await.is_some(),
|
1699 1798 | "we expected operation handler to be invoked but it was not entered"
|
1700 1799 | );
|
1701 1800 | }
|
1801 + |
|
1802 + | /* ProtocolTestGenerator.kt:98 */
|
1702 1803 | }
|
1703 1804 |
|
1805 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
1704 1806 | ::pin_project_lite::pin_project! {
|
1705 1807 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1706 1808 | /// [`TestPayloadBlobInput`](crate::input::TestPayloadBlobInput) using modelled bindings.
|
1707 1809 | pub struct TestPayloadBlobInputFuture {
|
1708 1810 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::TestPayloadBlobInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
1709 1811 | }
|
1710 1812 | }
|
1711 1813 |
|
1712 1814 | impl std::future::Future for TestPayloadBlobInputFuture {
|
1713 1815 | type Output = Result<
|
1714 1816 | crate::input::TestPayloadBlobInput,
|
1715 1817 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
1716 1818 | >;
|
1717 1819 |
|
1718 1820 | fn poll(
|
1719 1821 | self: std::pin::Pin<&mut Self>,
|
1720 1822 | cx: &mut std::task::Context<'_>,
|
1721 1823 | ) -> std::task::Poll<Self::Output> {
|
1722 1824 | let this = self.project();
|
1723 1825 | this.inner.as_mut().poll(cx)
|
1724 1826 | }
|
1725 1827 | }
|
1726 1828 |
|
1727 1829 | impl<B>
|
1728 1830 | ::aws_smithy_http_server::request::FromRequest<
|
1729 1831 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1730 1832 | B,
|
1731 1833 | > for crate::input::TestPayloadBlobInput
|
1732 1834 | where
|
1733 1835 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1734 1836 | B: 'static,
|
1735 1837 |
|
1736 1838 | B::Data: Send,
|
1737 1839 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
1738 1840 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1739 1841 | {
|
1740 1842 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
1741 1843 | type Future = TestPayloadBlobInputFuture;
|
1742 1844 |
|
1743 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1845 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
1744 1846 | let fut = async move {
|
1745 1847 | crate::protocol_serde::shape_test_payload_blob::de_test_payload_blob_http_request(
|
1746 1848 | request,
|
1747 1849 | )
|
1748 1850 | .await
|
1749 1851 | };
|
1750 1852 | use ::futures_util::future::TryFutureExt;
|
1751 1853 | let fut = fut.map_err(
|
1752 1854 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
1753 1855 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1754 1856 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
1755 1857 | e,
|
1756 1858 | )
|
1757 1859 | },
|
1758 1860 | );
|
1759 1861 | TestPayloadBlobInputFuture {
|
1760 1862 | inner: Box::pin(fut),
|
1761 1863 | }
|
1762 1864 | }
|
1763 1865 | }
|
1866 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
1764 1867 | impl
|
1765 1868 | ::aws_smithy_http_server::response::IntoResponse<
|
1766 1869 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1767 1870 | > for crate::output::TestPayloadBlobOutput
|
1768 1871 | {
|
1769 1872 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1770 1873 | match crate::protocol_serde::shape_test_payload_blob::ser_test_payload_blob_http_response(
|
1771 1874 | self,
|
1772 1875 | ) {
|
1773 1876 | Ok(response) => response,
|
1774 1877 | Err(e) => {
|
1775 1878 | ::tracing::error!(error = %e, "failed to serialize response");
|
1776 1879 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
1777 1880 | }
|
1778 1881 | }
|
1779 1882 | }
|
1780 1883 | }
|
1781 1884 |
|
1885 + | /* RustType.kt:534 */
|
1782 1886 | #[allow(unreachable_code, unused_variables)]
|
1887 + | /* RustType.kt:534 */
|
1783 1888 | #[cfg(test)]
|
1889 + | /* ProtocolTestGenerator.kt:98 */
|
1784 1890 | mod test_payload_blob_test {
|
1785 1891 |
|
1786 1892 | /// Serializes a payload targeting an empty blob
|
1787 1893 | /// Test ID: RestJsonHttpWithEmptyBlobPayload
|
1788 1894 | #[::tokio::test]
|
1789 1895 | #[::tracing_test::traced_test]
|
1790 1896 | async fn rest_json_http_with_empty_blob_payload_request() {
|
1791 1897 | #[allow(unused_mut)]
|
1792 - | let mut http_request = http::Request::builder()
|
1898 + | let mut http_request = ::http_1x::Request::builder()
|
1793 1899 | .uri("/blob_payload")
|
1794 1900 | .method("POST")
|
1795 - | .body(::aws_smithy_http_server::body::Body::from(
|
1796 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1797 - | "".as_bytes(),
|
1798 - | ::aws_smithy_protocol_test::MediaType::from("application/octet-stream"),
|
1901 + | .body(::aws_smithy_http_server::body::boxed(
|
1902 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1903 + | &::aws_smithy_protocol_test::decode_body_data(
|
1904 + | "".as_bytes(),
|
1905 + | ::aws_smithy_protocol_test::MediaType::from("application/octet-stream"),
|
1906 + | ),
|
1799 1907 | )),
|
1800 1908 | ))
|
1801 1909 | .unwrap();
|
1802 1910 | #[allow(unused_mut)]
|
1803 1911 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1804 1912 | let config = crate::service::RestJsonConfig::builder().build();
|
1805 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
1913 + | let service =
|
1914 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
1915 + | config,
|
1916 + | )
|
1806 1917 | .test_payload_blob(move |input: crate::input::TestPayloadBlobInput| {
|
1807 1918 | let sender = sender.clone();
|
1808 1919 | async move {
|
1809 1920 | let result = {
|
1810 1921 | let expected = crate::input::TestPayloadBlobInput {
|
1811 1922 | content_type: ::std::option::Option::None,
|
1812 1923 | data: ::std::option::Option::None,
|
1813 1924 | };
|
1814 1925 | ::pretty_assertions::assert_eq!(input, expected);
|
1815 1926 | let output = crate::output::TestPayloadBlobOutput {
|
1816 1927 | content_type: ::std::option::Option::None,
|
1817 1928 | data: ::std::option::Option::None,
|
1818 1929 | };
|
1819 1930 | output
|
1820 1931 | };
|
1821 1932 | sender.send(()).await.expect("receiver dropped early");
|
1822 1933 | result
|
1823 1934 | }
|
1824 1935 | })
|
1825 1936 | .build_unchecked();
|
1826 1937 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1827 1938 | .await
|
1828 1939 | .expect("unable to make an HTTP request");
|
1829 1940 | assert!(
|
1830 1941 | receiver.recv().await.is_some(),
|
1831 1942 | "we expected operation handler to be invoked but it was not entered"
|
1832 1943 | );
|
1833 1944 | }
|
1834 1945 |
|
1835 1946 | /// Serializes a payload targeting a blob
|
1836 1947 | /// Test ID: RestJsonTestPayloadBlob
|
1837 1948 | #[::tokio::test]
|
1838 1949 | #[::tracing_test::traced_test]
|
1839 1950 | async fn rest_json_test_payload_blob_request() {
|
1840 1951 | #[allow(unused_mut)]
|
1841 - | let mut http_request = http::Request::builder()
|
1952 + | let mut http_request = ::http_1x::Request::builder()
|
1842 1953 | .uri("/blob_payload")
|
1843 1954 | .method("POST")
|
1844 1955 | .header("Content-Type", "image/jpg")
|
1845 - | .body(::aws_smithy_http_server::body::Body::from(
|
1846 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1847 - | "1234".as_bytes(),
|
1848 - | ::aws_smithy_protocol_test::MediaType::from("image/jpg"),
|
1956 + | .body(::aws_smithy_http_server::body::boxed(
|
1957 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1958 + | &::aws_smithy_protocol_test::decode_body_data(
|
1959 + | "1234".as_bytes(),
|
1960 + | ::aws_smithy_protocol_test::MediaType::from("image/jpg"),
|
1961 + | ),
|
1849 1962 | )),
|
1850 1963 | ))
|
1851 1964 | .unwrap();
|
1852 1965 | #[allow(unused_mut)]
|
1853 1966 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1854 1967 | let config = crate::service::RestJsonConfig::builder().build();
|
1855 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
1856 - | .test_payload_blob(move |input: crate::input::TestPayloadBlobInput| {
|
1857 - | let sender = sender.clone();
|
1858 - | async move {
|
1859 - | let result = {
|
1860 - | let expected = crate::input::TestPayloadBlobInput {
|
1861 - | content_type: ::std::option::Option::Some("image/jpg".to_owned()),
|
1862 - | data: ::std::option::Option::Some(::aws_smithy_types::Blob::new(
|
1863 - | "1234",
|
1864 - | )),
|
1865 - | };
|
1866 - | ::pretty_assertions::assert_eq!(input, expected);
|
1867 - | let output = crate::output::TestPayloadBlobOutput {
|
1868 - | content_type: ::std::option::Option::None,
|
1869 - | data: ::std::option::Option::None,
|
1870 - | };
|
1871 - | output
|
1968 + | let service = crate::service::RestJson::builder::<
|
1969 + | ::aws_smithy_http_server::body::BoxBody,
|
1970 + | _,
|
1971 + | _,
|
1972 + | _,
|
1973 + | >(config)
|
1974 + | .test_payload_blob(move |input: crate::input::TestPayloadBlobInput| {
|
1975 + | let sender = sender.clone();
|
1976 + | async move {
|
1977 + | let result = {
|
1978 + | let expected = crate::input::TestPayloadBlobInput {
|
1979 + | content_type: ::std::option::Option::Some("image/jpg".to_owned()),
|
1980 + | data: ::std::option::Option::Some(::aws_smithy_types::Blob::new("1234")),
|
1872 1981 | };
|
1873 - | sender.send(()).await.expect("receiver dropped early");
|
1874 - | result
|
1875 - | }
|
1876 - | })
|
1877 - | .build_unchecked();
|
1982 + | ::pretty_assertions::assert_eq!(input, expected);
|
1983 + | let output = crate::output::TestPayloadBlobOutput {
|
1984 + | content_type: ::std::option::Option::None,
|
1985 + | data: ::std::option::Option::None,
|
1986 + | };
|
1987 + | output
|
1988 + | };
|
1989 + | sender.send(()).await.expect("receiver dropped early");
|
1990 + | result
|
1991 + | }
|
1992 + | })
|
1993 + | .build_unchecked();
|
1878 1994 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1879 1995 | .await
|
1880 1996 | .expect("unable to make an HTTP request");
|
1881 1997 | assert!(
|
1882 1998 | receiver.recv().await.is_some(),
|
1883 1999 | "we expected operation handler to be invoked but it was not entered"
|
1884 2000 | );
|
1885 2001 | }
|
2002 + |
|
2003 + | /* ProtocolTestGenerator.kt:98 */
|
1886 2004 | }
|
1887 2005 |
|
2006 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
1888 2007 | ::pin_project_lite::pin_project! {
|
1889 2008 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1890 2009 | /// [`TestPayloadStructureInput`](crate::input::TestPayloadStructureInput) using modelled bindings.
|
1891 2010 | pub struct TestPayloadStructureInputFuture {
|
1892 2011 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::TestPayloadStructureInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
1893 2012 | }
|
1894 2013 | }
|
1895 2014 |
|
1896 2015 | impl std::future::Future for TestPayloadStructureInputFuture {
|
1897 2016 | type Output = Result<
|
1898 2017 | crate::input::TestPayloadStructureInput,
|
1899 2018 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
1900 2019 | >;
|
1901 2020 |
|
1902 2021 | fn poll(
|
1903 2022 | self: std::pin::Pin<&mut Self>,
|
1904 2023 | cx: &mut std::task::Context<'_>,
|
1905 2024 | ) -> std::task::Poll<Self::Output> {
|
1906 2025 | let this = self.project();
|
1907 2026 | this.inner.as_mut().poll(cx)
|
1908 2027 | }
|
1909 2028 | }
|
1910 2029 |
|
1911 2030 | impl<B>
|
1912 2031 | ::aws_smithy_http_server::request::FromRequest<
|
1913 2032 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1914 2033 | B,
|
1915 2034 | > for crate::input::TestPayloadStructureInput
|
1916 2035 | where
|
1917 2036 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1918 2037 | B: 'static,
|
1919 2038 |
|
1920 2039 | B::Data: Send,
|
1921 2040 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
1922 2041 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1923 2042 | {
|
1924 2043 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
1925 2044 | type Future = TestPayloadStructureInputFuture;
|
1926 2045 |
|
1927 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2046 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
1928 2047 | let fut = async move {
|
1929 2048 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
1930 2049 | request.headers(),
|
1931 2050 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
1932 2051 | ) {
|
1933 2052 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
1934 2053 | }
|
1935 2054 | crate::protocol_serde::shape_test_payload_structure::de_test_payload_structure_http_request(request)
|
1936 2055 | .await
|
1937 2056 | };
|
1938 2057 | use ::futures_util::future::TryFutureExt;
|
1939 2058 | let fut = fut.map_err(
|
1940 2059 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
1941 2060 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1942 2061 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
1943 2062 | e,
|
1944 2063 | )
|
1945 2064 | },
|
1946 2065 | );
|
1947 2066 | TestPayloadStructureInputFuture {
|
1948 2067 | inner: Box::pin(fut),
|
1949 2068 | }
|
1950 2069 | }
|
1951 2070 | }
|
2071 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
1952 2072 | impl
|
1953 2073 | ::aws_smithy_http_server::response::IntoResponse<
|
1954 2074 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
1955 2075 | > for crate::output::TestPayloadStructureOutput
|
1956 2076 | {
|
1957 2077 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1958 2078 | match crate::protocol_serde::shape_test_payload_structure::ser_test_payload_structure_http_response(self) {
|
1959 2079 | Ok(response) => response,
|
1960 2080 | Err(e) => {
|
1961 2081 | ::tracing::error!(error = %e, "failed to serialize response");
|
1962 2082 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
1963 2083 | }
|
1964 2084 | }
|
1965 2085 | }
|
1966 2086 | }
|
1967 2087 |
|
2088 + | /* RustType.kt:534 */
|
1968 2089 | #[allow(unreachable_code, unused_variables)]
|
2090 + | /* RustType.kt:534 */
|
1969 2091 | #[cfg(test)]
|
2092 + | /* ProtocolTestGenerator.kt:98 */
|
1970 2093 | mod test_payload_structure_test {
|
1971 2094 |
|
1972 2095 | /// Serializes a payload targeting an empty structure
|
1973 2096 | /// Test ID: RestJsonHttpWithEmptyStructurePayload
|
1974 2097 | #[::tokio::test]
|
1975 2098 | #[::tracing_test::traced_test]
|
1976 2099 | async fn rest_json_http_with_empty_structure_payload_request() {
|
1977 2100 | #[allow(unused_mut)]
|
1978 - | let mut http_request = http::Request::builder()
|
2101 + | let mut http_request = ::http_1x::Request::builder()
|
1979 2102 | .uri("/payload")
|
1980 2103 | .method("POST")
|
1981 2104 | .header("Content-Type", "application/json")
|
1982 - | .body(::aws_smithy_http_server::body::Body::from(
|
1983 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1984 - | "{}".as_bytes(),
|
1985 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2105 + | .body(::aws_smithy_http_server::body::boxed(
|
2106 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2107 + | &::aws_smithy_protocol_test::decode_body_data(
|
2108 + | "{}".as_bytes(),
|
2109 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2110 + | ),
|
1986 2111 | )),
|
1987 2112 | ))
|
1988 2113 | .unwrap();
|
1989 2114 | #[allow(unused_mut)]
|
1990 2115 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1991 2116 | let config = crate::service::RestJsonConfig::builder().build();
|
1992 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
1993 - | .test_payload_structure(move |input: crate::input::TestPayloadStructureInput| {
|
1994 - | let sender = sender.clone();
|
1995 - | async move {
|
1996 - | let result = {
|
1997 - | let expected = crate::input::TestPayloadStructureInput {
|
1998 - | payload_config: ::std::option::Option::Some(
|
1999 - | crate::model::PayloadConfig {
|
2000 - | data: ::std::option::Option::None,
|
2001 - | },
|
2002 - | ),
|
2003 - | test_id: ::std::option::Option::None,
|
2004 - | };
|
2005 - | ::pretty_assertions::assert_eq!(input, expected);
|
2006 - | let output = crate::output::TestPayloadStructureOutput {
|
2007 - | payload_config: ::std::option::Option::Some(
|
2008 - | crate::model::PayloadConfig {
|
2009 - | data: ::std::option::Option::None,
|
2010 - | },
|
2011 - | ),
|
2012 - | test_id: ::std::option::Option::None,
|
2013 - | };
|
2014 - | output
|
2117 + | let service = crate::service::RestJson::builder::<
|
2118 + | ::aws_smithy_http_server::body::BoxBody,
|
2119 + | _,
|
2120 + | _,
|
2121 + | _,
|
2122 + | >(config)
|
2123 + | .test_payload_structure(move |input: crate::input::TestPayloadStructureInput| {
|
2124 + | let sender = sender.clone();
|
2125 + | async move {
|
2126 + | let result = {
|
2127 + | let expected = crate::input::TestPayloadStructureInput {
|
2128 + | payload_config: ::std::option::Option::Some(crate::model::PayloadConfig {
|
2129 + | data: ::std::option::Option::None,
|
2130 + | }),
|
2131 + | test_id: ::std::option::Option::None,
|
2015 2132 | };
|
2016 - | sender.send(()).await.expect("receiver dropped early");
|
2017 - | result
|
2018 - | }
|
2019 - | })
|
2020 - | .build_unchecked();
|
2133 + | ::pretty_assertions::assert_eq!(input, expected);
|
2134 + | let output = crate::output::TestPayloadStructureOutput {
|
2135 + | payload_config: ::std::option::Option::Some(crate::model::PayloadConfig {
|
2136 + | data: ::std::option::Option::None,
|
2137 + | }),
|
2138 + | test_id: ::std::option::Option::None,
|
2139 + | };
|
2140 + | output
|
2141 + | };
|
2142 + | sender.send(()).await.expect("receiver dropped early");
|
2143 + | result
|
2144 + | }
|
2145 + | })
|
2146 + | .build_unchecked();
|
2021 2147 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2022 2148 | .await
|
2023 2149 | .expect("unable to make an HTTP request");
|
2024 2150 | assert!(
|
2025 2151 | receiver.recv().await.is_some(),
|
2026 2152 | "we expected operation handler to be invoked but it was not entered"
|
2027 2153 | );
|
2028 2154 | }
|
2029 2155 |
|
2030 2156 | /// Serializes a payload targeting a structure
|
2031 2157 | /// Test ID: RestJsonTestPayloadStructure
|
2032 2158 | #[::tokio::test]
|
2033 2159 | #[::tracing_test::traced_test]
|
2034 2160 | async fn rest_json_test_payload_structure_request() {
|
2035 2161 | #[allow(unused_mut)]
|
2036 - | let mut http_request = http::Request::builder()
|
2162 + | let mut http_request = ::http_1x::Request::builder()
|
2037 2163 | .uri("/payload")
|
2038 2164 | .method("POST")
|
2039 2165 | .header("Content-Type", "application/json")
|
2040 - | .body(::aws_smithy_http_server::body::Body::from(
|
2041 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2042 - | "{\"data\": 25\n}".as_bytes(),
|
2043 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2166 + | .body(::aws_smithy_http_server::body::boxed(
|
2167 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2168 + | &::aws_smithy_protocol_test::decode_body_data(
|
2169 + | "{\"data\": 25\n}".as_bytes(),
|
2170 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2171 + | ),
|
2044 2172 | )),
|
2045 2173 | ))
|
2046 2174 | .unwrap();
|
2047 2175 | #[allow(unused_mut)]
|
2048 2176 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2049 2177 | let config = crate::service::RestJsonConfig::builder().build();
|
2050 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
2051 - | .test_payload_structure(move |input: crate::input::TestPayloadStructureInput| {
|
2052 - | let sender = sender.clone();
|
2053 - | async move {
|
2054 - | let result = {
|
2055 - | let expected = crate::input::TestPayloadStructureInput {
|
2056 - | payload_config: ::std::option::Option::Some(
|
2057 - | crate::model::PayloadConfig {
|
2058 - | data: ::std::option::Option::Some(25),
|
2059 - | },
|
2060 - | ),
|
2061 - | test_id: ::std::option::Option::None,
|
2062 - | };
|
2063 - | ::pretty_assertions::assert_eq!(input, expected);
|
2064 - | let output = crate::output::TestPayloadStructureOutput {
|
2065 - | payload_config: ::std::option::Option::Some(
|
2066 - | crate::model::PayloadConfig {
|
2067 - | data: ::std::option::Option::None,
|
2068 - | },
|
2069 - | ),
|
2070 - | test_id: ::std::option::Option::None,
|
2071 - | };
|
2072 - | output
|
2178 + | let service = crate::service::RestJson::builder::<
|
2179 + | ::aws_smithy_http_server::body::BoxBody,
|
2180 + | _,
|
2181 + | _,
|
2182 + | _,
|
2183 + | >(config)
|
2184 + | .test_payload_structure(move |input: crate::input::TestPayloadStructureInput| {
|
2185 + | let sender = sender.clone();
|
2186 + | async move {
|
2187 + | let result = {
|
2188 + | let expected = crate::input::TestPayloadStructureInput {
|
2189 + | payload_config: ::std::option::Option::Some(crate::model::PayloadConfig {
|
2190 + | data: ::std::option::Option::Some(25),
|
2191 + | }),
|
2192 + | test_id: ::std::option::Option::None,
|
2073 2193 | };
|
2074 - | sender.send(()).await.expect("receiver dropped early");
|
2075 - | result
|
2076 - | }
|
2077 - | })
|
2078 - | .build_unchecked();
|
2194 + | ::pretty_assertions::assert_eq!(input, expected);
|
2195 + | let output = crate::output::TestPayloadStructureOutput {
|
2196 + | payload_config: ::std::option::Option::Some(crate::model::PayloadConfig {
|
2197 + | data: ::std::option::Option::None,
|
2198 + | }),
|
2199 + | test_id: ::std::option::Option::None,
|
2200 + | };
|
2201 + | output
|
2202 + | };
|
2203 + | sender.send(()).await.expect("receiver dropped early");
|
2204 + | result
|
2205 + | }
|
2206 + | })
|
2207 + | .build_unchecked();
|
2079 2208 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2080 2209 | .await
|
2081 2210 | .expect("unable to make an HTTP request");
|
2082 2211 | assert!(
|
2083 2212 | receiver.recv().await.is_some(),
|
2084 2213 | "we expected operation handler to be invoked but it was not entered"
|
2085 2214 | );
|
2086 2215 | }
|
2087 2216 |
|
2088 2217 | /// Serializes an request with header members but no payload
|
2089 2218 | /// Test ID: RestJsonHttpWithHeadersButNoPayload
|
2090 2219 | #[::tokio::test]
|
2091 2220 | #[::tracing_test::traced_test]
|
2092 2221 | async fn rest_json_http_with_headers_but_no_payload_request() {
|
2093 2222 | #[allow(unused_mut)]
|
2094 - | let mut http_request = http::Request::builder()
|
2223 + | let mut http_request = ::http_1x::Request::builder()
|
2095 2224 | .uri("/payload")
|
2096 2225 | .method("POST")
|
2097 2226 | .header("Content-Type", "application/json")
|
2098 2227 | .header("X-Amz-Test-Id", "t-12345")
|
2099 - | .body(::aws_smithy_http_server::body::Body::from(
|
2100 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2101 - | "{}".as_bytes(),
|
2102 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2228 + | .body(::aws_smithy_http_server::body::boxed(
|
2229 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2230 + | &::aws_smithy_protocol_test::decode_body_data(
|
2231 + | "{}".as_bytes(),
|
2232 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2233 + | ),
|
2103 2234 | )),
|
2104 2235 | ))
|
2105 2236 | .unwrap();
|
2106 2237 | #[allow(unused_mut)]
|
2107 2238 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2108 2239 | let config = crate::service::RestJsonConfig::builder().build();
|
2109 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
2110 - | .test_payload_structure(move |input: crate::input::TestPayloadStructureInput| {
|
2111 - | let sender = sender.clone();
|
2112 - | async move {
|
2113 - | let result = {
|
2114 - | let expected = crate::input::TestPayloadStructureInput {
|
2115 - | test_id: ::std::option::Option::Some("t-12345".to_owned()),
|
2116 - | payload_config: ::std::option::Option::Some(
|
2117 - | crate::model::PayloadConfig {
|
2118 - | data: ::std::option::Option::None,
|
2119 - | },
|
2120 - | ),
|
2121 - | };
|
2122 - | ::pretty_assertions::assert_eq!(input, expected);
|
2123 - | let output = crate::output::TestPayloadStructureOutput {
|
2124 - | payload_config: ::std::option::Option::Some(
|
2125 - | crate::model::PayloadConfig {
|
2126 - | data: ::std::option::Option::None,
|
2127 - | },
|
2128 - | ),
|
2129 - | test_id: ::std::option::Option::None,
|
2130 - | };
|
2131 - | output
|
2240 + | let service = crate::service::RestJson::builder::<
|
2241 + | ::aws_smithy_http_server::body::BoxBody,
|
2242 + | _,
|
2243 + | _,
|
2244 + | _,
|
2245 + | >(config)
|
2246 + | .test_payload_structure(move |input: crate::input::TestPayloadStructureInput| {
|
2247 + | let sender = sender.clone();
|
2248 + | async move {
|
2249 + | let result = {
|
2250 + | let expected = crate::input::TestPayloadStructureInput {
|
2251 + | test_id: ::std::option::Option::Some("t-12345".to_owned()),
|
2252 + | payload_config: ::std::option::Option::Some(crate::model::PayloadConfig {
|
2253 + | data: ::std::option::Option::None,
|
2254 + | }),
|
2132 2255 | };
|
2133 - | sender.send(()).await.expect("receiver dropped early");
|
2134 - | result
|
2135 - | }
|
2136 - | })
|
2137 - | .build_unchecked();
|
2256 + | ::pretty_assertions::assert_eq!(input, expected);
|
2257 + | let output = crate::output::TestPayloadStructureOutput {
|
2258 + | payload_config: ::std::option::Option::Some(crate::model::PayloadConfig {
|
2259 + | data: ::std::option::Option::None,
|
2260 + | }),
|
2261 + | test_id: ::std::option::Option::None,
|
2262 + | };
|
2263 + | output
|
2264 + | };
|
2265 + | sender.send(()).await.expect("receiver dropped early");
|
2266 + | result
|
2267 + | }
|
2268 + | })
|
2269 + | .build_unchecked();
|
2138 2270 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2139 2271 | .await
|
2140 2272 | .expect("unable to make an HTTP request");
|
2141 2273 | assert!(
|
2142 2274 | receiver.recv().await.is_some(),
|
2143 2275 | "we expected operation handler to be invoked but it was not entered"
|
2144 2276 | );
|
2145 2277 | }
|
2278 + |
|
2279 + | /* ProtocolTestGenerator.kt:98 */
|
2146 2280 | }
|
2147 2281 |
|
2282 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
2148 2283 | ::pin_project_lite::pin_project! {
|
2149 2284 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2150 2285 | /// [`TestBodyStructureInput`](crate::input::TestBodyStructureInput) using modelled bindings.
|
2151 2286 | pub struct TestBodyStructureInputFuture {
|
2152 2287 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::TestBodyStructureInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
2153 2288 | }
|
2154 2289 | }
|
2155 2290 |
|
2156 2291 | impl std::future::Future for TestBodyStructureInputFuture {
|
2157 2292 | type Output = Result<
|
2158 2293 | crate::input::TestBodyStructureInput,
|
2159 2294 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
2160 2295 | >;
|
2161 2296 |
|
2162 2297 | fn poll(
|
2163 2298 | self: std::pin::Pin<&mut Self>,
|
2164 2299 | cx: &mut std::task::Context<'_>,
|
2165 2300 | ) -> std::task::Poll<Self::Output> {
|
2166 2301 | let this = self.project();
|
2167 2302 | this.inner.as_mut().poll(cx)
|
2168 2303 | }
|
2169 2304 | }
|
2170 2305 |
|
2171 2306 | impl<B>
|
2172 2307 | ::aws_smithy_http_server::request::FromRequest<
|
2173 2308 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
2174 2309 | B,
|
2175 2310 | > for crate::input::TestBodyStructureInput
|
2176 2311 | where
|
2177 2312 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2178 2313 | B: 'static,
|
2179 2314 |
|
2180 2315 | B::Data: Send,
|
2181 2316 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
2182 2317 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2183 2318 | {
|
2184 2319 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
2185 2320 | type Future = TestBodyStructureInputFuture;
|
2186 2321 |
|
2187 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2322 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2188 2323 | let fut = async move {
|
2189 2324 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2190 2325 | request.headers(),
|
2191 2326 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
2192 2327 | ) {
|
2193 2328 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
2194 2329 | }
|
2195 2330 | crate::protocol_serde::shape_test_body_structure::de_test_body_structure_http_request(
|
2196 2331 | request,
|
2197 2332 | )
|
2198 2333 | .await
|
2199 2334 | };
|
2200 2335 | use ::futures_util::future::TryFutureExt;
|
2201 2336 | let fut = fut.map_err(
|
2202 2337 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
2203 2338 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2204 2339 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
2205 2340 | e,
|
2206 2341 | )
|
2207 2342 | },
|
2208 2343 | );
|
2209 2344 | TestBodyStructureInputFuture {
|
2210 2345 | inner: Box::pin(fut),
|
2211 2346 | }
|
2212 2347 | }
|
2213 2348 | }
|
2349 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
2214 2350 | impl
|
2215 2351 | ::aws_smithy_http_server::response::IntoResponse<
|
2216 2352 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
2217 2353 | > for crate::output::TestBodyStructureOutput
|
2218 2354 | {
|
2219 2355 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2220 2356 | match crate::protocol_serde::shape_test_body_structure::ser_test_body_structure_http_response(self) {
|
2221 2357 | Ok(response) => response,
|
2222 2358 | Err(e) => {
|
2223 2359 | ::tracing::error!(error = %e, "failed to serialize response");
|
2224 2360 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
2225 2361 | }
|
2226 2362 | }
|
2227 2363 | }
|
2228 2364 | }
|
2229 2365 |
|
2366 + | /* RustType.kt:534 */
|
2230 2367 | #[allow(unreachable_code, unused_variables)]
|
2368 + | /* RustType.kt:534 */
|
2231 2369 | #[cfg(test)]
|
2370 + | /* ProtocolTestGenerator.kt:98 */
|
2232 2371 | mod test_body_structure_test {
|
2233 2372 |
|
2234 2373 | /// Serializes a structure
|
2235 2374 | /// Test ID: RestJsonTestBodyStructure
|
2236 2375 | #[::tokio::test]
|
2237 2376 | #[::tracing_test::traced_test]
|
2238 2377 | async fn rest_json_test_body_structure_request() {
|
2239 2378 | #[allow(unused_mut)]
|
2240 - | let mut http_request = http::Request::builder()
|
2379 + | let mut http_request = ::http_1x::Request::builder()
|
2241 2380 | .uri("/body")
|
2242 2381 | .method("POST")
|
2243 2382 | .header("Content-Type", "application/json")
|
2244 - | .body(::aws_smithy_http_server::body::Body::from(
|
2245 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2246 - | "{\"testConfig\":\n {\"timeout\": 10}\n}".as_bytes(),
|
2247 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2383 + | .body(::aws_smithy_http_server::body::boxed(
|
2384 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2385 + | &::aws_smithy_protocol_test::decode_body_data(
|
2386 + | "{\"testConfig\":\n {\"timeout\": 10}\n}".as_bytes(),
|
2387 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2388 + | ),
|
2248 2389 | )),
|
2249 2390 | ))
|
2250 2391 | .unwrap();
|
2251 2392 | #[allow(unused_mut)]
|
2252 2393 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2253 2394 | let config = crate::service::RestJsonConfig::builder().build();
|
2254 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
2395 + | let service =
|
2396 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
2397 + | config,
|
2398 + | )
|
2255 2399 | .test_body_structure(move |input: crate::input::TestBodyStructureInput| {
|
2256 2400 | let sender = sender.clone();
|
2257 2401 | async move {
|
2258 2402 | let result = {
|
2259 2403 | let expected = crate::input::TestBodyStructureInput {
|
2260 2404 | test_config: ::std::option::Option::Some(crate::model::TestConfig {
|
2261 2405 | timeout: ::std::option::Option::Some(10),
|
2262 2406 | }),
|
2263 2407 | test_id: ::std::option::Option::None,
|
2264 2408 | };
|
2265 2409 | ::pretty_assertions::assert_eq!(input, expected);
|
2266 2410 | let output = crate::output::TestBodyStructureOutput {
|
2267 2411 | test_id: ::std::option::Option::None,
|
2268 2412 | test_config: ::std::option::Option::None,
|
2269 2413 | };
|
2270 2414 | output
|
2271 2415 | };
|
2272 2416 | sender.send(()).await.expect("receiver dropped early");
|
2273 2417 | result
|
2274 2418 | }
|
2275 2419 | })
|
2276 2420 | .build_unchecked();
|
2277 2421 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2278 2422 | .await
|
2279 2423 | .expect("unable to make an HTTP request");
|
2280 2424 | assert!(
|
2281 2425 | receiver.recv().await.is_some(),
|
2282 2426 | "we expected operation handler to be invoked but it was not entered"
|
2283 2427 | );
|
2284 2428 | }
|
2285 2429 |
|
2286 2430 | /// Serializes an empty structure in the body
|
2287 2431 | /// Test ID: RestJsonHttpWithEmptyBody
|
2288 2432 | #[::tokio::test]
|
2289 2433 | #[::tracing_test::traced_test]
|
2290 2434 | async fn rest_json_http_with_empty_body_request() {
|
2291 2435 | #[allow(unused_mut)]
|
2292 - | let mut http_request = http::Request::builder()
|
2436 + | let mut http_request = ::http_1x::Request::builder()
|
2293 2437 | .uri("/body")
|
2294 2438 | .method("POST")
|
2295 2439 | .header("Content-Type", "application/json")
|
2296 - | .body(::aws_smithy_http_server::body::Body::from(
|
2297 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2298 - | "{}".as_bytes(),
|
2299 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2440 + | .body(::aws_smithy_http_server::body::boxed(
|
2441 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2442 + | &::aws_smithy_protocol_test::decode_body_data(
|
2443 + | "{}".as_bytes(),
|
2444 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2445 + | ),
|
2300 2446 | )),
|
2301 2447 | ))
|
2302 2448 | .unwrap();
|
2303 2449 | #[allow(unused_mut)]
|
2304 2450 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2305 2451 | let config = crate::service::RestJsonConfig::builder().build();
|
2306 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
2452 + | let service =
|
2453 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
2454 + | config,
|
2455 + | )
|
2307 2456 | .test_body_structure(move |input: crate::input::TestBodyStructureInput| {
|
2308 2457 | let sender = sender.clone();
|
2309 2458 | async move {
|
2310 2459 | let result = {
|
2311 2460 | let expected = crate::input::TestBodyStructureInput {
|
2312 2461 | test_id: ::std::option::Option::None,
|
2313 2462 | test_config: ::std::option::Option::None,
|
2314 2463 | };
|
2315 2464 | ::pretty_assertions::assert_eq!(input, expected);
|
2316 2465 | let output = crate::output::TestBodyStructureOutput {
|
2317 2466 | test_id: ::std::option::Option::None,
|
2318 2467 | test_config: ::std::option::Option::None,
|
2319 2468 | };
|
2320 2469 | output
|
2321 2470 | };
|
2322 2471 | sender.send(()).await.expect("receiver dropped early");
|
2323 2472 | result
|
2324 2473 | }
|
2325 2474 | })
|
2326 2475 | .build_unchecked();
|
2327 2476 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2328 2477 | .await
|
2329 2478 | .expect("unable to make an HTTP request");
|
2330 2479 | assert!(
|
2331 2480 | receiver.recv().await.is_some(),
|
2332 2481 | "we expected operation handler to be invoked but it was not entered"
|
2333 2482 | );
|
2334 2483 | }
|
2484 + |
|
2485 + | /* ProtocolTestGenerator.kt:98 */
|
2335 2486 | }
|
2336 2487 |
|
2488 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
2337 2489 | ::pin_project_lite::pin_project! {
|
2338 2490 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2339 2491 | /// [`MalformedAcceptWithGenericStringInput`](crate::input::MalformedAcceptWithGenericStringInput) using modelled bindings.
|
2340 2492 | pub struct MalformedAcceptWithGenericStringInputFuture {
|
2341 2493 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedAcceptWithGenericStringInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
2342 2494 | }
|
2343 2495 | }
|
2344 2496 |
|
2345 2497 | impl std::future::Future for MalformedAcceptWithGenericStringInputFuture {
|
2346 2498 | type Output = Result<
|
2347 2499 | crate::input::MalformedAcceptWithGenericStringInput,
|
2348 2500 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
2349 2501 | >;
|
2350 2502 |
|
2351 2503 | fn poll(
|
2352 2504 | self: std::pin::Pin<&mut Self>,
|
2353 2505 | cx: &mut std::task::Context<'_>,
|
2354 2506 | ) -> std::task::Poll<Self::Output> {
|
2355 2507 | let this = self.project();
|
2356 2508 | this.inner.as_mut().poll(cx)
|
2357 2509 | }
|
2358 2510 | }
|
2359 2511 |
|
2360 2512 | impl<B>
|
2361 2513 | ::aws_smithy_http_server::request::FromRequest<
|
2362 2514 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
2363 2515 | B,
|
2364 2516 | > for crate::input::MalformedAcceptWithGenericStringInput
|
2365 2517 | where
|
2366 2518 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2367 2519 | B: 'static,
|
2368 2520 |
|
2369 2521 | B::Data: Send,
|
2370 2522 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
2371 2523 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2372 2524 | {
|
2373 2525 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
2374 2526 | type Future = MalformedAcceptWithGenericStringInputFuture;
|
2375 2527 |
|
2376 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2528 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2377 2529 | let fut = async move {
|
2378 2530 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2379 2531 | request.headers(),
|
2380 2532 | &crate::mimes::CONTENT_TYPE_TEXT_PLAIN,
|
2381 2533 | ) {
|
2382 2534 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
2383 2535 | }
|
2384 2536 | crate::protocol_serde::shape_malformed_accept_with_generic_string::de_malformed_accept_with_generic_string_http_request(request)
|
2385 2537 | .await
|
2386 2538 | };
|
2387 2539 | use ::futures_util::future::TryFutureExt;
|
2388 2540 | let fut = fut.map_err(
|
2389 2541 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
2390 2542 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2391 2543 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
2392 2544 | e,
|
2393 2545 | )
|
2394 2546 | },
|
2395 2547 | );
|
2396 2548 | MalformedAcceptWithGenericStringInputFuture {
|
2397 2549 | inner: Box::pin(fut),
|
2398 2550 | }
|
2399 2551 | }
|
2400 2552 | }
|
2553 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
2401 2554 | impl
|
2402 2555 | ::aws_smithy_http_server::response::IntoResponse<
|
2403 2556 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
2404 2557 | > for crate::output::MalformedAcceptWithGenericStringOutput
|
2405 2558 | {
|
2406 2559 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2407 2560 | match crate::protocol_serde::shape_malformed_accept_with_generic_string::ser_malformed_accept_with_generic_string_http_response(self) {
|
2408 2561 | Ok(response) => response,
|
2409 2562 | Err(e) => {
|
2410 2563 | ::tracing::error!(error = %e, "failed to serialize response");
|
2411 2564 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
2412 2565 | }
|
2413 2566 | }
|
2414 2567 | }
|
2415 2568 | }
|
2416 2569 |
|
2570 + | /* RustType.kt:534 */
|
2417 2571 | #[allow(unreachable_code, unused_variables)]
|
2572 + | /* RustType.kt:534 */
|
2418 2573 | #[cfg(test)]
|
2574 + | /* ProtocolTestGenerator.kt:98 */
|
2419 2575 | mod malformed_accept_with_generic_string_test {
|
2420 2576 |
|
2421 2577 | /// When there is a payload without a mediaType trait, the accept must match the
|
2422 2578 | /// implied content type of the shape.
|
2423 2579 | /// Test ID: RestJsonWithPayloadExpectsImpliedAccept
|
2424 2580 | #[::tokio::test]
|
2425 2581 | #[::tracing_test::traced_test]
|
2426 2582 | async fn rest_json_with_payload_expects_implied_accept_malformed_request() {
|
2427 2583 | {
|
2428 2584 | #[allow(unused_mut)]
|
2429 - | let mut http_request = http::Request::builder()
|
2585 + | let mut http_request = ::http_1x::Request::builder()
|
2430 2586 | .uri("/MalformedAcceptWithGenericString")
|
2431 2587 | .method("POST")
|
2432 2588 | .header("accept", "application/json")
|
2433 - | .body(::aws_smithy_http_server::body::Body::empty())
|
2589 + | .body(::aws_smithy_http_server::body::boxed(
|
2590 + | ::http_body_util::Empty::new(),
|
2591 + | ))
|
2434 2592 | .unwrap();
|
2435 2593 | #[allow(unused_mut)]
|
2436 2594 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2437 2595 | let config = crate::service::RestJsonConfig::builder().build();
|
2438 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
2596 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2439 2597 | .malformed_accept_with_generic_string(move |input: crate::input::MalformedAcceptWithGenericStringInput| {
|
2440 2598 | let sender = sender.clone();
|
2441 2599 | async move {
|
2442 2600 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedAcceptWithGenericStringOutput };
|
2443 2601 | sender.send(()).await.expect("receiver dropped early");
|
2444 2602 | result
|
2445 2603 | }
|
2446 2604 | })
|
2447 2605 | .build_unchecked();
|
2448 2606 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2449 2607 | .await
|
2450 2608 | .expect("unable to make an HTTP request");
|
2451 2609 | ::pretty_assertions::assert_eq!(
|
2452 - | http::StatusCode::from_u16(406).expect("invalid expected HTTP status code"),
|
2610 + | ::http_1x::StatusCode::from_u16(406).expect("invalid expected HTTP status code"),
|
2453 2611 | http_response.status()
|
2454 2612 | );
|
2455 2613 | let expected_headers = [("x-amzn-errortype", "NotAcceptableException")];
|
2456 2614 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2457 2615 | http_response.headers(),
|
2458 2616 | expected_headers,
|
2459 2617 | ));
|
2460 2618 | }
|
2461 2619 | }
|
2620 + |
|
2621 + | /* ProtocolTestGenerator.kt:98 */
|
2462 2622 | }
|
2463 2623 |
|
2624 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
2464 2625 | ::pin_project_lite::pin_project! {
|
2465 2626 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2466 2627 | /// [`MalformedAcceptWithPayloadInput`](crate::input::MalformedAcceptWithPayloadInput) using modelled bindings.
|
2467 2628 | pub struct MalformedAcceptWithPayloadInputFuture {
|
2468 2629 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedAcceptWithPayloadInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
2469 2630 | }
|
2470 2631 | }
|
2471 2632 |
|
2472 2633 | impl std::future::Future for MalformedAcceptWithPayloadInputFuture {
|
2473 2634 | type Output = Result<
|
2474 2635 | crate::input::MalformedAcceptWithPayloadInput,
|
2475 2636 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
2476 2637 | >;
|
2477 2638 |
|
2478 2639 | fn poll(
|
2479 2640 | self: std::pin::Pin<&mut Self>,
|
2480 2641 | cx: &mut std::task::Context<'_>,
|
2481 2642 | ) -> std::task::Poll<Self::Output> {
|
2482 2643 | let this = self.project();
|
2483 2644 | this.inner.as_mut().poll(cx)
|
2484 2645 | }
|
2485 2646 | }
|
2486 2647 |
|
2487 2648 | impl<B>
|
2488 2649 | ::aws_smithy_http_server::request::FromRequest<
|
2489 2650 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
2490 2651 | B,
|
2491 2652 | > for crate::input::MalformedAcceptWithPayloadInput
|
2492 2653 | where
|
2493 2654 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2494 2655 | B: 'static,
|
2495 2656 |
|
2496 2657 | B::Data: Send,
|
2497 2658 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
2498 2659 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2499 2660 | {
|
2500 2661 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
2501 2662 | type Future = MalformedAcceptWithPayloadInputFuture;
|
2502 2663 |
|
2503 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2664 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2504 2665 | let fut = async move {
|
2505 2666 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2506 2667 | request.headers(),
|
2507 2668 | &crate::mimes::CONTENT_TYPE_IMAGE_JPEG,
|
2508 2669 | ) {
|
2509 2670 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
2510 2671 | }
|
2511 2672 | crate::protocol_serde::shape_malformed_accept_with_payload::de_malformed_accept_with_payload_http_request(request)
|
2512 2673 | .await
|
2513 2674 | };
|
2514 2675 | use ::futures_util::future::TryFutureExt;
|
2515 2676 | let fut = fut.map_err(
|
2516 2677 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
2517 2678 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2518 2679 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
2519 2680 | e,
|
2520 2681 | )
|
2521 2682 | },
|
2522 2683 | );
|
2523 2684 | MalformedAcceptWithPayloadInputFuture {
|
2524 2685 | inner: Box::pin(fut),
|
2525 2686 | }
|
2526 2687 | }
|
2527 2688 | }
|
2689 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
2528 2690 | impl
|
2529 2691 | ::aws_smithy_http_server::response::IntoResponse<
|
2530 2692 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
2531 2693 | > for crate::output::MalformedAcceptWithPayloadOutput
|
2532 2694 | {
|
2533 2695 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2534 2696 | match crate::protocol_serde::shape_malformed_accept_with_payload::ser_malformed_accept_with_payload_http_response(self) {
|
2535 2697 | Ok(response) => response,
|
2536 2698 | Err(e) => {
|
2537 2699 | ::tracing::error!(error = %e, "failed to serialize response");
|
2538 2700 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
2539 2701 | }
|
2540 2702 | }
|
2541 2703 | }
|
2542 2704 | }
|
2543 2705 |
|
2706 + | /* RustType.kt:534 */
|
2544 2707 | #[allow(unreachable_code, unused_variables)]
|
2708 + | /* RustType.kt:534 */
|
2545 2709 | #[cfg(test)]
|
2710 + | /* ProtocolTestGenerator.kt:98 */
|
2546 2711 | mod malformed_accept_with_payload_test {
|
2547 2712 |
|
2548 2713 | /// When there is a payload with a mediaType trait, the accept must match.
|
2549 2714 | /// Test ID: RestJsonWithPayloadExpectsModeledAccept
|
2550 2715 | #[::tokio::test]
|
2551 2716 | #[::tracing_test::traced_test]
|
2552 2717 | async fn rest_json_with_payload_expects_modeled_accept_malformed_request() {
|
2553 2718 | {
|
2554 2719 | #[allow(unused_mut)]
|
2555 - | let mut http_request = http::Request::builder()
|
2720 + | let mut http_request = ::http_1x::Request::builder()
|
2556 2721 | .uri("/MalformedAcceptWithPayload")
|
2557 2722 | .method("POST")
|
2558 2723 | .header("accept", "application/json")
|
2559 - | .body(::aws_smithy_http_server::body::Body::empty())
|
2724 + | .body(::aws_smithy_http_server::body::boxed(
|
2725 + | ::http_body_util::Empty::new(),
|
2726 + | ))
|
2560 2727 | .unwrap();
|
2561 2728 | #[allow(unused_mut)]
|
2562 2729 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2563 2730 | let config = crate::service::RestJsonConfig::builder().build();
|
2564 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
2731 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2565 2732 | .malformed_accept_with_payload(move |input: crate::input::MalformedAcceptWithPayloadInput| {
|
2566 2733 | let sender = sender.clone();
|
2567 2734 | async move {
|
2568 2735 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedAcceptWithPayloadOutput };
|
2569 2736 | sender.send(()).await.expect("receiver dropped early");
|
2570 2737 | result
|
2571 2738 | }
|
2572 2739 | })
|
2573 2740 | .build_unchecked();
|
2574 2741 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2575 2742 | .await
|
2576 2743 | .expect("unable to make an HTTP request");
|
2577 2744 | ::pretty_assertions::assert_eq!(
|
2578 - | http::StatusCode::from_u16(406).expect("invalid expected HTTP status code"),
|
2745 + | ::http_1x::StatusCode::from_u16(406).expect("invalid expected HTTP status code"),
|
2579 2746 | http_response.status()
|
2580 2747 | );
|
2581 2748 | let expected_headers = [("x-amzn-errortype", "NotAcceptableException")];
|
2582 2749 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2583 2750 | http_response.headers(),
|
2584 2751 | expected_headers,
|
2585 2752 | ));
|
2586 2753 | }
|
2587 2754 | }
|
2755 + |
|
2756 + | /* ProtocolTestGenerator.kt:98 */
|
2588 2757 | }
|
2589 2758 |
|
2759 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
2590 2760 | ::pin_project_lite::pin_project! {
|
2591 2761 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2592 2762 | /// [`MalformedAcceptWithBodyInput`](crate::input::MalformedAcceptWithBodyInput) using modelled bindings.
|
2593 2763 | pub struct MalformedAcceptWithBodyInputFuture {
|
2594 2764 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedAcceptWithBodyInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
2595 2765 | }
|
2596 2766 | }
|
2597 2767 |
|
2598 2768 | impl std::future::Future for MalformedAcceptWithBodyInputFuture {
|
2599 2769 | type Output = Result<
|
2600 2770 | crate::input::MalformedAcceptWithBodyInput,
|
2601 2771 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
2602 2772 | >;
|
2603 2773 |
|
2604 2774 | fn poll(
|
2605 2775 | self: std::pin::Pin<&mut Self>,
|
2606 2776 | cx: &mut std::task::Context<'_>,
|
2607 2777 | ) -> std::task::Poll<Self::Output> {
|
2608 2778 | let this = self.project();
|
2609 2779 | this.inner.as_mut().poll(cx)
|
2610 2780 | }
|
2611 2781 | }
|
2612 2782 |
|
2613 2783 | impl<B>
|
2614 2784 | ::aws_smithy_http_server::request::FromRequest<
|
2615 2785 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
2616 2786 | B,
|
2617 2787 | > for crate::input::MalformedAcceptWithBodyInput
|
2618 2788 | where
|
2619 2789 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2620 2790 | B: 'static,
|
2621 2791 |
|
2622 2792 | B::Data: Send,
|
2623 2793 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
2624 2794 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2625 2795 | {
|
2626 2796 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
2627 2797 | type Future = MalformedAcceptWithBodyInputFuture;
|
2628 2798 |
|
2629 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2799 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2630 2800 | let fut = async move {
|
2631 2801 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2632 2802 | request.headers(),
|
2633 2803 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
2634 2804 | ) {
|
2635 2805 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
2636 2806 | }
|
2637 2807 | crate::protocol_serde::shape_malformed_accept_with_body::de_malformed_accept_with_body_http_request(request)
|
2638 2808 | .await
|
2639 2809 | };
|
2640 2810 | use ::futures_util::future::TryFutureExt;
|
2641 2811 | let fut = fut.map_err(
|
2642 2812 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
2643 2813 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2644 2814 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
2645 2815 | e,
|
2646 2816 | )
|
2647 2817 | },
|
2648 2818 | );
|
2649 2819 | MalformedAcceptWithBodyInputFuture {
|
2650 2820 | inner: Box::pin(fut),
|
2651 2821 | }
|
2652 2822 | }
|
2653 2823 | }
|
2824 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
2654 2825 | impl
|
2655 2826 | ::aws_smithy_http_server::response::IntoResponse<
|
2656 2827 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
2657 2828 | > for crate::output::MalformedAcceptWithBodyOutput
|
2658 2829 | {
|
2659 2830 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2660 2831 | match crate::protocol_serde::shape_malformed_accept_with_body::ser_malformed_accept_with_body_http_response(self) {
|
2661 2832 | Ok(response) => response,
|
2662 2833 | Err(e) => {
|
2663 2834 | ::tracing::error!(error = %e, "failed to serialize response");
|
2664 2835 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
2665 2836 | }
|
2666 2837 | }
|
2667 2838 | }
|
2668 2839 | }
|
2669 2840 |
|
2841 + | /* RustType.kt:534 */
|
2670 2842 | #[allow(unreachable_code, unused_variables)]
|
2843 + | /* RustType.kt:534 */
|
2671 2844 | #[cfg(test)]
|
2845 + | /* ProtocolTestGenerator.kt:98 */
|
2672 2846 | mod malformed_accept_with_body_test {
|
2673 2847 |
|
2674 2848 | /// When there is modeled output, the accept must be application/json
|
2675 2849 | /// Test ID: RestJsonWithBodyExpectsApplicationJsonAccept
|
2676 2850 | #[::tokio::test]
|
2677 2851 | #[::tracing_test::traced_test]
|
2678 2852 | async fn rest_json_with_body_expects_application_json_accept_malformed_request() {
|
2679 2853 | {
|
2680 2854 | #[allow(unused_mut)]
|
2681 - | let mut http_request = http::Request::builder()
|
2855 + | let mut http_request = ::http_1x::Request::builder()
|
2682 2856 | .uri("/MalformedAcceptWithBody")
|
2683 2857 | .method("POST")
|
2684 2858 | .header("accept", "application/hal+json")
|
2685 - | .body(::aws_smithy_http_server::body::Body::empty())
|
2859 + | .body(::aws_smithy_http_server::body::boxed(
|
2860 + | ::http_body_util::Empty::new(),
|
2861 + | ))
|
2686 2862 | .unwrap();
|
2687 2863 | #[allow(unused_mut)]
|
2688 2864 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2689 2865 | let config = crate::service::RestJsonConfig::builder().build();
|
2690 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
2866 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2691 2867 | .malformed_accept_with_body(move |input: crate::input::MalformedAcceptWithBodyInput| {
|
2692 2868 | let sender = sender.clone();
|
2693 2869 | async move {
|
2694 2870 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedAcceptWithBodyOutput };
|
2695 2871 | sender.send(()).await.expect("receiver dropped early");
|
2696 2872 | result
|
2697 2873 | }
|
2698 2874 | })
|
2699 2875 | .build_unchecked();
|
2700 2876 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2701 2877 | .await
|
2702 2878 | .expect("unable to make an HTTP request");
|
2703 2879 | ::pretty_assertions::assert_eq!(
|
2704 - | http::StatusCode::from_u16(406).expect("invalid expected HTTP status code"),
|
2880 + | ::http_1x::StatusCode::from_u16(406).expect("invalid expected HTTP status code"),
|
2705 2881 | http_response.status()
|
2706 2882 | );
|
2707 2883 | let expected_headers = [("x-amzn-errortype", "NotAcceptableException")];
|
2708 2884 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2709 2885 | http_response.headers(),
|
2710 2886 | expected_headers,
|
2711 2887 | ));
|
2712 2888 | }
|
2713 2889 | }
|
2890 + |
|
2891 + | /* ProtocolTestGenerator.kt:98 */
|
2714 2892 | }
|
2715 2893 |
|
2894 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
2716 2895 | ::pin_project_lite::pin_project! {
|
2717 2896 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2718 2897 | /// [`MalformedContentTypeWithGenericStringInput`](crate::input::MalformedContentTypeWithGenericStringInput) using modelled bindings.
|
2719 2898 | pub struct MalformedContentTypeWithGenericStringInputFuture {
|
2720 2899 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedContentTypeWithGenericStringInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
2721 2900 | }
|
2722 2901 | }
|
2723 2902 |
|
2724 2903 | impl std::future::Future for MalformedContentTypeWithGenericStringInputFuture {
|
2725 2904 | type Output = Result<
|
2726 2905 | crate::input::MalformedContentTypeWithGenericStringInput,
|
2727 2906 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
2728 2907 | >;
|
2729 2908 |
|
2730 2909 | fn poll(
|
2731 2910 | self: std::pin::Pin<&mut Self>,
|
2732 2911 | cx: &mut std::task::Context<'_>,
|
2733 2912 | ) -> std::task::Poll<Self::Output> {
|
2734 2913 | let this = self.project();
|
2735 2914 | this.inner.as_mut().poll(cx)
|
2736 2915 | }
|
2737 2916 | }
|
2738 2917 |
|
2739 2918 | impl<B>
|
2740 2919 | ::aws_smithy_http_server::request::FromRequest<
|
2741 2920 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
2742 2921 | B,
|
2743 2922 | > for crate::input::MalformedContentTypeWithGenericStringInput
|
2744 2923 | where
|
2745 2924 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2746 2925 | B: 'static,
|
2747 2926 |
|
2748 2927 | B::Data: Send,
|
2749 2928 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
2750 2929 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2751 2930 | {
|
2752 2931 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
2753 2932 | type Future = MalformedContentTypeWithGenericStringInputFuture;
|
2754 2933 |
|
2755 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2934 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2756 2935 | let fut = async move {
|
2757 2936 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2758 2937 | request.headers(),
|
2759 2938 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
2760 2939 | ) {
|
2761 2940 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
2762 2941 | }
|
2763 2942 | crate::protocol_serde::shape_malformed_content_type_with_generic_string::de_malformed_content_type_with_generic_string_http_request(request)
|
2764 2943 | .await
|
2765 2944 | };
|
2766 2945 | use ::futures_util::future::TryFutureExt;
|
2767 2946 | let fut = fut.map_err(
|
2768 2947 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
2769 2948 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2770 2949 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
2771 2950 | e,
|
2772 2951 | )
|
2773 2952 | },
|
2774 2953 | );
|
2775 2954 | MalformedContentTypeWithGenericStringInputFuture {
|
2776 2955 | inner: Box::pin(fut),
|
2777 2956 | }
|
2778 2957 | }
|
2779 2958 | }
|
2959 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
2780 2960 | impl
|
2781 2961 | ::aws_smithy_http_server::response::IntoResponse<
|
2782 2962 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
2783 2963 | > for crate::output::MalformedContentTypeWithGenericStringOutput
|
2784 2964 | {
|
2785 2965 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2786 2966 | match crate::protocol_serde::shape_malformed_content_type_with_generic_string::ser_malformed_content_type_with_generic_string_http_response(self) {
|
2787 2967 | Ok(response) => response,
|
2788 2968 | Err(e) => {
|
2789 2969 | ::tracing::error!(error = %e, "failed to serialize response");
|
2790 2970 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
2791 2971 | }
|
2792 2972 | }
|
2793 2973 | }
|
2794 2974 | }
|
2795 2975 |
|
2976 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
2796 2977 | ::pin_project_lite::pin_project! {
|
2797 2978 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2798 2979 | /// [`MalformedContentTypeWithPayloadInput`](crate::input::MalformedContentTypeWithPayloadInput) using modelled bindings.
|
2799 2980 | pub struct MalformedContentTypeWithPayloadInputFuture {
|
2800 2981 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedContentTypeWithPayloadInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
2801 2982 | }
|
2802 2983 | }
|
2803 2984 |
|
2804 2985 | impl std::future::Future for MalformedContentTypeWithPayloadInputFuture {
|
2805 2986 | type Output = Result<
|
2806 2987 | crate::input::MalformedContentTypeWithPayloadInput,
|
2807 2988 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
2808 2989 | >;
|
2809 2990 |
|
2810 2991 | fn poll(
|
2811 2992 | self: std::pin::Pin<&mut Self>,
|
2812 2993 | cx: &mut std::task::Context<'_>,
|
2813 2994 | ) -> std::task::Poll<Self::Output> {
|
2814 2995 | let this = self.project();
|
2815 2996 | this.inner.as_mut().poll(cx)
|
2816 2997 | }
|
2817 2998 | }
|
2818 2999 |
|
2819 3000 | impl<B>
|
2820 3001 | ::aws_smithy_http_server::request::FromRequest<
|
2821 3002 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
2822 3003 | B,
|
2823 3004 | > for crate::input::MalformedContentTypeWithPayloadInput
|
2824 3005 | where
|
2825 3006 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2826 3007 | B: 'static,
|
2827 3008 |
|
2828 3009 | B::Data: Send,
|
2829 3010 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
2830 3011 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2831 3012 | {
|
2832 3013 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
2833 3014 | type Future = MalformedContentTypeWithPayloadInputFuture;
|
2834 3015 |
|
2835 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3016 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2836 3017 | let fut = async move {
|
2837 3018 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2838 3019 | request.headers(),
|
2839 3020 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
2840 3021 | ) {
|
2841 3022 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
2842 3023 | }
|
2843 3024 | crate::protocol_serde::shape_malformed_content_type_with_payload::de_malformed_content_type_with_payload_http_request(request)
|
2844 3025 | .await
|
2845 3026 | };
|
2846 3027 | use ::futures_util::future::TryFutureExt;
|
2847 3028 | let fut = fut.map_err(
|
2848 3029 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
2849 3030 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2850 3031 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
2851 3032 | e,
|
2852 3033 | )
|
2853 3034 | },
|
2854 3035 | );
|
2855 3036 | MalformedContentTypeWithPayloadInputFuture {
|
2856 3037 | inner: Box::pin(fut),
|
2857 3038 | }
|
2858 3039 | }
|
2859 3040 | }
|
3041 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
2860 3042 | impl
|
2861 3043 | ::aws_smithy_http_server::response::IntoResponse<
|
2862 3044 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
2863 3045 | > for crate::output::MalformedContentTypeWithPayloadOutput
|
2864 3046 | {
|
2865 3047 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2866 3048 | match crate::protocol_serde::shape_malformed_content_type_with_payload::ser_malformed_content_type_with_payload_http_response(self) {
|
2867 3049 | Ok(response) => response,
|
2868 3050 | Err(e) => {
|
2869 3051 | ::tracing::error!(error = %e, "failed to serialize response");
|
2870 3052 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
2871 3053 | }
|
2872 3054 | }
|
2873 3055 | }
|
2874 3056 | }
|
2875 3057 |
|
3058 + | /* RustType.kt:534 */
|
2876 3059 | #[allow(unreachable_code, unused_variables)]
|
3060 + | /* RustType.kt:534 */
|
2877 3061 | #[cfg(test)]
|
3062 + | /* ProtocolTestGenerator.kt:98 */
|
2878 3063 | mod malformed_content_type_with_payload_test {
|
2879 3064 |
|
2880 3065 | /// When there is a payload with a mediaType trait, the content type must match.
|
2881 3066 | /// Test ID: RestJsonWithPayloadExpectsModeledContentType
|
2882 3067 | #[::tokio::test]
|
2883 3068 | #[::tracing_test::traced_test]
|
2884 3069 | async fn rest_json_with_payload_expects_modeled_content_type_malformed_request() {
|
2885 3070 | {
|
2886 3071 | #[allow(unused_mut)]
|
2887 - | let mut http_request = http::Request::builder()
|
3072 + | let mut http_request = ::http_1x::Request::builder()
|
2888 3073 | .uri("/MalformedContentTypeWithPayload")
|
2889 3074 | .method("POST")
|
2890 3075 | .header("content-type", "application/json")
|
2891 - | .body(::aws_smithy_http_server::body::Body::from(
|
2892 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2893 - | "{}".as_bytes(),
|
2894 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3076 + | .body(::aws_smithy_http_server::body::boxed(
|
3077 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3078 + | &::aws_smithy_protocol_test::decode_body_data(
|
3079 + | "{}".as_bytes(),
|
3080 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3081 + | ),
|
2895 3082 | )),
|
2896 3083 | ))
|
2897 3084 | .unwrap();
|
2898 3085 | #[allow(unused_mut)]
|
2899 3086 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2900 3087 | let config = crate::service::RestJsonConfig::builder().build();
|
2901 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
3088 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2902 3089 | .malformed_content_type_with_payload(move |input: crate::input::MalformedContentTypeWithPayloadInput| {
|
2903 3090 | let sender = sender.clone();
|
2904 3091 | async move {
|
2905 3092 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedContentTypeWithPayloadOutput };
|
2906 3093 | sender.send(()).await.expect("receiver dropped early");
|
2907 3094 | result
|
2908 3095 | }
|
2909 3096 | })
|
2910 3097 | .build_unchecked();
|
2911 3098 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2912 3099 | .await
|
2913 3100 | .expect("unable to make an HTTP request");
|
2914 3101 | ::pretty_assertions::assert_eq!(
|
2915 - | http::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
|
3102 + | ::http_1x::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
|
2916 3103 | http_response.status()
|
2917 3104 | );
|
2918 3105 | let expected_headers = [("x-amzn-errortype", "UnsupportedMediaTypeException")];
|
2919 3106 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2920 3107 | http_response.headers(),
|
2921 3108 | expected_headers,
|
2922 3109 | ));
|
2923 3110 | }
|
2924 3111 | }
|
2925 3112 |
|
2926 3113 | /// When there is a payload without a mediaType trait, the content type must match the
|
2927 3114 | /// implied content type of the shape.
|
2928 3115 | /// Test ID: RestJsonWithPayloadExpectsImpliedContentType
|
2929 3116 | #[::tokio::test]
|
2930 3117 | #[::tracing_test::traced_test]
|
2931 3118 | async fn rest_json_with_payload_expects_implied_content_type_malformed_request() {
|
2932 3119 | {
|
2933 3120 | #[allow(unused_mut)]
|
2934 - | let mut http_request = http::Request::builder()
|
3121 + | let mut http_request = ::http_1x::Request::builder()
|
2935 3122 | .uri("/MalformedContentTypeWithPayload")
|
2936 3123 | .method("POST")
|
2937 3124 | .header("content-type", "application/json")
|
2938 - | .body(::aws_smithy_http_server::body::Body::from(
|
2939 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2940 - | "{}".as_bytes(),
|
2941 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3125 + | .body(::aws_smithy_http_server::body::boxed(
|
3126 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3127 + | &::aws_smithy_protocol_test::decode_body_data(
|
3128 + | "{}".as_bytes(),
|
3129 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3130 + | ),
|
2942 3131 | )),
|
2943 3132 | ))
|
2944 3133 | .unwrap();
|
2945 3134 | #[allow(unused_mut)]
|
2946 3135 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2947 3136 | let config = crate::service::RestJsonConfig::builder().build();
|
2948 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
3137 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
2949 3138 | .malformed_content_type_with_payload(move |input: crate::input::MalformedContentTypeWithPayloadInput| {
|
2950 3139 | let sender = sender.clone();
|
2951 3140 | async move {
|
2952 3141 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedContentTypeWithPayloadOutput };
|
2953 3142 | sender.send(()).await.expect("receiver dropped early");
|
2954 3143 | result
|
2955 3144 | }
|
2956 3145 | })
|
2957 3146 | .build_unchecked();
|
2958 3147 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2959 3148 | .await
|
2960 3149 | .expect("unable to make an HTTP request");
|
2961 3150 | ::pretty_assertions::assert_eq!(
|
2962 - | http::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
|
3151 + | ::http_1x::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
|
2963 3152 | http_response.status()
|
2964 3153 | );
|
2965 3154 | let expected_headers = [("x-amzn-errortype", "UnsupportedMediaTypeException")];
|
2966 3155 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2967 3156 | http_response.headers(),
|
2968 3157 | expected_headers,
|
2969 3158 | ));
|
2970 3159 | }
|
2971 3160 | }
|
3161 + |
|
3162 + | /* ProtocolTestGenerator.kt:98 */
|
2972 3163 | }
|
2973 3164 |
|
3165 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
2974 3166 | ::pin_project_lite::pin_project! {
|
2975 3167 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2976 3168 | /// [`MalformedContentTypeWithBodyInput`](crate::input::MalformedContentTypeWithBodyInput) using modelled bindings.
|
2977 3169 | pub struct MalformedContentTypeWithBodyInputFuture {
|
2978 3170 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedContentTypeWithBodyInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
2979 3171 | }
|
2980 3172 | }
|
2981 3173 |
|
2982 3174 | impl std::future::Future for MalformedContentTypeWithBodyInputFuture {
|
2983 3175 | type Output = Result<
|
2984 3176 | crate::input::MalformedContentTypeWithBodyInput,
|
2985 3177 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
2986 3178 | >;
|
2987 3179 |
|
2988 3180 | fn poll(
|
2989 3181 | self: std::pin::Pin<&mut Self>,
|
2990 3182 | cx: &mut std::task::Context<'_>,
|
2991 3183 | ) -> std::task::Poll<Self::Output> {
|
2992 3184 | let this = self.project();
|
2993 3185 | this.inner.as_mut().poll(cx)
|
2994 3186 | }
|
2995 3187 | }
|
2996 3188 |
|
2997 3189 | impl<B>
|
2998 3190 | ::aws_smithy_http_server::request::FromRequest<
|
2999 3191 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
3000 3192 | B,
|
3001 3193 | > for crate::input::MalformedContentTypeWithBodyInput
|
3002 3194 | where
|
3003 3195 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
3004 3196 | B: 'static,
|
3005 3197 |
|
3006 3198 | B::Data: Send,
|
3007 3199 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
3008 3200 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
3009 3201 | {
|
3010 3202 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
3011 3203 | type Future = MalformedContentTypeWithBodyInputFuture;
|
3012 3204 |
|
3013 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3205 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
3014 3206 | let fut = async move {
|
3015 3207 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
3016 3208 | request.headers(),
|
3017 3209 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
3018 3210 | ) {
|
3019 3211 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
3020 3212 | }
|
3021 3213 | crate::protocol_serde::shape_malformed_content_type_with_body::de_malformed_content_type_with_body_http_request(request)
|
3022 3214 | .await
|
3023 3215 | };
|
3024 3216 | use ::futures_util::future::TryFutureExt;
|
3025 3217 | let fut = fut.map_err(
|
3026 3218 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
3027 3219 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3028 3220 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
3029 3221 | e,
|
3030 3222 | )
|
3031 3223 | },
|
3032 3224 | );
|
3033 3225 | MalformedContentTypeWithBodyInputFuture {
|
3034 3226 | inner: Box::pin(fut),
|
3035 3227 | }
|
3036 3228 | }
|
3037 3229 | }
|
3230 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
3038 3231 | impl
|
3039 3232 | ::aws_smithy_http_server::response::IntoResponse<
|
3040 3233 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
3041 3234 | > for crate::output::MalformedContentTypeWithBodyOutput
|
3042 3235 | {
|
3043 3236 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3044 3237 | match crate::protocol_serde::shape_malformed_content_type_with_body::ser_malformed_content_type_with_body_http_response(self) {
|
3045 3238 | Ok(response) => response,
|
3046 3239 | Err(e) => {
|
3047 3240 | ::tracing::error!(error = %e, "failed to serialize response");
|
3048 3241 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
3049 3242 | }
|
3050 3243 | }
|
3051 3244 | }
|
3052 3245 | }
|
3053 3246 |
|
3247 + | /* RustType.kt:534 */
|
3054 3248 | #[allow(unreachable_code, unused_variables)]
|
3249 + | /* RustType.kt:534 */
|
3055 3250 | #[cfg(test)]
|
3251 + | /* ProtocolTestGenerator.kt:98 */
|
3056 3252 | mod malformed_content_type_with_body_test {
|
3057 3253 |
|
3058 3254 | /// When there is modeled input, the content type must be application/json
|
3059 3255 | /// Test ID: RestJsonWithBodyExpectsApplicationJsonContentType
|
3060 3256 | #[::tokio::test]
|
3061 3257 | #[::tracing_test::traced_test]
|
3062 3258 | async fn rest_json_with_body_expects_application_json_content_type_malformed_request() {
|
3063 3259 | {
|
3064 3260 | #[allow(unused_mut)]
|
3065 - | let mut http_request = http::Request::builder()
|
3261 + | let mut http_request = ::http_1x::Request::builder()
|
3066 3262 | .uri("/MalformedContentTypeWithBody")
|
3067 3263 | .method("POST")
|
3068 3264 | .header("content-type", "application/hal+json")
|
3069 - | .body(::aws_smithy_http_server::body::Body::from(
|
3070 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3071 - | "{}".as_bytes(),
|
3072 - | ::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 + | "{}".as_bytes(),
|
3269 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3270 + | ),
|
3073 3271 | )),
|
3074 3272 | ))
|
3075 3273 | .unwrap();
|
3076 3274 | #[allow(unused_mut)]
|
3077 3275 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3078 3276 | let config = crate::service::RestJsonConfig::builder().build();
|
3079 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
3277 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3080 3278 | .malformed_content_type_with_body(move |input: crate::input::MalformedContentTypeWithBodyInput| {
|
3081 3279 | let sender = sender.clone();
|
3082 3280 | async move {
|
3083 3281 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedContentTypeWithBodyOutput };
|
3084 3282 | sender.send(()).await.expect("receiver dropped early");
|
3085 3283 | result
|
3086 3284 | }
|
3087 3285 | })
|
3088 3286 | .build_unchecked();
|
3089 3287 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3090 3288 | .await
|
3091 3289 | .expect("unable to make an HTTP request");
|
3092 3290 | ::pretty_assertions::assert_eq!(
|
3093 - | http::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
|
3291 + | ::http_1x::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
|
3094 3292 | http_response.status()
|
3095 3293 | );
|
3096 3294 | let expected_headers = [("x-amzn-errortype", "UnsupportedMediaTypeException")];
|
3097 3295 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3098 3296 | http_response.headers(),
|
3099 3297 | expected_headers,
|
3100 3298 | ));
|
3101 3299 | }
|
3102 3300 | }
|
3103 3301 |
|
3104 3302 | /// When there is modeled input, the content type must be application/json
|
3105 3303 | /// Test ID: RestJsonWithBodyExpectsApplicationJsonContentTypeNoHeaders
|
3106 3304 | #[::tokio::test]
|
3107 3305 | #[::tracing_test::traced_test]
|
3108 3306 | async fn rest_json_with_body_expects_application_json_content_type_no_headers_malformed_request(
|
3109 3307 | ) {
|
3110 3308 | {
|
3111 3309 | #[allow(unused_mut)]
|
3112 - | let mut http_request = http::Request::builder()
|
3310 + | let mut http_request = ::http_1x::Request::builder()
|
3113 3311 | .uri("/MalformedContentTypeWithBody")
|
3114 3312 | .method("POST")
|
3115 - | .body(::aws_smithy_http_server::body::Body::from(
|
3116 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3117 - | "{}".as_bytes(),
|
3118 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3313 + | .body(::aws_smithy_http_server::body::boxed(
|
3314 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3315 + | &::aws_smithy_protocol_test::decode_body_data(
|
3316 + | "{}".as_bytes(),
|
3317 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3318 + | ),
|
3119 3319 | )),
|
3120 3320 | ))
|
3121 3321 | .unwrap();
|
3122 3322 | #[allow(unused_mut)]
|
3123 3323 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3124 3324 | let config = crate::service::RestJsonConfig::builder().build();
|
3125 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
3325 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3126 3326 | .malformed_content_type_with_body(move |input: crate::input::MalformedContentTypeWithBodyInput| {
|
3127 3327 | let sender = sender.clone();
|
3128 3328 | async move {
|
3129 3329 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedContentTypeWithBodyOutput };
|
3130 3330 | sender.send(()).await.expect("receiver dropped early");
|
3131 3331 | result
|
3132 3332 | }
|
3133 3333 | })
|
3134 3334 | .build_unchecked();
|
3135 3335 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3136 3336 | .await
|
3137 3337 | .expect("unable to make an HTTP request");
|
3138 3338 | ::pretty_assertions::assert_eq!(
|
3139 - | http::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
|
3339 + | ::http_1x::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
|
3140 3340 | http_response.status()
|
3141 3341 | );
|
3142 3342 | let expected_headers = [("x-amzn-errortype", "UnsupportedMediaTypeException")];
|
3143 3343 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3144 3344 | http_response.headers(),
|
3145 3345 | expected_headers,
|
3146 3346 | ));
|
3147 3347 | }
|
3148 3348 | }
|
3349 + |
|
3350 + | /* ProtocolTestGenerator.kt:98 */
|
3149 3351 | }
|
3150 3352 |
|
3353 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
3151 3354 | ::pin_project_lite::pin_project! {
|
3152 3355 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3153 3356 | /// [`MalformedContentTypeWithoutBodyEmptyInputInput`](crate::input::MalformedContentTypeWithoutBodyEmptyInputInput) using modelled bindings.
|
3154 3357 | pub struct MalformedContentTypeWithoutBodyEmptyInputInputFuture {
|
3155 3358 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedContentTypeWithoutBodyEmptyInputInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
3156 3359 | }
|
3157 3360 | }
|
3158 3361 |
|
3159 3362 | impl std::future::Future for MalformedContentTypeWithoutBodyEmptyInputInputFuture {
|
3160 3363 | type Output = Result<
|
3161 3364 | crate::input::MalformedContentTypeWithoutBodyEmptyInputInput,
|
3162 3365 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
3163 3366 | >;
|
3164 3367 |
|
3165 3368 | fn poll(
|
3166 3369 | self: std::pin::Pin<&mut Self>,
|
3167 3370 | cx: &mut std::task::Context<'_>,
|
3168 3371 | ) -> std::task::Poll<Self::Output> {
|
3169 3372 | let this = self.project();
|
3170 3373 | this.inner.as_mut().poll(cx)
|
3171 3374 | }
|
3172 3375 | }
|
3173 3376 |
|
3174 3377 | impl<B>
|
3175 3378 | ::aws_smithy_http_server::request::FromRequest<
|
3176 3379 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
3177 3380 | B,
|
3178 3381 | > for crate::input::MalformedContentTypeWithoutBodyEmptyInputInput
|
3179 3382 | where
|
3180 3383 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
3181 3384 | B: 'static,
|
3182 3385 |
|
3183 3386 | B::Data: Send,
|
3184 3387 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
3185 3388 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
3186 3389 | {
|
3187 3390 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
3188 3391 | type Future = MalformedContentTypeWithoutBodyEmptyInputInputFuture;
|
3189 3392 |
|
3190 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3393 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
3191 3394 | let fut = async move {
|
3192 3395 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
3193 3396 | request.headers(),
|
3194 3397 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
3195 3398 | ) {
|
3196 3399 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
3197 3400 | }
|
3198 3401 | crate::protocol_serde::shape_malformed_content_type_without_body_empty_input::de_malformed_content_type_without_body_empty_input_http_request(request)
|
3199 3402 | .await
|
3200 3403 | };
|
3201 3404 | use ::futures_util::future::TryFutureExt;
|
3202 3405 | let fut = fut.map_err(
|
3203 3406 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
3204 3407 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3205 3408 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
3206 3409 | e,
|
3207 3410 | )
|
3208 3411 | },
|
3209 3412 | );
|
3210 3413 | MalformedContentTypeWithoutBodyEmptyInputInputFuture {
|
3211 3414 | inner: Box::pin(fut),
|
3212 3415 | }
|
3213 3416 | }
|
3214 3417 | }
|
3418 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
3215 3419 | impl
|
3216 3420 | ::aws_smithy_http_server::response::IntoResponse<
|
3217 3421 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
3218 3422 | > for crate::output::MalformedContentTypeWithoutBodyEmptyInputOutput
|
3219 3423 | {
|
3220 3424 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3221 3425 | match crate::protocol_serde::shape_malformed_content_type_without_body_empty_input::ser_malformed_content_type_without_body_empty_input_http_response(self) {
|
3222 3426 | Ok(response) => response,
|
3223 3427 | Err(e) => {
|
3224 3428 | ::tracing::error!(error = %e, "failed to serialize response");
|
3225 3429 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
3226 3430 | }
|
3227 3431 | }
|
3228 3432 | }
|
3229 3433 | }
|
3230 3434 |
|
3435 + | /* RustType.kt:534 */
|
3231 3436 | #[allow(unreachable_code, unused_variables)]
|
3437 + | /* RustType.kt:534 */
|
3232 3438 | #[cfg(test)]
|
3439 + | /* ProtocolTestGenerator.kt:98 */
|
3233 3440 | mod malformed_content_type_without_body_empty_input_test {
|
3234 3441 |
|
3235 3442 | /// When there is no modeled body input, content type must not be set and the body must be empty.
|
3236 3443 | /// Test ID: RestJsonWithoutBodyEmptyInputExpectsEmptyContentType
|
3237 3444 | #[::tokio::test]
|
3238 3445 | #[::tracing_test::traced_test]
|
3239 3446 | #[should_panic]
|
3240 3447 | async fn rest_json_without_body_empty_input_expects_empty_content_type_malformed_request() {
|
3241 3448 | {
|
3242 3449 | #[allow(unused_mut)]
|
3243 - | let mut http_request = http::Request::builder()
|
3450 + | let mut http_request = ::http_1x::Request::builder()
|
3244 3451 | .uri("/MalformedContentTypeWithoutBodyEmptyInput")
|
3245 3452 | .method("POST")
|
3246 3453 | .header("content-type", "application/json")
|
3247 - | .body(::aws_smithy_http_server::body::Body::from(
|
3248 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3249 - | "{}".as_bytes(),
|
3250 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3454 + | .body(::aws_smithy_http_server::body::boxed(
|
3455 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3456 + | &::aws_smithy_protocol_test::decode_body_data(
|
3457 + | "{}".as_bytes(),
|
3458 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3459 + | ),
|
3251 3460 | )),
|
3252 3461 | ))
|
3253 3462 | .unwrap();
|
3254 3463 | #[allow(unused_mut)]
|
3255 3464 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3256 3465 | let config = crate::service::RestJsonConfig::builder().build();
|
3257 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
3466 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3258 3467 | .malformed_content_type_without_body_empty_input(move |input: crate::input::MalformedContentTypeWithoutBodyEmptyInputInput| {
|
3259 3468 | let sender = sender.clone();
|
3260 3469 | async move {
|
3261 3470 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedContentTypeWithoutBodyEmptyInputOutput };
|
3262 3471 | sender.send(()).await.expect("receiver dropped early");
|
3263 3472 | result
|
3264 3473 | }
|
3265 3474 | })
|
3266 3475 | .build_unchecked();
|
3267 3476 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3268 3477 | .await
|
3269 3478 | .expect("unable to make an HTTP request");
|
3270 3479 | ::pretty_assertions::assert_eq!(
|
3271 - | http::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
|
3480 + | ::http_1x::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
|
3272 3481 | http_response.status()
|
3273 3482 | );
|
3274 3483 | let expected_headers = [("x-amzn-errortype", "UnsupportedMediaTypeException")];
|
3275 3484 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3276 3485 | http_response.headers(),
|
3277 3486 | expected_headers,
|
3278 3487 | ));
|
3279 3488 | }
|
3280 3489 | }
|
3490 + |
|
3491 + | /* ProtocolTestGenerator.kt:98 */
|
3281 3492 | }
|
3282 3493 |
|
3494 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
3283 3495 | ::pin_project_lite::pin_project! {
|
3284 3496 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3285 3497 | /// [`MalformedContentTypeWithoutBodyInput`](crate::input::MalformedContentTypeWithoutBodyInput) using modelled bindings.
|
3286 3498 | pub struct MalformedContentTypeWithoutBodyInputFuture {
|
3287 3499 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedContentTypeWithoutBodyInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
3288 3500 | }
|
3289 3501 | }
|
3290 3502 |
|
3291 3503 | impl std::future::Future for MalformedContentTypeWithoutBodyInputFuture {
|
3292 3504 | type Output = Result<
|
3293 3505 | crate::input::MalformedContentTypeWithoutBodyInput,
|
3294 3506 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
3295 3507 | >;
|
3296 3508 |
|
3297 3509 | fn poll(
|
3298 3510 | self: std::pin::Pin<&mut Self>,
|
3299 3511 | cx: &mut std::task::Context<'_>,
|
3300 3512 | ) -> std::task::Poll<Self::Output> {
|
3301 3513 | let this = self.project();
|
3302 3514 | this.inner.as_mut().poll(cx)
|
3303 3515 | }
|
3304 3516 | }
|
3305 3517 |
|
3306 3518 | impl<B>
|
3307 3519 | ::aws_smithy_http_server::request::FromRequest<
|
3308 3520 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
3309 3521 | B,
|
3310 3522 | > for crate::input::MalformedContentTypeWithoutBodyInput
|
3311 3523 | where
|
3312 3524 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
3313 3525 | B: 'static,
|
3314 3526 |
|
3315 3527 | B::Data: Send,
|
3316 3528 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
3317 3529 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
3318 3530 | {
|
3319 3531 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
3320 3532 | type Future = MalformedContentTypeWithoutBodyInputFuture;
|
3321 3533 |
|
3322 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3534 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
3323 3535 | let fut = async move {
|
3324 3536 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
3325 3537 | request.headers(),
|
3326 3538 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
3327 3539 | ) {
|
3328 3540 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
3329 3541 | }
|
3330 3542 | crate::protocol_serde::shape_malformed_content_type_without_body::de_malformed_content_type_without_body_http_request(request)
|
3331 3543 | .await
|
3332 3544 | };
|
3333 3545 | use ::futures_util::future::TryFutureExt;
|
3334 3546 | let fut = fut.map_err(
|
3335 3547 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
3336 3548 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3337 3549 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
3338 3550 | e,
|
3339 3551 | )
|
3340 3552 | },
|
3341 3553 | );
|
3342 3554 | MalformedContentTypeWithoutBodyInputFuture {
|
3343 3555 | inner: Box::pin(fut),
|
3344 3556 | }
|
3345 3557 | }
|
3346 3558 | }
|
3559 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
3347 3560 | impl
|
3348 3561 | ::aws_smithy_http_server::response::IntoResponse<
|
3349 3562 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
3350 3563 | > for crate::output::MalformedContentTypeWithoutBodyOutput
|
3351 3564 | {
|
3352 3565 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3353 3566 | match crate::protocol_serde::shape_malformed_content_type_without_body::ser_malformed_content_type_without_body_http_response(self) {
|
3354 3567 | Ok(response) => response,
|
3355 3568 | Err(e) => {
|
3356 3569 | ::tracing::error!(error = %e, "failed to serialize response");
|
3357 3570 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
3358 3571 | }
|
3359 3572 | }
|
3360 3573 | }
|
3361 3574 | }
|
3362 3575 |
|
3576 + | /* RustType.kt:534 */
|
3363 3577 | #[allow(unreachable_code, unused_variables)]
|
3578 + | /* RustType.kt:534 */
|
3364 3579 | #[cfg(test)]
|
3580 + | /* ProtocolTestGenerator.kt:98 */
|
3365 3581 | mod malformed_content_type_without_body_test {
|
3366 3582 |
|
3367 3583 | /// When there is no modeled input, content type must not be set and the body must be empty.
|
3368 3584 | /// Test ID: RestJsonWithoutBodyExpectsEmptyContentType
|
3369 3585 | #[::tokio::test]
|
3370 3586 | #[::tracing_test::traced_test]
|
3371 3587 | async fn rest_json_without_body_expects_empty_content_type_malformed_request() {
|
3372 3588 | {
|
3373 3589 | #[allow(unused_mut)]
|
3374 - | let mut http_request = http::Request::builder()
|
3590 + | let mut http_request = ::http_1x::Request::builder()
|
3375 3591 | .uri("/MalformedContentTypeWithoutBody")
|
3376 3592 | .method("POST")
|
3377 3593 | .header("content-type", "application/json")
|
3378 - | .body(::aws_smithy_http_server::body::Body::from(
|
3379 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3380 - | "{}".as_bytes(),
|
3381 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3594 + | .body(::aws_smithy_http_server::body::boxed(
|
3595 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3596 + | &::aws_smithy_protocol_test::decode_body_data(
|
3597 + | "{}".as_bytes(),
|
3598 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3599 + | ),
|
3382 3600 | )),
|
3383 3601 | ))
|
3384 3602 | .unwrap();
|
3385 3603 | #[allow(unused_mut)]
|
3386 3604 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3387 3605 | let config = crate::service::RestJsonConfig::builder().build();
|
3388 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
3606 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3389 3607 | .malformed_content_type_without_body(move |input: crate::input::MalformedContentTypeWithoutBodyInput| {
|
3390 3608 | let sender = sender.clone();
|
3391 3609 | async move {
|
3392 3610 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedContentTypeWithoutBodyOutput };
|
3393 3611 | sender.send(()).await.expect("receiver dropped early");
|
3394 3612 | result
|
3395 3613 | }
|
3396 3614 | })
|
3397 3615 | .build_unchecked();
|
3398 3616 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3399 3617 | .await
|
3400 3618 | .expect("unable to make an HTTP request");
|
3401 3619 | ::pretty_assertions::assert_eq!(
|
3402 - | http::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
|
3620 + | ::http_1x::StatusCode::from_u16(415).expect("invalid expected HTTP status code"),
|
3403 3621 | http_response.status()
|
3404 3622 | );
|
3405 3623 | let expected_headers = [("x-amzn-errortype", "UnsupportedMediaTypeException")];
|
3406 3624 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3407 3625 | http_response.headers(),
|
3408 3626 | expected_headers,
|
3409 3627 | ));
|
3410 3628 | }
|
3411 3629 | }
|
3630 + |
|
3631 + | /* ProtocolTestGenerator.kt:98 */
|
3412 3632 | }
|
3413 3633 |
|
3634 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
3414 3635 | ::pin_project_lite::pin_project! {
|
3415 3636 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3416 3637 | /// [`MalformedTimestampBodyHttpDateInput`](crate::input::MalformedTimestampBodyHttpDateInput) using modelled bindings.
|
3417 3638 | pub struct MalformedTimestampBodyHttpDateInputFuture {
|
3418 3639 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedTimestampBodyHttpDateInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
3419 3640 | }
|
3420 3641 | }
|
3421 3642 |
|
3422 3643 | impl std::future::Future for MalformedTimestampBodyHttpDateInputFuture {
|
3423 3644 | type Output = Result<
|
3424 3645 | crate::input::MalformedTimestampBodyHttpDateInput,
|
3425 3646 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
3426 3647 | >;
|
3427 3648 |
|
3428 3649 | fn poll(
|
3429 3650 | self: std::pin::Pin<&mut Self>,
|
3430 3651 | cx: &mut std::task::Context<'_>,
|
3431 3652 | ) -> std::task::Poll<Self::Output> {
|
3432 3653 | let this = self.project();
|
3433 3654 | this.inner.as_mut().poll(cx)
|
3434 3655 | }
|
3435 3656 | }
|
3436 3657 |
|
3437 3658 | impl<B>
|
3438 3659 | ::aws_smithy_http_server::request::FromRequest<
|
3439 3660 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
3440 3661 | B,
|
3441 3662 | > for crate::input::MalformedTimestampBodyHttpDateInput
|
3442 3663 | where
|
3443 3664 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
3444 3665 | B: 'static,
|
3445 3666 |
|
3446 3667 | B::Data: Send,
|
3447 3668 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
3448 3669 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
3449 3670 | {
|
3450 3671 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
3451 3672 | type Future = MalformedTimestampBodyHttpDateInputFuture;
|
3452 3673 |
|
3453 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3674 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
3454 3675 | let fut = async move {
|
3455 3676 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
3456 3677 | request.headers(),
|
3457 3678 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
3458 3679 | ) {
|
3459 3680 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
3460 3681 | }
|
3461 3682 | crate::protocol_serde::shape_malformed_timestamp_body_http_date::de_malformed_timestamp_body_http_date_http_request(request)
|
3462 3683 | .await
|
3463 3684 | };
|
3464 3685 | use ::futures_util::future::TryFutureExt;
|
3465 3686 | let fut = fut.map_err(
|
3466 3687 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
3467 3688 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3468 3689 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
3469 3690 | e,
|
3470 3691 | )
|
3471 3692 | },
|
3472 3693 | );
|
3473 3694 | MalformedTimestampBodyHttpDateInputFuture {
|
3474 3695 | inner: Box::pin(fut),
|
3475 3696 | }
|
3476 3697 | }
|
3477 3698 | }
|
3699 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
3478 3700 | impl
|
3479 3701 | ::aws_smithy_http_server::response::IntoResponse<
|
3480 3702 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
3481 3703 | > for crate::output::MalformedTimestampBodyHttpDateOutput
|
3482 3704 | {
|
3483 3705 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3484 3706 | match crate::protocol_serde::shape_malformed_timestamp_body_http_date::ser_malformed_timestamp_body_http_date_http_response(self) {
|
3485 3707 | Ok(response) => response,
|
3486 3708 | Err(e) => {
|
3487 3709 | ::tracing::error!(error = %e, "failed to serialize response");
|
3488 3710 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
3489 3711 | }
|
3490 3712 | }
|
3491 3713 | }
|
3492 3714 | }
|
3715 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
3493 3716 | impl
|
3494 3717 | ::aws_smithy_http_server::response::IntoResponse<
|
3495 3718 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
3496 3719 | > for crate::error::MalformedTimestampBodyHttpDateError
|
3497 3720 | {
|
3498 3721 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3499 3722 | match crate::protocol_serde::shape_malformed_timestamp_body_http_date::ser_malformed_timestamp_body_http_date_http_error(&self) {
|
3500 3723 | Ok(mut response) => {
|
3501 3724 | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
3502 3725 | response
|
3503 3726 | },
|
3504 3727 | Err(e) => {
|
3505 3728 | ::tracing::error!(error = %e, "failed to serialize response");
|
3506 3729 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
3507 3730 | }
|
3508 3731 | }
|
3509 3732 | }
|
3510 3733 | }
|
3511 3734 |
|
3735 + | /* RustType.kt:534 */
|
3512 3736 | #[allow(unreachable_code, unused_variables)]
|
3737 + | /* RustType.kt:534 */
|
3513 3738 | #[cfg(test)]
|
3739 + | /* ProtocolTestGenerator.kt:98 */
|
3514 3740 | mod malformed_timestamp_body_http_date_test {
|
3515 3741 |
|
3516 3742 | /// When the format is http-date, RFC3339 timestamps are rejected with a
|
3517 3743 | /// 400 SerializationException
|
3518 3744 | /// Test ID: RestJsonBodyTimestampHttpDateRejectsDateTime_case0
|
3519 3745 | #[::tokio::test]
|
3520 3746 | #[::tracing_test::traced_test]
|
3521 3747 | async fn rest_json_body_timestamp_http_date_rejects_date_time_case0_malformed_request() {
|
3522 3748 | {
|
3523 3749 | #[allow(unused_mut)]
|
3524 - | let mut http_request = http::Request::builder()
|
3750 + | let mut http_request = ::http_1x::Request::builder()
|
3525 3751 | .uri("/MalformedTimestampBodyHttpDate")
|
3526 3752 | .method("POST")
|
3527 3753 | .header("content-type", "application/json")
|
3528 - | .body(::aws_smithy_http_server::body::Body::from(
|
3529 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3530 - | "{ \"timestamp\": \"1985-04-12T23:20:50.52Z\" }".as_bytes(),
|
3531 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3754 + | .body(::aws_smithy_http_server::body::boxed(
|
3755 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3756 + | &::aws_smithy_protocol_test::decode_body_data(
|
3757 + | "{ \"timestamp\": \"1985-04-12T23:20:50.52Z\" }".as_bytes(),
|
3758 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3759 + | ),
|
3532 3760 | )),
|
3533 3761 | ))
|
3534 3762 | .unwrap();
|
3535 3763 | #[allow(unused_mut)]
|
3536 3764 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3537 3765 | let config = crate::service::RestJsonConfig::builder().build();
|
3538 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
3766 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3539 3767 | .malformed_timestamp_body_http_date(move |input: crate::input::MalformedTimestampBodyHttpDateInput| {
|
3540 3768 | let sender = sender.clone();
|
3541 3769 | async move {
|
3542 3770 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyHttpDateOutput, crate::error::MalformedTimestampBodyHttpDateError> };
|
3543 3771 | sender.send(()).await.expect("receiver dropped early");
|
3544 3772 | result
|
3545 3773 | }
|
3546 3774 | })
|
3547 3775 | .build_unchecked();
|
3548 3776 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3549 3777 | .await
|
3550 3778 | .expect("unable to make an HTTP request");
|
3551 3779 | ::pretty_assertions::assert_eq!(
|
3552 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3780 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3553 3781 | http_response.status()
|
3554 3782 | );
|
3555 3783 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
3556 3784 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3557 3785 | http_response.headers(),
|
3558 3786 | expected_headers,
|
3559 3787 | ));
|
3560 3788 | }
|
3561 3789 | }
|
3562 3790 |
|
3563 3791 | /// When the format is http-date, RFC3339 timestamps are rejected with a
|
3564 3792 | /// 400 SerializationException
|
3565 3793 | /// Test ID: RestJsonBodyTimestampHttpDateRejectsDateTime_case1
|
3566 3794 | #[::tokio::test]
|
3567 3795 | #[::tracing_test::traced_test]
|
3568 3796 | async fn rest_json_body_timestamp_http_date_rejects_date_time_case1_malformed_request() {
|
3569 3797 | {
|
3570 3798 | #[allow(unused_mut)]
|
3571 - | let mut http_request = http::Request::builder()
|
3799 + | let mut http_request = ::http_1x::Request::builder()
|
3572 3800 | .uri("/MalformedTimestampBodyHttpDate")
|
3573 3801 | .method("POST")
|
3574 3802 | .header("content-type", "application/json")
|
3575 - | .body(::aws_smithy_http_server::body::Body::from(
|
3576 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3577 - | "{ \"timestamp\": \"1985-04-12T23:20:50Z\" }".as_bytes(),
|
3578 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3803 + | .body(::aws_smithy_http_server::body::boxed(
|
3804 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3805 + | &::aws_smithy_protocol_test::decode_body_data(
|
3806 + | "{ \"timestamp\": \"1985-04-12T23:20:50Z\" }".as_bytes(),
|
3807 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3808 + | ),
|
3579 3809 | )),
|
3580 3810 | ))
|
3581 3811 | .unwrap();
|
3582 3812 | #[allow(unused_mut)]
|
3583 3813 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3584 3814 | let config = crate::service::RestJsonConfig::builder().build();
|
3585 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
3815 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3586 3816 | .malformed_timestamp_body_http_date(move |input: crate::input::MalformedTimestampBodyHttpDateInput| {
|
3587 3817 | let sender = sender.clone();
|
3588 3818 | async move {
|
3589 3819 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyHttpDateOutput, crate::error::MalformedTimestampBodyHttpDateError> };
|
3590 3820 | sender.send(()).await.expect("receiver dropped early");
|
3591 3821 | result
|
3592 3822 | }
|
3593 3823 | })
|
3594 3824 | .build_unchecked();
|
3595 3825 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3596 3826 | .await
|
3597 3827 | .expect("unable to make an HTTP request");
|
3598 3828 | ::pretty_assertions::assert_eq!(
|
3599 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3829 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3600 3830 | http_response.status()
|
3601 3831 | );
|
3602 3832 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
3603 3833 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3604 3834 | http_response.headers(),
|
3605 3835 | expected_headers,
|
3606 3836 | ));
|
3607 3837 | }
|
3608 3838 | }
|
3609 3839 |
|
3610 3840 | /// When the format is http-date, RFC3339 timestamps are rejected with a
|
3611 3841 | /// 400 SerializationException
|
3612 3842 | /// Test ID: RestJsonBodyTimestampHttpDateRejectsDateTime_case2
|
3613 3843 | #[::tokio::test]
|
3614 3844 | #[::tracing_test::traced_test]
|
3615 3845 | async fn rest_json_body_timestamp_http_date_rejects_date_time_case2_malformed_request() {
|
3616 3846 | {
|
3617 3847 | #[allow(unused_mut)]
|
3618 - | let mut http_request = http::Request::builder()
|
3848 + | let mut http_request = ::http_1x::Request::builder()
|
3619 3849 | .uri("/MalformedTimestampBodyHttpDate")
|
3620 3850 | .method("POST")
|
3621 3851 | .header("content-type", "application/json")
|
3622 - | .body(::aws_smithy_http_server::body::Body::from(
|
3623 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3624 - | "{ \"timestamp\": \"1996-12-19T16:39:57-08:00\" }".as_bytes(),
|
3625 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3852 + | .body(::aws_smithy_http_server::body::boxed(
|
3853 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3854 + | &::aws_smithy_protocol_test::decode_body_data(
|
3855 + | "{ \"timestamp\": \"1996-12-19T16:39:57-08:00\" }".as_bytes(),
|
3856 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3857 + | ),
|
3626 3858 | )),
|
3627 3859 | ))
|
3628 3860 | .unwrap();
|
3629 3861 | #[allow(unused_mut)]
|
3630 3862 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3631 3863 | let config = crate::service::RestJsonConfig::builder().build();
|
3632 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
3864 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3633 3865 | .malformed_timestamp_body_http_date(move |input: crate::input::MalformedTimestampBodyHttpDateInput| {
|
3634 3866 | let sender = sender.clone();
|
3635 3867 | async move {
|
3636 3868 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyHttpDateOutput, crate::error::MalformedTimestampBodyHttpDateError> };
|
3637 3869 | sender.send(()).await.expect("receiver dropped early");
|
3638 3870 | result
|
3639 3871 | }
|
3640 3872 | })
|
3641 3873 | .build_unchecked();
|
3642 3874 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3643 3875 | .await
|
3644 3876 | .expect("unable to make an HTTP request");
|
3645 3877 | ::pretty_assertions::assert_eq!(
|
3646 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3878 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3647 3879 | http_response.status()
|
3648 3880 | );
|
3649 3881 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
3650 3882 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3651 3883 | http_response.headers(),
|
3652 3884 | expected_headers,
|
3653 3885 | ));
|
3654 3886 | }
|
3655 3887 | }
|
3656 3888 |
|
3657 3889 | /// When the format is http-date, epoch-seconds timestamps are rejected with a
|
3658 3890 | /// 400 SerializationException
|
3659 3891 | /// Test ID: RestJsonBodyTimestampHttpDateRejectsEpoch_case0
|
3660 3892 | #[::tokio::test]
|
3661 3893 | #[::tracing_test::traced_test]
|
3662 3894 | async fn rest_json_body_timestamp_http_date_rejects_epoch_case0_malformed_request() {
|
3663 3895 | {
|
3664 3896 | #[allow(unused_mut)]
|
3665 - | let mut http_request = http::Request::builder()
|
3897 + | let mut http_request = ::http_1x::Request::builder()
|
3666 3898 | .uri("/MalformedTimestampBodyHttpDate")
|
3667 3899 | .method("POST")
|
3668 3900 | .header("content-type", "application/json")
|
3669 - | .body(::aws_smithy_http_server::body::Body::from(
|
3670 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3671 - | "{ \"timestamp\": 1515531081.1234 }".as_bytes(),
|
3672 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3901 + | .body(::aws_smithy_http_server::body::boxed(
|
3902 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3903 + | &::aws_smithy_protocol_test::decode_body_data(
|
3904 + | "{ \"timestamp\": 1515531081.1234 }".as_bytes(),
|
3905 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3906 + | ),
|
3673 3907 | )),
|
3674 3908 | ))
|
3675 3909 | .unwrap();
|
3676 3910 | #[allow(unused_mut)]
|
3677 3911 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3678 3912 | let config = crate::service::RestJsonConfig::builder().build();
|
3679 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
3913 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3680 3914 | .malformed_timestamp_body_http_date(move |input: crate::input::MalformedTimestampBodyHttpDateInput| {
|
3681 3915 | let sender = sender.clone();
|
3682 3916 | async move {
|
3683 3917 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyHttpDateOutput, crate::error::MalformedTimestampBodyHttpDateError> };
|
3684 3918 | sender.send(()).await.expect("receiver dropped early");
|
3685 3919 | result
|
3686 3920 | }
|
3687 3921 | })
|
3688 3922 | .build_unchecked();
|
3689 3923 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3690 3924 | .await
|
3691 3925 | .expect("unable to make an HTTP request");
|
3692 3926 | ::pretty_assertions::assert_eq!(
|
3693 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3927 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3694 3928 | http_response.status()
|
3695 3929 | );
|
3696 3930 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
3697 3931 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3698 3932 | http_response.headers(),
|
3699 3933 | expected_headers,
|
3700 3934 | ));
|
3701 3935 | }
|
3702 3936 | }
|
3703 3937 |
|
3704 3938 | /// When the format is http-date, epoch-seconds timestamps are rejected with a
|
3705 3939 | /// 400 SerializationException
|
3706 3940 | /// Test ID: RestJsonBodyTimestampHttpDateRejectsEpoch_case1
|
3707 3941 | #[::tokio::test]
|
3708 3942 | #[::tracing_test::traced_test]
|
3709 3943 | async fn rest_json_body_timestamp_http_date_rejects_epoch_case1_malformed_request() {
|
3710 3944 | {
|
3711 3945 | #[allow(unused_mut)]
|
3712 - | let mut http_request = http::Request::builder()
|
3946 + | let mut http_request = ::http_1x::Request::builder()
|
3713 3947 | .uri("/MalformedTimestampBodyHttpDate")
|
3714 3948 | .method("POST")
|
3715 3949 | .header("content-type", "application/json")
|
3716 - | .body(::aws_smithy_http_server::body::Body::from(
|
3717 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3718 - | "{ \"timestamp\": 1515531081 }".as_bytes(),
|
3719 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3950 + | .body(::aws_smithy_http_server::body::boxed(
|
3951 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3952 + | &::aws_smithy_protocol_test::decode_body_data(
|
3953 + | "{ \"timestamp\": 1515531081 }".as_bytes(),
|
3954 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
3955 + | ),
|
3720 3956 | )),
|
3721 3957 | ))
|
3722 3958 | .unwrap();
|
3723 3959 | #[allow(unused_mut)]
|
3724 3960 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3725 3961 | let config = crate::service::RestJsonConfig::builder().build();
|
3726 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
3962 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3727 3963 | .malformed_timestamp_body_http_date(move |input: crate::input::MalformedTimestampBodyHttpDateInput| {
|
3728 3964 | let sender = sender.clone();
|
3729 3965 | async move {
|
3730 3966 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyHttpDateOutput, crate::error::MalformedTimestampBodyHttpDateError> };
|
3731 3967 | sender.send(()).await.expect("receiver dropped early");
|
3732 3968 | result
|
3733 3969 | }
|
3734 3970 | })
|
3735 3971 | .build_unchecked();
|
3736 3972 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3737 3973 | .await
|
3738 3974 | .expect("unable to make an HTTP request");
|
3739 3975 | ::pretty_assertions::assert_eq!(
|
3740 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3976 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3741 3977 | http_response.status()
|
3742 3978 | );
|
3743 3979 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
3744 3980 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3745 3981 | http_response.headers(),
|
3746 3982 | expected_headers,
|
3747 3983 | ));
|
3748 3984 | }
|
3749 3985 | }
|
3986 + |
|
3987 + | /* ProtocolTestGenerator.kt:98 */
|
3750 3988 | }
|
3751 3989 |
|
3990 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
3752 3991 | ::pin_project_lite::pin_project! {
|
3753 3992 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3754 3993 | /// [`MalformedTimestampBodyDateTimeInput`](crate::input::MalformedTimestampBodyDateTimeInput) using modelled bindings.
|
3755 3994 | pub struct MalformedTimestampBodyDateTimeInputFuture {
|
3756 3995 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedTimestampBodyDateTimeInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
3757 3996 | }
|
3758 3997 | }
|
3759 3998 |
|
3760 3999 | impl std::future::Future for MalformedTimestampBodyDateTimeInputFuture {
|
3761 4000 | type Output = Result<
|
3762 4001 | crate::input::MalformedTimestampBodyDateTimeInput,
|
3763 4002 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
3764 4003 | >;
|
3765 4004 |
|
3766 4005 | fn poll(
|
3767 4006 | self: std::pin::Pin<&mut Self>,
|
3768 4007 | cx: &mut std::task::Context<'_>,
|
3769 4008 | ) -> std::task::Poll<Self::Output> {
|
3770 4009 | let this = self.project();
|
3771 4010 | this.inner.as_mut().poll(cx)
|
3772 4011 | }
|
3773 4012 | }
|
3774 4013 |
|
3775 4014 | impl<B>
|
3776 4015 | ::aws_smithy_http_server::request::FromRequest<
|
3777 4016 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
3778 4017 | B,
|
3779 4018 | > for crate::input::MalformedTimestampBodyDateTimeInput
|
3780 4019 | where
|
3781 4020 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
3782 4021 | B: 'static,
|
3783 4022 |
|
3784 4023 | B::Data: Send,
|
3785 4024 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
3786 4025 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
3787 4026 | {
|
3788 4027 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
3789 4028 | type Future = MalformedTimestampBodyDateTimeInputFuture;
|
3790 4029 |
|
3791 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
4030 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
3792 4031 | let fut = async move {
|
3793 4032 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
3794 4033 | request.headers(),
|
3795 4034 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
3796 4035 | ) {
|
3797 4036 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
3798 4037 | }
|
3799 4038 | crate::protocol_serde::shape_malformed_timestamp_body_date_time::de_malformed_timestamp_body_date_time_http_request(request)
|
3800 4039 | .await
|
3801 4040 | };
|
3802 4041 | use ::futures_util::future::TryFutureExt;
|
3803 4042 | let fut = fut.map_err(
|
3804 4043 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
3805 4044 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3806 4045 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
3807 4046 | e,
|
3808 4047 | )
|
3809 4048 | },
|
3810 4049 | );
|
3811 4050 | MalformedTimestampBodyDateTimeInputFuture {
|
3812 4051 | inner: Box::pin(fut),
|
3813 4052 | }
|
3814 4053 | }
|
3815 4054 | }
|
4055 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
3816 4056 | impl
|
3817 4057 | ::aws_smithy_http_server::response::IntoResponse<
|
3818 4058 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
3819 4059 | > for crate::output::MalformedTimestampBodyDateTimeOutput
|
3820 4060 | {
|
3821 4061 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3822 4062 | match crate::protocol_serde::shape_malformed_timestamp_body_date_time::ser_malformed_timestamp_body_date_time_http_response(self) {
|
3823 4063 | Ok(response) => response,
|
3824 4064 | Err(e) => {
|
3825 4065 | ::tracing::error!(error = %e, "failed to serialize response");
|
3826 4066 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
3827 4067 | }
|
3828 4068 | }
|
3829 4069 | }
|
3830 4070 | }
|
4071 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
3831 4072 | impl
|
3832 4073 | ::aws_smithy_http_server::response::IntoResponse<
|
3833 4074 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
3834 4075 | > for crate::error::MalformedTimestampBodyDateTimeError
|
3835 4076 | {
|
3836 4077 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3837 4078 | match crate::protocol_serde::shape_malformed_timestamp_body_date_time::ser_malformed_timestamp_body_date_time_http_error(&self) {
|
3838 4079 | Ok(mut response) => {
|
3839 4080 | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
3840 4081 | response
|
3841 4082 | },
|
3842 4083 | Err(e) => {
|
3843 4084 | ::tracing::error!(error = %e, "failed to serialize response");
|
3844 4085 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
3845 4086 | }
|
3846 4087 | }
|
3847 4088 | }
|
3848 4089 | }
|
3849 4090 |
|
4091 + | /* RustType.kt:534 */
|
3850 4092 | #[allow(unreachable_code, unused_variables)]
|
4093 + | /* RustType.kt:534 */
|
3851 4094 | #[cfg(test)]
|
4095 + | /* ProtocolTestGenerator.kt:98 */
|
3852 4096 | mod malformed_timestamp_body_date_time_test {
|
3853 4097 |
|
3854 4098 | /// When the format is date-time, IMF-fixdate timestamps are rejected with a
|
3855 4099 | /// 400 SerializationException
|
3856 4100 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsHttpDate_case0
|
3857 4101 | #[::tokio::test]
|
3858 4102 | #[::tracing_test::traced_test]
|
3859 4103 | async fn rest_json_body_timestamp_date_time_rejects_http_date_case0_malformed_request() {
|
3860 4104 | {
|
3861 4105 | #[allow(unused_mut)]
|
3862 - | let mut http_request = http::Request::builder()
|
4106 + | let mut http_request = ::http_1x::Request::builder()
|
3863 4107 | .uri("/MalformedTimestampBodyDateTime")
|
3864 4108 | .method("POST")
|
3865 4109 | .header("content-type", "application/json")
|
3866 - | .body(::aws_smithy_http_server::body::Body::from(
|
3867 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3868 - | "{ \"timestamp\": \"Tue, 29 Apr 2014 18:30:38 GMT\" }".as_bytes(),
|
3869 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4110 + | .body(::aws_smithy_http_server::body::boxed(
|
4111 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4112 + | &::aws_smithy_protocol_test::decode_body_data(
|
4113 + | "{ \"timestamp\": \"Tue, 29 Apr 2014 18:30:38 GMT\" }".as_bytes(),
|
4114 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4115 + | ),
|
3870 4116 | )),
|
3871 4117 | ))
|
3872 4118 | .unwrap();
|
3873 4119 | #[allow(unused_mut)]
|
3874 4120 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3875 4121 | let config = crate::service::RestJsonConfig::builder().build();
|
3876 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4122 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3877 4123 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
3878 4124 | let sender = sender.clone();
|
3879 4125 | async move {
|
3880 4126 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
3881 4127 | sender.send(()).await.expect("receiver dropped early");
|
3882 4128 | result
|
3883 4129 | }
|
3884 4130 | })
|
3885 4131 | .build_unchecked();
|
3886 4132 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3887 4133 | .await
|
3888 4134 | .expect("unable to make an HTTP request");
|
3889 4135 | ::pretty_assertions::assert_eq!(
|
3890 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4136 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3891 4137 | http_response.status()
|
3892 4138 | );
|
3893 4139 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
3894 4140 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3895 4141 | http_response.headers(),
|
3896 4142 | expected_headers,
|
3897 4143 | ));
|
3898 4144 | }
|
3899 4145 | }
|
3900 4146 |
|
3901 4147 | /// When the format is date-time, epoch-seconds timestamps are rejected with a
|
3902 4148 | /// 400 SerializationException
|
3903 4149 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsEpochSeconds_case0
|
3904 4150 | #[::tokio::test]
|
3905 4151 | #[::tracing_test::traced_test]
|
3906 4152 | async fn rest_json_body_timestamp_date_time_rejects_epoch_seconds_case0_malformed_request() {
|
3907 4153 | {
|
3908 4154 | #[allow(unused_mut)]
|
3909 - | let mut http_request = http::Request::builder()
|
4155 + | let mut http_request = ::http_1x::Request::builder()
|
3910 4156 | .uri("/MalformedTimestampBodyDateTime")
|
3911 4157 | .method("POST")
|
3912 4158 | .header("content-type", "application/json")
|
3913 - | .body(::aws_smithy_http_server::body::Body::from(
|
3914 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3915 - | "{ \"timestamp\": 1515531081.1234 }".as_bytes(),
|
3916 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4159 + | .body(::aws_smithy_http_server::body::boxed(
|
4160 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4161 + | &::aws_smithy_protocol_test::decode_body_data(
|
4162 + | "{ \"timestamp\": 1515531081.1234 }".as_bytes(),
|
4163 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4164 + | ),
|
3917 4165 | )),
|
3918 4166 | ))
|
3919 4167 | .unwrap();
|
3920 4168 | #[allow(unused_mut)]
|
3921 4169 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3922 4170 | let config = crate::service::RestJsonConfig::builder().build();
|
3923 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4171 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3924 4172 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
3925 4173 | let sender = sender.clone();
|
3926 4174 | async move {
|
3927 4175 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
3928 4176 | sender.send(()).await.expect("receiver dropped early");
|
3929 4177 | result
|
3930 4178 | }
|
3931 4179 | })
|
3932 4180 | .build_unchecked();
|
3933 4181 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3934 4182 | .await
|
3935 4183 | .expect("unable to make an HTTP request");
|
3936 4184 | ::pretty_assertions::assert_eq!(
|
3937 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4185 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3938 4186 | http_response.status()
|
3939 4187 | );
|
3940 4188 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
3941 4189 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3942 4190 | http_response.headers(),
|
3943 4191 | expected_headers,
|
3944 4192 | ));
|
3945 4193 | }
|
3946 4194 | }
|
3947 4195 |
|
3948 4196 | /// When the format is date-time, epoch-seconds timestamps are rejected with a
|
3949 4197 | /// 400 SerializationException
|
3950 4198 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsEpochSeconds_case1
|
3951 4199 | #[::tokio::test]
|
3952 4200 | #[::tracing_test::traced_test]
|
3953 4201 | async fn rest_json_body_timestamp_date_time_rejects_epoch_seconds_case1_malformed_request() {
|
3954 4202 | {
|
3955 4203 | #[allow(unused_mut)]
|
3956 - | let mut http_request = http::Request::builder()
|
4204 + | let mut http_request = ::http_1x::Request::builder()
|
3957 4205 | .uri("/MalformedTimestampBodyDateTime")
|
3958 4206 | .method("POST")
|
3959 4207 | .header("content-type", "application/json")
|
3960 - | .body(::aws_smithy_http_server::body::Body::from(
|
3961 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3962 - | "{ \"timestamp\": 1515531081 }".as_bytes(),
|
3963 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4208 + | .body(::aws_smithy_http_server::body::boxed(
|
4209 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4210 + | &::aws_smithy_protocol_test::decode_body_data(
|
4211 + | "{ \"timestamp\": 1515531081 }".as_bytes(),
|
4212 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4213 + | ),
|
3964 4214 | )),
|
3965 4215 | ))
|
3966 4216 | .unwrap();
|
3967 4217 | #[allow(unused_mut)]
|
3968 4218 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3969 4219 | let config = crate::service::RestJsonConfig::builder().build();
|
3970 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4220 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
3971 4221 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
3972 4222 | let sender = sender.clone();
|
3973 4223 | async move {
|
3974 4224 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
3975 4225 | sender.send(()).await.expect("receiver dropped early");
|
3976 4226 | result
|
3977 4227 | }
|
3978 4228 | })
|
3979 4229 | .build_unchecked();
|
3980 4230 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3981 4231 | .await
|
3982 4232 | .expect("unable to make an HTTP request");
|
3983 4233 | ::pretty_assertions::assert_eq!(
|
3984 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4234 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
3985 4235 | http_response.status()
|
3986 4236 | );
|
3987 4237 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
3988 4238 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3989 4239 | http_response.headers(),
|
3990 4240 | expected_headers,
|
3991 4241 | ));
|
3992 4242 | }
|
3993 4243 | }
|
3994 4244 |
|
3995 4245 | /// When the format is date-time, RFC 3339 timestamps with a UTC offset are rejected with a
|
3996 4246 | /// 400 SerializationException
|
3997 4247 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsUTCOffsets_case0
|
3998 4248 | #[::tokio::test]
|
3999 4249 | #[::tracing_test::traced_test]
|
4000 4250 | async fn rest_json_body_timestamp_date_time_rejects_utc_offsets_case0_malformed_request() {
|
4001 4251 | {
|
4002 4252 | #[allow(unused_mut)]
|
4003 - | let mut http_request = http::Request::builder()
|
4253 + | let mut http_request = ::http_1x::Request::builder()
|
4004 4254 | .uri("/MalformedTimestampBodyDateTime")
|
4005 4255 | .method("POST")
|
4006 4256 | .header("content-type", "application/json")
|
4007 - | .body(::aws_smithy_http_server::body::Body::from(
|
4008 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4009 - | "{ \"timestamp\": \"1996-12-19T16:39:57-08:00\" }".as_bytes(),
|
4010 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4257 + | .body(::aws_smithy_http_server::body::boxed(
|
4258 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4259 + | &::aws_smithy_protocol_test::decode_body_data(
|
4260 + | "{ \"timestamp\": \"1996-12-19T16:39:57-08:00\" }".as_bytes(),
|
4261 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4262 + | ),
|
4011 4263 | )),
|
4012 4264 | ))
|
4013 4265 | .unwrap();
|
4014 4266 | #[allow(unused_mut)]
|
4015 4267 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4016 4268 | let config = crate::service::RestJsonConfig::builder().build();
|
4017 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4269 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4018 4270 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
4019 4271 | let sender = sender.clone();
|
4020 4272 | async move {
|
4021 4273 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
4022 4274 | sender.send(()).await.expect("receiver dropped early");
|
4023 4275 | result
|
4024 4276 | }
|
4025 4277 | })
|
4026 4278 | .build_unchecked();
|
4027 4279 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4028 4280 | .await
|
4029 4281 | .expect("unable to make an HTTP request");
|
4030 4282 | ::pretty_assertions::assert_eq!(
|
4031 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4283 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4032 4284 | http_response.status()
|
4033 4285 | );
|
4034 4286 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4035 4287 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4036 4288 | http_response.headers(),
|
4037 4289 | expected_headers,
|
4038 4290 | ));
|
4039 4291 | }
|
4040 4292 | }
|
4041 4293 |
|
4042 4294 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
4043 4295 | /// are rejected with a 400 SerializationException
|
4044 4296 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsDifferent8601Formats_case0
|
4045 4297 | #[::tokio::test]
|
4046 4298 | #[::tracing_test::traced_test]
|
4047 4299 | async fn rest_json_body_timestamp_date_time_rejects_different8601_formats_case0_malformed_request(
|
4048 4300 | ) {
|
4049 4301 | {
|
4050 4302 | #[allow(unused_mut)]
|
4051 - | let mut http_request = http::Request::builder()
|
4303 + | let mut http_request = ::http_1x::Request::builder()
|
4052 4304 | .uri("/MalformedTimestampBodyDateTime")
|
4053 4305 | .method("POST")
|
4054 4306 | .header("content-type", "application/json")
|
4055 - | .body(::aws_smithy_http_server::body::Body::from(
|
4056 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4057 - | "{ \"timestamp\": \"1996-12-19T16:39:57+00\" }".as_bytes(),
|
4058 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4307 + | .body(::aws_smithy_http_server::body::boxed(
|
4308 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4309 + | &::aws_smithy_protocol_test::decode_body_data(
|
4310 + | "{ \"timestamp\": \"1996-12-19T16:39:57+00\" }".as_bytes(),
|
4311 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4312 + | ),
|
4059 4313 | )),
|
4060 4314 | ))
|
4061 4315 | .unwrap();
|
4062 4316 | #[allow(unused_mut)]
|
4063 4317 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4064 4318 | let config = crate::service::RestJsonConfig::builder().build();
|
4065 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4319 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4066 4320 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
4067 4321 | let sender = sender.clone();
|
4068 4322 | async move {
|
4069 4323 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
4070 4324 | sender.send(()).await.expect("receiver dropped early");
|
4071 4325 | result
|
4072 4326 | }
|
4073 4327 | })
|
4074 4328 | .build_unchecked();
|
4075 4329 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4076 4330 | .await
|
4077 4331 | .expect("unable to make an HTTP request");
|
4078 4332 | ::pretty_assertions::assert_eq!(
|
4079 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4333 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4080 4334 | http_response.status()
|
4081 4335 | );
|
4082 4336 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4083 4337 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4084 4338 | http_response.headers(),
|
4085 4339 | expected_headers,
|
4086 4340 | ));
|
4087 4341 | }
|
4088 4342 | }
|
4089 4343 |
|
4090 4344 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
4091 4345 | /// are rejected with a 400 SerializationException
|
4092 4346 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsDifferent8601Formats_case1
|
4093 4347 | #[::tokio::test]
|
4094 4348 | #[::tracing_test::traced_test]
|
4095 4349 | async fn rest_json_body_timestamp_date_time_rejects_different8601_formats_case1_malformed_request(
|
4096 4350 | ) {
|
4097 4351 | {
|
4098 4352 | #[allow(unused_mut)]
|
4099 - | let mut http_request = http::Request::builder()
|
4353 + | let mut http_request = ::http_1x::Request::builder()
|
4100 4354 | .uri("/MalformedTimestampBodyDateTime")
|
4101 4355 | .method("POST")
|
4102 4356 | .header("content-type", "application/json")
|
4103 - | .body(::aws_smithy_http_server::body::Body::from(
|
4104 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4105 - | "{ \"timestamp\": \"1996-12-19T16:39:57+00Z\" }".as_bytes(),
|
4106 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4357 + | .body(::aws_smithy_http_server::body::boxed(
|
4358 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4359 + | &::aws_smithy_protocol_test::decode_body_data(
|
4360 + | "{ \"timestamp\": \"1996-12-19T16:39:57+00Z\" }".as_bytes(),
|
4361 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4362 + | ),
|
4107 4363 | )),
|
4108 4364 | ))
|
4109 4365 | .unwrap();
|
4110 4366 | #[allow(unused_mut)]
|
4111 4367 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4112 4368 | let config = crate::service::RestJsonConfig::builder().build();
|
4113 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4369 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4114 4370 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
4115 4371 | let sender = sender.clone();
|
4116 4372 | async move {
|
4117 4373 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
4118 4374 | sender.send(()).await.expect("receiver dropped early");
|
4119 4375 | result
|
4120 4376 | }
|
4121 4377 | })
|
4122 4378 | .build_unchecked();
|
4123 4379 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4124 4380 | .await
|
4125 4381 | .expect("unable to make an HTTP request");
|
4126 4382 | ::pretty_assertions::assert_eq!(
|
4127 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4383 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4128 4384 | http_response.status()
|
4129 4385 | );
|
4130 4386 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4131 4387 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4132 4388 | http_response.headers(),
|
4133 4389 | expected_headers,
|
4134 4390 | ));
|
4135 4391 | }
|
4136 4392 | }
|
4137 4393 |
|
4138 4394 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
4139 4395 | /// are rejected with a 400 SerializationException
|
4140 4396 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsDifferent8601Formats_case2
|
4141 4397 | #[::tokio::test]
|
4142 4398 | #[::tracing_test::traced_test]
|
4143 4399 | async fn rest_json_body_timestamp_date_time_rejects_different8601_formats_case2_malformed_request(
|
4144 4400 | ) {
|
4145 4401 | {
|
4146 4402 | #[allow(unused_mut)]
|
4147 - | let mut http_request = http::Request::builder()
|
4403 + | let mut http_request = ::http_1x::Request::builder()
|
4148 4404 | .uri("/MalformedTimestampBodyDateTime")
|
4149 4405 | .method("POST")
|
4150 4406 | .header("content-type", "application/json")
|
4151 - | .body(::aws_smithy_http_server::body::Body::from(
|
4152 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4153 - | "{ \"timestamp\": \"1996-12-19T16:39:57\" }".as_bytes(),
|
4154 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4407 + | .body(::aws_smithy_http_server::body::boxed(
|
4408 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4409 + | &::aws_smithy_protocol_test::decode_body_data(
|
4410 + | "{ \"timestamp\": \"1996-12-19T16:39:57\" }".as_bytes(),
|
4411 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4412 + | ),
|
4155 4413 | )),
|
4156 4414 | ))
|
4157 4415 | .unwrap();
|
4158 4416 | #[allow(unused_mut)]
|
4159 4417 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4160 4418 | let config = crate::service::RestJsonConfig::builder().build();
|
4161 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4419 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4162 4420 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
4163 4421 | let sender = sender.clone();
|
4164 4422 | async move {
|
4165 4423 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
4166 4424 | sender.send(()).await.expect("receiver dropped early");
|
4167 4425 | result
|
4168 4426 | }
|
4169 4427 | })
|
4170 4428 | .build_unchecked();
|
4171 4429 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4172 4430 | .await
|
4173 4431 | .expect("unable to make an HTTP request");
|
4174 4432 | ::pretty_assertions::assert_eq!(
|
4175 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4433 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4176 4434 | http_response.status()
|
4177 4435 | );
|
4178 4436 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4179 4437 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4180 4438 | http_response.headers(),
|
4181 4439 | expected_headers,
|
4182 4440 | ));
|
4183 4441 | }
|
4184 4442 | }
|
4185 4443 |
|
4186 4444 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
4187 4445 | /// are rejected with a 400 SerializationException
|
4188 4446 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsDifferent8601Formats_case3
|
4189 4447 | #[::tokio::test]
|
4190 4448 | #[::tracing_test::traced_test]
|
4191 4449 | async fn rest_json_body_timestamp_date_time_rejects_different8601_formats_case3_malformed_request(
|
4192 4450 | ) {
|
4193 4451 | {
|
4194 4452 | #[allow(unused_mut)]
|
4195 - | let mut http_request = http::Request::builder()
|
4453 + | let mut http_request = ::http_1x::Request::builder()
|
4196 4454 | .uri("/MalformedTimestampBodyDateTime")
|
4197 4455 | .method("POST")
|
4198 4456 | .header("content-type", "application/json")
|
4199 - | .body(::aws_smithy_http_server::body::Body::from(
|
4200 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4201 - | "{ \"timestamp\": \"1996-12-19T163957\" }".as_bytes(),
|
4202 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4457 + | .body(::aws_smithy_http_server::body::boxed(
|
4458 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4459 + | &::aws_smithy_protocol_test::decode_body_data(
|
4460 + | "{ \"timestamp\": \"1996-12-19T163957\" }".as_bytes(),
|
4461 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4462 + | ),
|
4203 4463 | )),
|
4204 4464 | ))
|
4205 4465 | .unwrap();
|
4206 4466 | #[allow(unused_mut)]
|
4207 4467 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4208 4468 | let config = crate::service::RestJsonConfig::builder().build();
|
4209 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4469 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4210 4470 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
4211 4471 | let sender = sender.clone();
|
4212 4472 | async move {
|
4213 4473 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
4214 4474 | sender.send(()).await.expect("receiver dropped early");
|
4215 4475 | result
|
4216 4476 | }
|
4217 4477 | })
|
4218 4478 | .build_unchecked();
|
4219 4479 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4220 4480 | .await
|
4221 4481 | .expect("unable to make an HTTP request");
|
4222 4482 | ::pretty_assertions::assert_eq!(
|
4223 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4483 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4224 4484 | http_response.status()
|
4225 4485 | );
|
4226 4486 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4227 4487 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4228 4488 | http_response.headers(),
|
4229 4489 | expected_headers,
|
4230 4490 | ));
|
4231 4491 | }
|
4232 4492 | }
|
4233 4493 |
|
4234 4494 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
4235 4495 | /// are rejected with a 400 SerializationException
|
4236 4496 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsDifferent8601Formats_case4
|
4237 4497 | #[::tokio::test]
|
4238 4498 | #[::tracing_test::traced_test]
|
4239 4499 | async fn rest_json_body_timestamp_date_time_rejects_different8601_formats_case4_malformed_request(
|
4240 4500 | ) {
|
4241 4501 | {
|
4242 4502 | #[allow(unused_mut)]
|
4243 - | let mut http_request = http::Request::builder()
|
4503 + | let mut http_request = ::http_1x::Request::builder()
|
4244 4504 | .uri("/MalformedTimestampBodyDateTime")
|
4245 4505 | .method("POST")
|
4246 4506 | .header("content-type", "application/json")
|
4247 - | .body(::aws_smithy_http_server::body::Body::from(
|
4248 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4249 - | "{ \"timestamp\": \"19961219T163957Z\" }".as_bytes(),
|
4250 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4507 + | .body(::aws_smithy_http_server::body::boxed(
|
4508 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4509 + | &::aws_smithy_protocol_test::decode_body_data(
|
4510 + | "{ \"timestamp\": \"19961219T163957Z\" }".as_bytes(),
|
4511 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4512 + | ),
|
4251 4513 | )),
|
4252 4514 | ))
|
4253 4515 | .unwrap();
|
4254 4516 | #[allow(unused_mut)]
|
4255 4517 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4256 4518 | let config = crate::service::RestJsonConfig::builder().build();
|
4257 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4519 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4258 4520 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
4259 4521 | let sender = sender.clone();
|
4260 4522 | async move {
|
4261 4523 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
4262 4524 | sender.send(()).await.expect("receiver dropped early");
|
4263 4525 | result
|
4264 4526 | }
|
4265 4527 | })
|
4266 4528 | .build_unchecked();
|
4267 4529 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4268 4530 | .await
|
4269 4531 | .expect("unable to make an HTTP request");
|
4270 4532 | ::pretty_assertions::assert_eq!(
|
4271 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4533 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4272 4534 | http_response.status()
|
4273 4535 | );
|
4274 4536 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4275 4537 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4276 4538 | http_response.headers(),
|
4277 4539 | expected_headers,
|
4278 4540 | ));
|
4279 4541 | }
|
4280 4542 | }
|
4281 4543 |
|
4282 4544 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
4283 4545 | /// are rejected with a 400 SerializationException
|
4284 4546 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsDifferent8601Formats_case5
|
4285 4547 | #[::tokio::test]
|
4286 4548 | #[::tracing_test::traced_test]
|
4287 4549 | async fn rest_json_body_timestamp_date_time_rejects_different8601_formats_case5_malformed_request(
|
4288 4550 | ) {
|
4289 4551 | {
|
4290 4552 | #[allow(unused_mut)]
|
4291 - | let mut http_request = http::Request::builder()
|
4553 + | let mut http_request = ::http_1x::Request::builder()
|
4292 4554 | .uri("/MalformedTimestampBodyDateTime")
|
4293 4555 | .method("POST")
|
4294 4556 | .header("content-type", "application/json")
|
4295 - | .body(::aws_smithy_http_server::body::Body::from(
|
4296 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4297 - | "{ \"timestamp\": \"19961219T163957\" }".as_bytes(),
|
4298 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4557 + | .body(::aws_smithy_http_server::body::boxed(
|
4558 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4559 + | &::aws_smithy_protocol_test::decode_body_data(
|
4560 + | "{ \"timestamp\": \"19961219T163957\" }".as_bytes(),
|
4561 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4562 + | ),
|
4299 4563 | )),
|
4300 4564 | ))
|
4301 4565 | .unwrap();
|
4302 4566 | #[allow(unused_mut)]
|
4303 4567 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4304 4568 | let config = crate::service::RestJsonConfig::builder().build();
|
4305 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4569 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4306 4570 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
4307 4571 | let sender = sender.clone();
|
4308 4572 | async move {
|
4309 4573 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
4310 4574 | sender.send(()).await.expect("receiver dropped early");
|
4311 4575 | result
|
4312 4576 | }
|
4313 4577 | })
|
4314 4578 | .build_unchecked();
|
4315 4579 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4316 4580 | .await
|
4317 4581 | .expect("unable to make an HTTP request");
|
4318 4582 | ::pretty_assertions::assert_eq!(
|
4319 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4583 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4320 4584 | http_response.status()
|
4321 4585 | );
|
4322 4586 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4323 4587 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4324 4588 | http_response.headers(),
|
4325 4589 | expected_headers,
|
4326 4590 | ));
|
4327 4591 | }
|
4328 4592 | }
|
4329 4593 |
|
4330 4594 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
4331 4595 | /// are rejected with a 400 SerializationException
|
4332 4596 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsDifferent8601Formats_case6
|
4333 4597 | #[::tokio::test]
|
4334 4598 | #[::tracing_test::traced_test]
|
4335 4599 | async fn rest_json_body_timestamp_date_time_rejects_different8601_formats_case6_malformed_request(
|
4336 4600 | ) {
|
4337 4601 | {
|
4338 4602 | #[allow(unused_mut)]
|
4339 - | let mut http_request = http::Request::builder()
|
4603 + | let mut http_request = ::http_1x::Request::builder()
|
4340 4604 | .uri("/MalformedTimestampBodyDateTime")
|
4341 4605 | .method("POST")
|
4342 4606 | .header("content-type", "application/json")
|
4343 - | .body(::aws_smithy_http_server::body::Body::from(
|
4344 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4345 - | "{ \"timestamp\": \"19961219T16:39:57Z\" }".as_bytes(),
|
4346 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4607 + | .body(::aws_smithy_http_server::body::boxed(
|
4608 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4609 + | &::aws_smithy_protocol_test::decode_body_data(
|
4610 + | "{ \"timestamp\": \"19961219T16:39:57Z\" }".as_bytes(),
|
4611 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4612 + | ),
|
4347 4613 | )),
|
4348 4614 | ))
|
4349 4615 | .unwrap();
|
4350 4616 | #[allow(unused_mut)]
|
4351 4617 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4352 4618 | let config = crate::service::RestJsonConfig::builder().build();
|
4353 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4619 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4354 4620 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
4355 4621 | let sender = sender.clone();
|
4356 4622 | async move {
|
4357 4623 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
4358 4624 | sender.send(()).await.expect("receiver dropped early");
|
4359 4625 | result
|
4360 4626 | }
|
4361 4627 | })
|
4362 4628 | .build_unchecked();
|
4363 4629 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4364 4630 | .await
|
4365 4631 | .expect("unable to make an HTTP request");
|
4366 4632 | ::pretty_assertions::assert_eq!(
|
4367 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4633 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4368 4634 | http_response.status()
|
4369 4635 | );
|
4370 4636 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4371 4637 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4372 4638 | http_response.headers(),
|
4373 4639 | expected_headers,
|
4374 4640 | ));
|
4375 4641 | }
|
4376 4642 | }
|
4377 4643 |
|
4378 4644 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
4379 4645 | /// are rejected with a 400 SerializationException
|
4380 4646 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsDifferent8601Formats_case7
|
4381 4647 | #[::tokio::test]
|
4382 4648 | #[::tracing_test::traced_test]
|
4383 4649 | async fn rest_json_body_timestamp_date_time_rejects_different8601_formats_case7_malformed_request(
|
4384 4650 | ) {
|
4385 4651 | {
|
4386 4652 | #[allow(unused_mut)]
|
4387 - | let mut http_request = http::Request::builder()
|
4653 + | let mut http_request = ::http_1x::Request::builder()
|
4388 4654 | .uri("/MalformedTimestampBodyDateTime")
|
4389 4655 | .method("POST")
|
4390 4656 | .header("content-type", "application/json")
|
4391 - | .body(::aws_smithy_http_server::body::Body::from(
|
4392 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4393 - | "{ \"timestamp\": \"19961219T16:39:57\" }".as_bytes(),
|
4394 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4657 + | .body(::aws_smithy_http_server::body::boxed(
|
4658 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4659 + | &::aws_smithy_protocol_test::decode_body_data(
|
4660 + | "{ \"timestamp\": \"19961219T16:39:57\" }".as_bytes(),
|
4661 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4662 + | ),
|
4395 4663 | )),
|
4396 4664 | ))
|
4397 4665 | .unwrap();
|
4398 4666 | #[allow(unused_mut)]
|
4399 4667 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4400 4668 | let config = crate::service::RestJsonConfig::builder().build();
|
4401 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4669 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4402 4670 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
4403 4671 | let sender = sender.clone();
|
4404 4672 | async move {
|
4405 4673 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
4406 4674 | sender.send(()).await.expect("receiver dropped early");
|
4407 4675 | result
|
4408 4676 | }
|
4409 4677 | })
|
4410 4678 | .build_unchecked();
|
4411 4679 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4412 4680 | .await
|
4413 4681 | .expect("unable to make an HTTP request");
|
4414 4682 | ::pretty_assertions::assert_eq!(
|
4415 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4683 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4416 4684 | http_response.status()
|
4417 4685 | );
|
4418 4686 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4419 4687 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4420 4688 | http_response.headers(),
|
4421 4689 | expected_headers,
|
4422 4690 | ));
|
4423 4691 | }
|
4424 4692 | }
|
4425 4693 |
|
4426 4694 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
4427 4695 | /// are rejected with a 400 SerializationException
|
4428 4696 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsDifferent8601Formats_case8
|
4429 4697 | #[::tokio::test]
|
4430 4698 | #[::tracing_test::traced_test]
|
4431 4699 | async fn rest_json_body_timestamp_date_time_rejects_different8601_formats_case8_malformed_request(
|
4432 4700 | ) {
|
4433 4701 | {
|
4434 4702 | #[allow(unused_mut)]
|
4435 - | let mut http_request = http::Request::builder()
|
4703 + | let mut http_request = ::http_1x::Request::builder()
|
4436 4704 | .uri("/MalformedTimestampBodyDateTime")
|
4437 4705 | .method("POST")
|
4438 4706 | .header("content-type", "application/json")
|
4439 - | .body(::aws_smithy_http_server::body::Body::from(
|
4440 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4441 - | "{ \"timestamp\": \"1996-12-19T16:39Z\" }".as_bytes(),
|
4442 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4707 + | .body(::aws_smithy_http_server::body::boxed(
|
4708 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4709 + | &::aws_smithy_protocol_test::decode_body_data(
|
4710 + | "{ \"timestamp\": \"1996-12-19T16:39Z\" }".as_bytes(),
|
4711 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4712 + | ),
|
4443 4713 | )),
|
4444 4714 | ))
|
4445 4715 | .unwrap();
|
4446 4716 | #[allow(unused_mut)]
|
4447 4717 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4448 4718 | let config = crate::service::RestJsonConfig::builder().build();
|
4449 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4719 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4450 4720 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
4451 4721 | let sender = sender.clone();
|
4452 4722 | async move {
|
4453 4723 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
4454 4724 | sender.send(()).await.expect("receiver dropped early");
|
4455 4725 | result
|
4456 4726 | }
|
4457 4727 | })
|
4458 4728 | .build_unchecked();
|
4459 4729 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4460 4730 | .await
|
4461 4731 | .expect("unable to make an HTTP request");
|
4462 4732 | ::pretty_assertions::assert_eq!(
|
4463 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4733 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4464 4734 | http_response.status()
|
4465 4735 | );
|
4466 4736 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4467 4737 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4468 4738 | http_response.headers(),
|
4469 4739 | expected_headers,
|
4470 4740 | ));
|
4471 4741 | }
|
4472 4742 | }
|
4473 4743 |
|
4474 4744 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
4475 4745 | /// are rejected with a 400 SerializationException
|
4476 4746 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsDifferent8601Formats_case9
|
4477 4747 | #[::tokio::test]
|
4478 4748 | #[::tracing_test::traced_test]
|
4479 4749 | async fn rest_json_body_timestamp_date_time_rejects_different8601_formats_case9_malformed_request(
|
4480 4750 | ) {
|
4481 4751 | {
|
4482 4752 | #[allow(unused_mut)]
|
4483 - | let mut http_request = http::Request::builder()
|
4753 + | let mut http_request = ::http_1x::Request::builder()
|
4484 4754 | .uri("/MalformedTimestampBodyDateTime")
|
4485 4755 | .method("POST")
|
4486 4756 | .header("content-type", "application/json")
|
4487 - | .body(::aws_smithy_http_server::body::Body::from(
|
4488 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4489 - | "{ \"timestamp\": \"1996-12-19T16:39\" }".as_bytes(),
|
4490 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4757 + | .body(::aws_smithy_http_server::body::boxed(
|
4758 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4759 + | &::aws_smithy_protocol_test::decode_body_data(
|
4760 + | "{ \"timestamp\": \"1996-12-19T16:39\" }".as_bytes(),
|
4761 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4762 + | ),
|
4491 4763 | )),
|
4492 4764 | ))
|
4493 4765 | .unwrap();
|
4494 4766 | #[allow(unused_mut)]
|
4495 4767 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4496 4768 | let config = crate::service::RestJsonConfig::builder().build();
|
4497 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4769 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4498 4770 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
4499 4771 | let sender = sender.clone();
|
4500 4772 | async move {
|
4501 4773 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
4502 4774 | sender.send(()).await.expect("receiver dropped early");
|
4503 4775 | result
|
4504 4776 | }
|
4505 4777 | })
|
4506 4778 | .build_unchecked();
|
4507 4779 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4508 4780 | .await
|
4509 4781 | .expect("unable to make an HTTP request");
|
4510 4782 | ::pretty_assertions::assert_eq!(
|
4511 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4783 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4512 4784 | http_response.status()
|
4513 4785 | );
|
4514 4786 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4515 4787 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4516 4788 | http_response.headers(),
|
4517 4789 | expected_headers,
|
4518 4790 | ));
|
4519 4791 | }
|
4520 4792 | }
|
4521 4793 |
|
4522 4794 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
4523 4795 | /// are rejected with a 400 SerializationException
|
4524 4796 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsDifferent8601Formats_case10
|
4525 4797 | #[::tokio::test]
|
4526 4798 | #[::tracing_test::traced_test]
|
4527 4799 | async fn rest_json_body_timestamp_date_time_rejects_different8601_formats_case10_malformed_request(
|
4528 4800 | ) {
|
4529 4801 | {
|
4530 4802 | #[allow(unused_mut)]
|
4531 - | let mut http_request = http::Request::builder()
|
4803 + | let mut http_request = ::http_1x::Request::builder()
|
4532 4804 | .uri("/MalformedTimestampBodyDateTime")
|
4533 4805 | .method("POST")
|
4534 4806 | .header("content-type", "application/json")
|
4535 - | .body(::aws_smithy_http_server::body::Body::from(
|
4536 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4537 - | "{ \"timestamp\": \"1996-12-19T1639\" }".as_bytes(),
|
4538 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4807 + | .body(::aws_smithy_http_server::body::boxed(
|
4808 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4809 + | &::aws_smithy_protocol_test::decode_body_data(
|
4810 + | "{ \"timestamp\": \"1996-12-19T1639\" }".as_bytes(),
|
4811 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4812 + | ),
|
4539 4813 | )),
|
4540 4814 | ))
|
4541 4815 | .unwrap();
|
4542 4816 | #[allow(unused_mut)]
|
4543 4817 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4544 4818 | let config = crate::service::RestJsonConfig::builder().build();
|
4545 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4819 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4546 4820 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
4547 4821 | let sender = sender.clone();
|
4548 4822 | async move {
|
4549 4823 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
4550 4824 | sender.send(()).await.expect("receiver dropped early");
|
4551 4825 | result
|
4552 4826 | }
|
4553 4827 | })
|
4554 4828 | .build_unchecked();
|
4555 4829 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4556 4830 | .await
|
4557 4831 | .expect("unable to make an HTTP request");
|
4558 4832 | ::pretty_assertions::assert_eq!(
|
4559 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4833 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4560 4834 | http_response.status()
|
4561 4835 | );
|
4562 4836 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4563 4837 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4564 4838 | http_response.headers(),
|
4565 4839 | expected_headers,
|
4566 4840 | ));
|
4567 4841 | }
|
4568 4842 | }
|
4569 4843 |
|
4570 4844 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
4571 4845 | /// are rejected with a 400 SerializationException
|
4572 4846 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsDifferent8601Formats_case11
|
4573 4847 | #[::tokio::test]
|
4574 4848 | #[::tracing_test::traced_test]
|
4575 4849 | async fn rest_json_body_timestamp_date_time_rejects_different8601_formats_case11_malformed_request(
|
4576 4850 | ) {
|
4577 4851 | {
|
4578 4852 | #[allow(unused_mut)]
|
4579 - | let mut http_request = http::Request::builder()
|
4853 + | let mut http_request = ::http_1x::Request::builder()
|
4580 4854 | .uri("/MalformedTimestampBodyDateTime")
|
4581 4855 | .method("POST")
|
4582 4856 | .header("content-type", "application/json")
|
4583 - | .body(::aws_smithy_http_server::body::Body::from(
|
4584 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4585 - | "{ \"timestamp\": \"1996-12-19T16Z\" }".as_bytes(),
|
4586 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4857 + | .body(::aws_smithy_http_server::body::boxed(
|
4858 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4859 + | &::aws_smithy_protocol_test::decode_body_data(
|
4860 + | "{ \"timestamp\": \"1996-12-19T16Z\" }".as_bytes(),
|
4861 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4862 + | ),
|
4587 4863 | )),
|
4588 4864 | ))
|
4589 4865 | .unwrap();
|
4590 4866 | #[allow(unused_mut)]
|
4591 4867 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4592 4868 | let config = crate::service::RestJsonConfig::builder().build();
|
4593 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4869 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4594 4870 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
4595 4871 | let sender = sender.clone();
|
4596 4872 | async move {
|
4597 4873 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
4598 4874 | sender.send(()).await.expect("receiver dropped early");
|
4599 4875 | result
|
4600 4876 | }
|
4601 4877 | })
|
4602 4878 | .build_unchecked();
|
4603 4879 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4604 4880 | .await
|
4605 4881 | .expect("unable to make an HTTP request");
|
4606 4882 | ::pretty_assertions::assert_eq!(
|
4607 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4883 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4608 4884 | http_response.status()
|
4609 4885 | );
|
4610 4886 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4611 4887 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4612 4888 | http_response.headers(),
|
4613 4889 | expected_headers,
|
4614 4890 | ));
|
4615 4891 | }
|
4616 4892 | }
|
4617 4893 |
|
4618 4894 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
4619 4895 | /// are rejected with a 400 SerializationException
|
4620 4896 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsDifferent8601Formats_case12
|
4621 4897 | #[::tokio::test]
|
4622 4898 | #[::tracing_test::traced_test]
|
4623 4899 | async fn rest_json_body_timestamp_date_time_rejects_different8601_formats_case12_malformed_request(
|
4624 4900 | ) {
|
4625 4901 | {
|
4626 4902 | #[allow(unused_mut)]
|
4627 - | let mut http_request = http::Request::builder()
|
4903 + | let mut http_request = ::http_1x::Request::builder()
|
4628 4904 | .uri("/MalformedTimestampBodyDateTime")
|
4629 4905 | .method("POST")
|
4630 4906 | .header("content-type", "application/json")
|
4631 - | .body(::aws_smithy_http_server::body::Body::from(
|
4632 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4633 - | "{ \"timestamp\": \"1996-12-19T16\" }".as_bytes(),
|
4634 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4907 + | .body(::aws_smithy_http_server::body::boxed(
|
4908 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4909 + | &::aws_smithy_protocol_test::decode_body_data(
|
4910 + | "{ \"timestamp\": \"1996-12-19T16\" }".as_bytes(),
|
4911 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4912 + | ),
|
4635 4913 | )),
|
4636 4914 | ))
|
4637 4915 | .unwrap();
|
4638 4916 | #[allow(unused_mut)]
|
4639 4917 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4640 4918 | let config = crate::service::RestJsonConfig::builder().build();
|
4641 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4919 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4642 4920 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
4643 4921 | let sender = sender.clone();
|
4644 4922 | async move {
|
4645 4923 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
4646 4924 | sender.send(()).await.expect("receiver dropped early");
|
4647 4925 | result
|
4648 4926 | }
|
4649 4927 | })
|
4650 4928 | .build_unchecked();
|
4651 4929 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4652 4930 | .await
|
4653 4931 | .expect("unable to make an HTTP request");
|
4654 4932 | ::pretty_assertions::assert_eq!(
|
4655 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4933 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4656 4934 | http_response.status()
|
4657 4935 | );
|
4658 4936 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4659 4937 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4660 4938 | http_response.headers(),
|
4661 4939 | expected_headers,
|
4662 4940 | ));
|
4663 4941 | }
|
4664 4942 | }
|
4665 4943 |
|
4666 4944 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
4667 4945 | /// are rejected with a 400 SerializationException
|
4668 4946 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsDifferent8601Formats_case13
|
4669 4947 | #[::tokio::test]
|
4670 4948 | #[::tracing_test::traced_test]
|
4671 4949 | async fn rest_json_body_timestamp_date_time_rejects_different8601_formats_case13_malformed_request(
|
4672 4950 | ) {
|
4673 4951 | {
|
4674 4952 | #[allow(unused_mut)]
|
4675 - | let mut http_request = http::Request::builder()
|
4953 + | let mut http_request = ::http_1x::Request::builder()
|
4676 4954 | .uri("/MalformedTimestampBodyDateTime")
|
4677 4955 | .method("POST")
|
4678 4956 | .header("content-type", "application/json")
|
4679 - | .body(::aws_smithy_http_server::body::Body::from(
|
4680 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4681 - | "{ \"timestamp\": \"1996-12-19 16:39:57Z\" }".as_bytes(),
|
4682 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4957 + | .body(::aws_smithy_http_server::body::boxed(
|
4958 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
4959 + | &::aws_smithy_protocol_test::decode_body_data(
|
4960 + | "{ \"timestamp\": \"1996-12-19 16:39:57Z\" }".as_bytes(),
|
4961 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
4962 + | ),
|
4683 4963 | )),
|
4684 4964 | ))
|
4685 4965 | .unwrap();
|
4686 4966 | #[allow(unused_mut)]
|
4687 4967 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4688 4968 | let config = crate::service::RestJsonConfig::builder().build();
|
4689 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
4969 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4690 4970 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
4691 4971 | let sender = sender.clone();
|
4692 4972 | async move {
|
4693 4973 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
4694 4974 | sender.send(()).await.expect("receiver dropped early");
|
4695 4975 | result
|
4696 4976 | }
|
4697 4977 | })
|
4698 4978 | .build_unchecked();
|
4699 4979 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4700 4980 | .await
|
4701 4981 | .expect("unable to make an HTTP request");
|
4702 4982 | ::pretty_assertions::assert_eq!(
|
4703 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4983 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4704 4984 | http_response.status()
|
4705 4985 | );
|
4706 4986 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4707 4987 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4708 4988 | http_response.headers(),
|
4709 4989 | expected_headers,
|
4710 4990 | ));
|
4711 4991 | }
|
4712 4992 | }
|
4713 4993 |
|
4714 4994 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
4715 4995 | /// are rejected with a 400 SerializationException
|
4716 4996 | /// Test ID: RestJsonBodyTimestampDateTimeRejectsDifferent8601Formats_case14
|
4717 4997 | #[::tokio::test]
|
4718 4998 | #[::tracing_test::traced_test]
|
4719 4999 | async fn rest_json_body_timestamp_date_time_rejects_different8601_formats_case14_malformed_request(
|
4720 5000 | ) {
|
4721 5001 | {
|
4722 5002 | #[allow(unused_mut)]
|
4723 - | let mut http_request = http::Request::builder()
|
5003 + | let mut http_request = ::http_1x::Request::builder()
|
4724 5004 | .uri("/MalformedTimestampBodyDateTime")
|
4725 5005 | .method("POST")
|
4726 5006 | .header("content-type", "application/json")
|
4727 - | .body(::aws_smithy_http_server::body::Body::from(
|
4728 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4729 - | "{ \"timestamp\": \"2011-12-03T10:15:30+01:00[Europe/Paris]\" }".as_bytes(),
|
4730 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5007 + | .body(::aws_smithy_http_server::body::boxed(
|
5008 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5009 + | &::aws_smithy_protocol_test::decode_body_data(
|
5010 + | "{ \"timestamp\": \"2011-12-03T10:15:30+01:00[Europe/Paris]\" }"
|
5011 + | .as_bytes(),
|
5012 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5013 + | ),
|
4731 5014 | )),
|
4732 5015 | ))
|
4733 5016 | .unwrap();
|
4734 5017 | #[allow(unused_mut)]
|
4735 5018 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4736 5019 | let config = crate::service::RestJsonConfig::builder().build();
|
4737 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5020 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4738 5021 | .malformed_timestamp_body_date_time(move |input: crate::input::MalformedTimestampBodyDateTimeInput| {
|
4739 5022 | let sender = sender.clone();
|
4740 5023 | async move {
|
4741 5024 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDateTimeOutput, crate::error::MalformedTimestampBodyDateTimeError> };
|
4742 5025 | sender.send(()).await.expect("receiver dropped early");
|
4743 5026 | result
|
4744 5027 | }
|
4745 5028 | })
|
4746 5029 | .build_unchecked();
|
4747 5030 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4748 5031 | .await
|
4749 5032 | .expect("unable to make an HTTP request");
|
4750 5033 | ::pretty_assertions::assert_eq!(
|
4751 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5034 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4752 5035 | http_response.status()
|
4753 5036 | );
|
4754 5037 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4755 5038 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4756 5039 | http_response.headers(),
|
4757 5040 | expected_headers,
|
4758 5041 | ));
|
4759 5042 | }
|
4760 5043 | }
|
5044 + |
|
5045 + | /* ProtocolTestGenerator.kt:98 */
|
4761 5046 | }
|
4762 5047 |
|
5048 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
4763 5049 | ::pin_project_lite::pin_project! {
|
4764 5050 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
4765 5051 | /// [`MalformedTimestampBodyDefaultInput`](crate::input::MalformedTimestampBodyDefaultInput) using modelled bindings.
|
4766 5052 | pub struct MalformedTimestampBodyDefaultInputFuture {
|
4767 5053 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedTimestampBodyDefaultInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
4768 5054 | }
|
4769 5055 | }
|
4770 5056 |
|
4771 5057 | impl std::future::Future for MalformedTimestampBodyDefaultInputFuture {
|
4772 5058 | type Output = Result<
|
4773 5059 | crate::input::MalformedTimestampBodyDefaultInput,
|
4774 5060 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
4775 5061 | >;
|
4776 5062 |
|
4777 5063 | fn poll(
|
4778 5064 | self: std::pin::Pin<&mut Self>,
|
4779 5065 | cx: &mut std::task::Context<'_>,
|
4780 5066 | ) -> std::task::Poll<Self::Output> {
|
4781 5067 | let this = self.project();
|
4782 5068 | this.inner.as_mut().poll(cx)
|
4783 5069 | }
|
4784 5070 | }
|
4785 5071 |
|
4786 5072 | impl<B>
|
4787 5073 | ::aws_smithy_http_server::request::FromRequest<
|
4788 5074 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
4789 5075 | B,
|
4790 5076 | > for crate::input::MalformedTimestampBodyDefaultInput
|
4791 5077 | where
|
4792 5078 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
4793 5079 | B: 'static,
|
4794 5080 |
|
4795 5081 | B::Data: Send,
|
4796 5082 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
4797 5083 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
4798 5084 | {
|
4799 5085 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
4800 5086 | type Future = MalformedTimestampBodyDefaultInputFuture;
|
4801 5087 |
|
4802 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
5088 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
4803 5089 | let fut = async move {
|
4804 5090 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
4805 5091 | request.headers(),
|
4806 5092 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
4807 5093 | ) {
|
4808 5094 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
4809 5095 | }
|
4810 5096 | crate::protocol_serde::shape_malformed_timestamp_body_default::de_malformed_timestamp_body_default_http_request(request)
|
4811 5097 | .await
|
4812 5098 | };
|
4813 5099 | use ::futures_util::future::TryFutureExt;
|
4814 5100 | let fut = fut.map_err(
|
4815 5101 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
4816 5102 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
4817 5103 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
4818 5104 | e,
|
4819 5105 | )
|
4820 5106 | },
|
4821 5107 | );
|
4822 5108 | MalformedTimestampBodyDefaultInputFuture {
|
4823 5109 | inner: Box::pin(fut),
|
4824 5110 | }
|
4825 5111 | }
|
4826 5112 | }
|
5113 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
4827 5114 | impl
|
4828 5115 | ::aws_smithy_http_server::response::IntoResponse<
|
4829 5116 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
4830 5117 | > for crate::output::MalformedTimestampBodyDefaultOutput
|
4831 5118 | {
|
4832 5119 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
4833 5120 | match crate::protocol_serde::shape_malformed_timestamp_body_default::ser_malformed_timestamp_body_default_http_response(self) {
|
4834 5121 | Ok(response) => response,
|
4835 5122 | Err(e) => {
|
4836 5123 | ::tracing::error!(error = %e, "failed to serialize response");
|
4837 5124 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
4838 5125 | }
|
4839 5126 | }
|
4840 5127 | }
|
4841 5128 | }
|
5129 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
4842 5130 | impl
|
4843 5131 | ::aws_smithy_http_server::response::IntoResponse<
|
4844 5132 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
4845 5133 | > for crate::error::MalformedTimestampBodyDefaultError
|
4846 5134 | {
|
4847 5135 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
4848 5136 | match crate::protocol_serde::shape_malformed_timestamp_body_default::ser_malformed_timestamp_body_default_http_error(&self) {
|
4849 5137 | Ok(mut response) => {
|
4850 5138 | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
4851 5139 | response
|
4852 5140 | },
|
4853 5141 | Err(e) => {
|
4854 5142 | ::tracing::error!(error = %e, "failed to serialize response");
|
4855 5143 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
4856 5144 | }
|
4857 5145 | }
|
4858 5146 | }
|
4859 5147 | }
|
4860 5148 |
|
5149 + | /* RustType.kt:534 */
|
4861 5150 | #[allow(unreachable_code, unused_variables)]
|
5151 + | /* RustType.kt:534 */
|
4862 5152 | #[cfg(test)]
|
5153 + | /* ProtocolTestGenerator.kt:98 */
|
4863 5154 | mod malformed_timestamp_body_default_test {
|
4864 5155 |
|
4865 5156 | /// By default, RFC3339 timestamps are rejected with a
|
4866 5157 | /// 400 SerializationException
|
4867 5158 | /// Test ID: RestJsonBodyTimestampDefaultRejectsDateTime_case0
|
4868 5159 | #[::tokio::test]
|
4869 5160 | #[::tracing_test::traced_test]
|
4870 5161 | async fn rest_json_body_timestamp_default_rejects_date_time_case0_malformed_request() {
|
4871 5162 | {
|
4872 5163 | #[allow(unused_mut)]
|
4873 - | let mut http_request = http::Request::builder()
|
5164 + | let mut http_request = ::http_1x::Request::builder()
|
4874 5165 | .uri("/MalformedTimestampBodyDefault")
|
4875 5166 | .method("POST")
|
4876 5167 | .header("content-type", "application/json")
|
4877 - | .body(::aws_smithy_http_server::body::Body::from(
|
4878 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4879 - | "{ \"timestamp\": \"1985-04-12T23:20:50.52Z\" }".as_bytes(),
|
4880 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5168 + | .body(::aws_smithy_http_server::body::boxed(
|
5169 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5170 + | &::aws_smithy_protocol_test::decode_body_data(
|
5171 + | "{ \"timestamp\": \"1985-04-12T23:20:50.52Z\" }".as_bytes(),
|
5172 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5173 + | ),
|
4881 5174 | )),
|
4882 5175 | ))
|
4883 5176 | .unwrap();
|
4884 5177 | #[allow(unused_mut)]
|
4885 5178 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4886 5179 | let config = crate::service::RestJsonConfig::builder().build();
|
4887 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5180 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4888 5181 | .malformed_timestamp_body_default(move |input: crate::input::MalformedTimestampBodyDefaultInput| {
|
4889 5182 | let sender = sender.clone();
|
4890 5183 | async move {
|
4891 5184 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDefaultOutput, crate::error::MalformedTimestampBodyDefaultError> };
|
4892 5185 | sender.send(()).await.expect("receiver dropped early");
|
4893 5186 | result
|
4894 5187 | }
|
4895 5188 | })
|
4896 5189 | .build_unchecked();
|
4897 5190 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4898 5191 | .await
|
4899 5192 | .expect("unable to make an HTTP request");
|
4900 5193 | ::pretty_assertions::assert_eq!(
|
4901 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5194 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4902 5195 | http_response.status()
|
4903 5196 | );
|
4904 5197 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4905 5198 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4906 5199 | http_response.headers(),
|
4907 5200 | expected_headers,
|
4908 5201 | ));
|
4909 5202 | }
|
4910 5203 | }
|
4911 5204 |
|
4912 5205 | /// By default, RFC3339 timestamps are rejected with a
|
4913 5206 | /// 400 SerializationException
|
4914 5207 | /// Test ID: RestJsonBodyTimestampDefaultRejectsDateTime_case1
|
4915 5208 | #[::tokio::test]
|
4916 5209 | #[::tracing_test::traced_test]
|
4917 5210 | async fn rest_json_body_timestamp_default_rejects_date_time_case1_malformed_request() {
|
4918 5211 | {
|
4919 5212 | #[allow(unused_mut)]
|
4920 - | let mut http_request = http::Request::builder()
|
5213 + | let mut http_request = ::http_1x::Request::builder()
|
4921 5214 | .uri("/MalformedTimestampBodyDefault")
|
4922 5215 | .method("POST")
|
4923 5216 | .header("content-type", "application/json")
|
4924 - | .body(::aws_smithy_http_server::body::Body::from(
|
4925 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4926 - | "{ \"timestamp\": \"1985-04-12T23:20:50Z\" }".as_bytes(),
|
4927 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5217 + | .body(::aws_smithy_http_server::body::boxed(
|
5218 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5219 + | &::aws_smithy_protocol_test::decode_body_data(
|
5220 + | "{ \"timestamp\": \"1985-04-12T23:20:50Z\" }".as_bytes(),
|
5221 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5222 + | ),
|
4928 5223 | )),
|
4929 5224 | ))
|
4930 5225 | .unwrap();
|
4931 5226 | #[allow(unused_mut)]
|
4932 5227 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4933 5228 | let config = crate::service::RestJsonConfig::builder().build();
|
4934 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5229 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4935 5230 | .malformed_timestamp_body_default(move |input: crate::input::MalformedTimestampBodyDefaultInput| {
|
4936 5231 | let sender = sender.clone();
|
4937 5232 | async move {
|
4938 5233 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDefaultOutput, crate::error::MalformedTimestampBodyDefaultError> };
|
4939 5234 | sender.send(()).await.expect("receiver dropped early");
|
4940 5235 | result
|
4941 5236 | }
|
4942 5237 | })
|
4943 5238 | .build_unchecked();
|
4944 5239 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4945 5240 | .await
|
4946 5241 | .expect("unable to make an HTTP request");
|
4947 5242 | ::pretty_assertions::assert_eq!(
|
4948 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5243 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4949 5244 | http_response.status()
|
4950 5245 | );
|
4951 5246 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4952 5247 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
4953 5248 | http_response.headers(),
|
4954 5249 | expected_headers,
|
4955 5250 | ));
|
4956 5251 | }
|
4957 5252 | }
|
4958 5253 |
|
4959 5254 | /// By default, RFC3339 timestamps are rejected with a
|
4960 5255 | /// 400 SerializationException
|
4961 5256 | /// Test ID: RestJsonBodyTimestampDefaultRejectsDateTime_case2
|
4962 5257 | #[::tokio::test]
|
4963 5258 | #[::tracing_test::traced_test]
|
4964 5259 | async fn rest_json_body_timestamp_default_rejects_date_time_case2_malformed_request() {
|
4965 5260 | {
|
4966 5261 | #[allow(unused_mut)]
|
4967 - | let mut http_request = http::Request::builder()
|
5262 + | let mut http_request = ::http_1x::Request::builder()
|
4968 5263 | .uri("/MalformedTimestampBodyDefault")
|
4969 5264 | .method("POST")
|
4970 5265 | .header("content-type", "application/json")
|
4971 - | .body(::aws_smithy_http_server::body::Body::from(
|
4972 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
4973 - | "{ \"timestamp\": \"1996-12-19T16:39:57-08:00\" }".as_bytes(),
|
4974 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5266 + | .body(::aws_smithy_http_server::body::boxed(
|
5267 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5268 + | &::aws_smithy_protocol_test::decode_body_data(
|
5269 + | "{ \"timestamp\": \"1996-12-19T16:39:57-08:00\" }".as_bytes(),
|
5270 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5271 + | ),
|
4975 5272 | )),
|
4976 5273 | ))
|
4977 5274 | .unwrap();
|
4978 5275 | #[allow(unused_mut)]
|
4979 5276 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
4980 5277 | let config = crate::service::RestJsonConfig::builder().build();
|
4981 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5278 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
4982 5279 | .malformed_timestamp_body_default(move |input: crate::input::MalformedTimestampBodyDefaultInput| {
|
4983 5280 | let sender = sender.clone();
|
4984 5281 | async move {
|
4985 5282 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDefaultOutput, crate::error::MalformedTimestampBodyDefaultError> };
|
4986 5283 | sender.send(()).await.expect("receiver dropped early");
|
4987 5284 | result
|
4988 5285 | }
|
4989 5286 | })
|
4990 5287 | .build_unchecked();
|
4991 5288 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
4992 5289 | .await
|
4993 5290 | .expect("unable to make an HTTP request");
|
4994 5291 | ::pretty_assertions::assert_eq!(
|
4995 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5292 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
4996 5293 | http_response.status()
|
4997 5294 | );
|
4998 5295 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
4999 5296 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5000 5297 | http_response.headers(),
|
5001 5298 | expected_headers,
|
5002 5299 | ));
|
5003 5300 | }
|
5004 5301 | }
|
5005 5302 |
|
5006 5303 | /// By default, epoch second timestamps as strings are rejected with a
|
5007 5304 | /// 400 SerializationException
|
5008 5305 | /// Test ID: RestJsonBodyTimestampDefaultRejectsStringifiedEpochSeconds_case0
|
5009 5306 | #[::tokio::test]
|
5010 5307 | #[::tracing_test::traced_test]
|
5011 5308 | async fn rest_json_body_timestamp_default_rejects_stringified_epoch_seconds_case0_malformed_request(
|
5012 5309 | ) {
|
5013 5310 | {
|
5014 5311 | #[allow(unused_mut)]
|
5015 - | let mut http_request = http::Request::builder()
|
5312 + | let mut http_request = ::http_1x::Request::builder()
|
5016 5313 | .uri("/MalformedTimestampBodyDefault")
|
5017 5314 | .method("POST")
|
5018 5315 | .header("content-type", "application/json")
|
5019 - | .body(::aws_smithy_http_server::body::Body::from(
|
5020 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5021 - | "{ \"timestamp\": \"1515531081.1234\" }".as_bytes(),
|
5022 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5316 + | .body(::aws_smithy_http_server::body::boxed(
|
5317 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5318 + | &::aws_smithy_protocol_test::decode_body_data(
|
5319 + | "{ \"timestamp\": \"1515531081.1234\" }".as_bytes(),
|
5320 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5321 + | ),
|
5023 5322 | )),
|
5024 5323 | ))
|
5025 5324 | .unwrap();
|
5026 5325 | #[allow(unused_mut)]
|
5027 5326 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5028 5327 | let config = crate::service::RestJsonConfig::builder().build();
|
5029 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5328 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5030 5329 | .malformed_timestamp_body_default(move |input: crate::input::MalformedTimestampBodyDefaultInput| {
|
5031 5330 | let sender = sender.clone();
|
5032 5331 | async move {
|
5033 5332 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDefaultOutput, crate::error::MalformedTimestampBodyDefaultError> };
|
5034 5333 | sender.send(()).await.expect("receiver dropped early");
|
5035 5334 | result
|
5036 5335 | }
|
5037 5336 | })
|
5038 5337 | .build_unchecked();
|
5039 5338 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5040 5339 | .await
|
5041 5340 | .expect("unable to make an HTTP request");
|
5042 5341 | ::pretty_assertions::assert_eq!(
|
5043 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5342 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5044 5343 | http_response.status()
|
5045 5344 | );
|
5046 5345 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5047 5346 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5048 5347 | http_response.headers(),
|
5049 5348 | expected_headers,
|
5050 5349 | ));
|
5051 5350 | }
|
5052 5351 | }
|
5053 5352 |
|
5054 5353 | /// By default, epoch second timestamps as strings are rejected with a
|
5055 5354 | /// 400 SerializationException
|
5056 5355 | /// Test ID: RestJsonBodyTimestampDefaultRejectsStringifiedEpochSeconds_case1
|
5057 5356 | #[::tokio::test]
|
5058 5357 | #[::tracing_test::traced_test]
|
5059 5358 | async fn rest_json_body_timestamp_default_rejects_stringified_epoch_seconds_case1_malformed_request(
|
5060 5359 | ) {
|
5061 5360 | {
|
5062 5361 | #[allow(unused_mut)]
|
5063 - | let mut http_request = http::Request::builder()
|
5362 + | let mut http_request = ::http_1x::Request::builder()
|
5064 5363 | .uri("/MalformedTimestampBodyDefault")
|
5065 5364 | .method("POST")
|
5066 5365 | .header("content-type", "application/json")
|
5067 - | .body(::aws_smithy_http_server::body::Body::from(
|
5068 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5069 - | "{ \"timestamp\": \"1515531081\" }".as_bytes(),
|
5070 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5366 + | .body(::aws_smithy_http_server::body::boxed(
|
5367 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5368 + | &::aws_smithy_protocol_test::decode_body_data(
|
5369 + | "{ \"timestamp\": \"1515531081\" }".as_bytes(),
|
5370 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5371 + | ),
|
5071 5372 | )),
|
5072 5373 | ))
|
5073 5374 | .unwrap();
|
5074 5375 | #[allow(unused_mut)]
|
5075 5376 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5076 5377 | let config = crate::service::RestJsonConfig::builder().build();
|
5077 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5378 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5078 5379 | .malformed_timestamp_body_default(move |input: crate::input::MalformedTimestampBodyDefaultInput| {
|
5079 5380 | let sender = sender.clone();
|
5080 5381 | async move {
|
5081 5382 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDefaultOutput, crate::error::MalformedTimestampBodyDefaultError> };
|
5082 5383 | sender.send(()).await.expect("receiver dropped early");
|
5083 5384 | result
|
5084 5385 | }
|
5085 5386 | })
|
5086 5387 | .build_unchecked();
|
5087 5388 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5088 5389 | .await
|
5089 5390 | .expect("unable to make an HTTP request");
|
5090 5391 | ::pretty_assertions::assert_eq!(
|
5091 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5392 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5092 5393 | http_response.status()
|
5093 5394 | );
|
5094 5395 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5095 5396 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5096 5397 | http_response.headers(),
|
5097 5398 | expected_headers,
|
5098 5399 | ));
|
5099 5400 | }
|
5100 5401 | }
|
5101 5402 |
|
5102 5403 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
5103 5404 | /// Test ID: RestJsonBodyTimestampDefaultRejectsMalformedEpochSeconds_case0
|
5104 5405 | #[::tokio::test]
|
5105 5406 | #[::tracing_test::traced_test]
|
5106 5407 | async fn rest_json_body_timestamp_default_rejects_malformed_epoch_seconds_case0_malformed_request(
|
5107 5408 | ) {
|
5108 5409 | {
|
5109 5410 | #[allow(unused_mut)]
|
5110 - | let mut http_request = http::Request::builder()
|
5411 + | let mut http_request = ::http_1x::Request::builder()
|
5111 5412 | .uri("/MalformedTimestampBodyDefault")
|
5112 5413 | .method("POST")
|
5113 5414 | .header("content-type", "application/json")
|
5114 - | .body(::aws_smithy_http_server::body::Body::from(
|
5115 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5116 - | "{ \"timestamp\": true }".as_bytes(),
|
5117 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5415 + | .body(::aws_smithy_http_server::body::boxed(
|
5416 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5417 + | &::aws_smithy_protocol_test::decode_body_data(
|
5418 + | "{ \"timestamp\": true }".as_bytes(),
|
5419 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5420 + | ),
|
5118 5421 | )),
|
5119 5422 | ))
|
5120 5423 | .unwrap();
|
5121 5424 | #[allow(unused_mut)]
|
5122 5425 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5123 5426 | let config = crate::service::RestJsonConfig::builder().build();
|
5124 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5427 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5125 5428 | .malformed_timestamp_body_default(move |input: crate::input::MalformedTimestampBodyDefaultInput| {
|
5126 5429 | let sender = sender.clone();
|
5127 5430 | async move {
|
5128 5431 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDefaultOutput, crate::error::MalformedTimestampBodyDefaultError> };
|
5129 5432 | sender.send(()).await.expect("receiver dropped early");
|
5130 5433 | result
|
5131 5434 | }
|
5132 5435 | })
|
5133 5436 | .build_unchecked();
|
5134 5437 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5135 5438 | .await
|
5136 5439 | .expect("unable to make an HTTP request");
|
5137 5440 | ::pretty_assertions::assert_eq!(
|
5138 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5441 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5139 5442 | http_response.status()
|
5140 5443 | );
|
5141 5444 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5142 5445 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5143 5446 | http_response.headers(),
|
5144 5447 | expected_headers,
|
5145 5448 | ));
|
5146 5449 | }
|
5147 5450 | }
|
5148 5451 |
|
5149 5452 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
5150 5453 | /// Test ID: RestJsonBodyTimestampDefaultRejectsMalformedEpochSeconds_case1
|
5151 5454 | #[::tokio::test]
|
5152 5455 | #[::tracing_test::traced_test]
|
5153 5456 | async fn rest_json_body_timestamp_default_rejects_malformed_epoch_seconds_case1_malformed_request(
|
5154 5457 | ) {
|
5155 5458 | {
|
5156 5459 | #[allow(unused_mut)]
|
5157 - | let mut http_request = http::Request::builder()
|
5460 + | let mut http_request = ::http_1x::Request::builder()
|
5158 5461 | .uri("/MalformedTimestampBodyDefault")
|
5159 5462 | .method("POST")
|
5160 5463 | .header("content-type", "application/json")
|
5161 - | .body(::aws_smithy_http_server::body::Body::from(
|
5162 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5163 - | "{ \"timestamp\": 1515531081ABC }".as_bytes(),
|
5164 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5464 + | .body(::aws_smithy_http_server::body::boxed(
|
5465 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5466 + | &::aws_smithy_protocol_test::decode_body_data(
|
5467 + | "{ \"timestamp\": 1515531081ABC }".as_bytes(),
|
5468 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5469 + | ),
|
5165 5470 | )),
|
5166 5471 | ))
|
5167 5472 | .unwrap();
|
5168 5473 | #[allow(unused_mut)]
|
5169 5474 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5170 5475 | let config = crate::service::RestJsonConfig::builder().build();
|
5171 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5476 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5172 5477 | .malformed_timestamp_body_default(move |input: crate::input::MalformedTimestampBodyDefaultInput| {
|
5173 5478 | let sender = sender.clone();
|
5174 5479 | async move {
|
5175 5480 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDefaultOutput, crate::error::MalformedTimestampBodyDefaultError> };
|
5176 5481 | sender.send(()).await.expect("receiver dropped early");
|
5177 5482 | result
|
5178 5483 | }
|
5179 5484 | })
|
5180 5485 | .build_unchecked();
|
5181 5486 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5182 5487 | .await
|
5183 5488 | .expect("unable to make an HTTP request");
|
5184 5489 | ::pretty_assertions::assert_eq!(
|
5185 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5490 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5186 5491 | http_response.status()
|
5187 5492 | );
|
5188 5493 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5189 5494 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5190 5495 | http_response.headers(),
|
5191 5496 | expected_headers,
|
5192 5497 | ));
|
5193 5498 | }
|
5194 5499 | }
|
5195 5500 |
|
5196 5501 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
5197 5502 | /// Test ID: RestJsonBodyTimestampDefaultRejectsMalformedEpochSeconds_case2
|
5198 5503 | #[::tokio::test]
|
5199 5504 | #[::tracing_test::traced_test]
|
5200 5505 | async fn rest_json_body_timestamp_default_rejects_malformed_epoch_seconds_case2_malformed_request(
|
5201 5506 | ) {
|
5202 5507 | {
|
5203 5508 | #[allow(unused_mut)]
|
5204 - | let mut http_request = http::Request::builder()
|
5509 + | let mut http_request = ::http_1x::Request::builder()
|
5205 5510 | .uri("/MalformedTimestampBodyDefault")
|
5206 5511 | .method("POST")
|
5207 5512 | .header("content-type", "application/json")
|
5208 - | .body(::aws_smithy_http_server::body::Body::from(
|
5209 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5210 - | "{ \"timestamp\": 0x42 }".as_bytes(),
|
5211 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5513 + | .body(::aws_smithy_http_server::body::boxed(
|
5514 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5515 + | &::aws_smithy_protocol_test::decode_body_data(
|
5516 + | "{ \"timestamp\": 0x42 }".as_bytes(),
|
5517 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5518 + | ),
|
5212 5519 | )),
|
5213 5520 | ))
|
5214 5521 | .unwrap();
|
5215 5522 | #[allow(unused_mut)]
|
5216 5523 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5217 5524 | let config = crate::service::RestJsonConfig::builder().build();
|
5218 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5525 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5219 5526 | .malformed_timestamp_body_default(move |input: crate::input::MalformedTimestampBodyDefaultInput| {
|
5220 5527 | let sender = sender.clone();
|
5221 5528 | async move {
|
5222 5529 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDefaultOutput, crate::error::MalformedTimestampBodyDefaultError> };
|
5223 5530 | sender.send(()).await.expect("receiver dropped early");
|
5224 5531 | result
|
5225 5532 | }
|
5226 5533 | })
|
5227 5534 | .build_unchecked();
|
5228 5535 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5229 5536 | .await
|
5230 5537 | .expect("unable to make an HTTP request");
|
5231 5538 | ::pretty_assertions::assert_eq!(
|
5232 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5539 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5233 5540 | http_response.status()
|
5234 5541 | );
|
5235 5542 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5236 5543 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5237 5544 | http_response.headers(),
|
5238 5545 | expected_headers,
|
5239 5546 | ));
|
5240 5547 | }
|
5241 5548 | }
|
5242 5549 |
|
5243 5550 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
5244 5551 | /// Test ID: RestJsonBodyTimestampDefaultRejectsMalformedEpochSeconds_case3
|
5245 5552 | #[::tokio::test]
|
5246 5553 | #[::tracing_test::traced_test]
|
5247 5554 | async fn rest_json_body_timestamp_default_rejects_malformed_epoch_seconds_case3_malformed_request(
|
5248 5555 | ) {
|
5249 5556 | {
|
5250 5557 | #[allow(unused_mut)]
|
5251 - | let mut http_request = http::Request::builder()
|
5558 + | let mut http_request = ::http_1x::Request::builder()
|
5252 5559 | .uri("/MalformedTimestampBodyDefault")
|
5253 5560 | .method("POST")
|
5254 5561 | .header("content-type", "application/json")
|
5255 - | .body(::aws_smithy_http_server::body::Body::from(
|
5256 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5257 - | "{ \"timestamp\": 1515531081.123.456 }".as_bytes(),
|
5258 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5562 + | .body(::aws_smithy_http_server::body::boxed(
|
5563 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5564 + | &::aws_smithy_protocol_test::decode_body_data(
|
5565 + | "{ \"timestamp\": 1515531081.123.456 }".as_bytes(),
|
5566 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5567 + | ),
|
5259 5568 | )),
|
5260 5569 | ))
|
5261 5570 | .unwrap();
|
5262 5571 | #[allow(unused_mut)]
|
5263 5572 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5264 5573 | let config = crate::service::RestJsonConfig::builder().build();
|
5265 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5574 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5266 5575 | .malformed_timestamp_body_default(move |input: crate::input::MalformedTimestampBodyDefaultInput| {
|
5267 5576 | let sender = sender.clone();
|
5268 5577 | async move {
|
5269 5578 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDefaultOutput, crate::error::MalformedTimestampBodyDefaultError> };
|
5270 5579 | sender.send(()).await.expect("receiver dropped early");
|
5271 5580 | result
|
5272 5581 | }
|
5273 5582 | })
|
5274 5583 | .build_unchecked();
|
5275 5584 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5276 5585 | .await
|
5277 5586 | .expect("unable to make an HTTP request");
|
5278 5587 | ::pretty_assertions::assert_eq!(
|
5279 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5588 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5280 5589 | http_response.status()
|
5281 5590 | );
|
5282 5591 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5283 5592 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5284 5593 | http_response.headers(),
|
5285 5594 | expected_headers,
|
5286 5595 | ));
|
5287 5596 | }
|
5288 5597 | }
|
5289 5598 |
|
5290 5599 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
5291 5600 | /// Test ID: RestJsonBodyTimestampDefaultRejectsMalformedEpochSeconds_case4
|
5292 5601 | #[::tokio::test]
|
5293 5602 | #[::tracing_test::traced_test]
|
5294 5603 | async fn rest_json_body_timestamp_default_rejects_malformed_epoch_seconds_case4_malformed_request(
|
5295 5604 | ) {
|
5296 5605 | {
|
5297 5606 | #[allow(unused_mut)]
|
5298 - | let mut http_request = http::Request::builder()
|
5607 + | let mut http_request = ::http_1x::Request::builder()
|
5299 5608 | .uri("/MalformedTimestampBodyDefault")
|
5300 5609 | .method("POST")
|
5301 5610 | .header("content-type", "application/json")
|
5302 - | .body(::aws_smithy_http_server::body::Body::from(
|
5303 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5304 - | "{ \"timestamp\": Infinity }".as_bytes(),
|
5305 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5611 + | .body(::aws_smithy_http_server::body::boxed(
|
5612 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5613 + | &::aws_smithy_protocol_test::decode_body_data(
|
5614 + | "{ \"timestamp\": Infinity }".as_bytes(),
|
5615 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5616 + | ),
|
5306 5617 | )),
|
5307 5618 | ))
|
5308 5619 | .unwrap();
|
5309 5620 | #[allow(unused_mut)]
|
5310 5621 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5311 5622 | let config = crate::service::RestJsonConfig::builder().build();
|
5312 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5623 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5313 5624 | .malformed_timestamp_body_default(move |input: crate::input::MalformedTimestampBodyDefaultInput| {
|
5314 5625 | let sender = sender.clone();
|
5315 5626 | async move {
|
5316 5627 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDefaultOutput, crate::error::MalformedTimestampBodyDefaultError> };
|
5317 5628 | sender.send(()).await.expect("receiver dropped early");
|
5318 5629 | result
|
5319 5630 | }
|
5320 5631 | })
|
5321 5632 | .build_unchecked();
|
5322 5633 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5323 5634 | .await
|
5324 5635 | .expect("unable to make an HTTP request");
|
5325 5636 | ::pretty_assertions::assert_eq!(
|
5326 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5637 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5327 5638 | http_response.status()
|
5328 5639 | );
|
5329 5640 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5330 5641 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5331 5642 | http_response.headers(),
|
5332 5643 | expected_headers,
|
5333 5644 | ));
|
5334 5645 | }
|
5335 5646 | }
|
5336 5647 |
|
5337 5648 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
5338 5649 | /// Test ID: RestJsonBodyTimestampDefaultRejectsMalformedEpochSeconds_case5
|
5339 5650 | #[::tokio::test]
|
5340 5651 | #[::tracing_test::traced_test]
|
5341 5652 | async fn rest_json_body_timestamp_default_rejects_malformed_epoch_seconds_case5_malformed_request(
|
5342 5653 | ) {
|
5343 5654 | {
|
5344 5655 | #[allow(unused_mut)]
|
5345 - | let mut http_request = http::Request::builder()
|
5656 + | let mut http_request = ::http_1x::Request::builder()
|
5346 5657 | .uri("/MalformedTimestampBodyDefault")
|
5347 5658 | .method("POST")
|
5348 5659 | .header("content-type", "application/json")
|
5349 - | .body(::aws_smithy_http_server::body::Body::from(
|
5350 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5351 - | "{ \"timestamp\": \"Infinity\" }".as_bytes(),
|
5352 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5660 + | .body(::aws_smithy_http_server::body::boxed(
|
5661 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5662 + | &::aws_smithy_protocol_test::decode_body_data(
|
5663 + | "{ \"timestamp\": \"Infinity\" }".as_bytes(),
|
5664 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5665 + | ),
|
5353 5666 | )),
|
5354 5667 | ))
|
5355 5668 | .unwrap();
|
5356 5669 | #[allow(unused_mut)]
|
5357 5670 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5358 5671 | let config = crate::service::RestJsonConfig::builder().build();
|
5359 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5672 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5360 5673 | .malformed_timestamp_body_default(move |input: crate::input::MalformedTimestampBodyDefaultInput| {
|
5361 5674 | let sender = sender.clone();
|
5362 5675 | async move {
|
5363 5676 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDefaultOutput, crate::error::MalformedTimestampBodyDefaultError> };
|
5364 5677 | sender.send(()).await.expect("receiver dropped early");
|
5365 5678 | result
|
5366 5679 | }
|
5367 5680 | })
|
5368 5681 | .build_unchecked();
|
5369 5682 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5370 5683 | .await
|
5371 5684 | .expect("unable to make an HTTP request");
|
5372 5685 | ::pretty_assertions::assert_eq!(
|
5373 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5686 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5374 5687 | http_response.status()
|
5375 5688 | );
|
5376 5689 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5377 5690 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5378 5691 | http_response.headers(),
|
5379 5692 | expected_headers,
|
5380 5693 | ));
|
5381 5694 | }
|
5382 5695 | }
|
5383 5696 |
|
5384 5697 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
5385 5698 | /// Test ID: RestJsonBodyTimestampDefaultRejectsMalformedEpochSeconds_case6
|
5386 5699 | #[::tokio::test]
|
5387 5700 | #[::tracing_test::traced_test]
|
5388 5701 | async fn rest_json_body_timestamp_default_rejects_malformed_epoch_seconds_case6_malformed_request(
|
5389 5702 | ) {
|
5390 5703 | {
|
5391 5704 | #[allow(unused_mut)]
|
5392 - | let mut http_request = http::Request::builder()
|
5705 + | let mut http_request = ::http_1x::Request::builder()
|
5393 5706 | .uri("/MalformedTimestampBodyDefault")
|
5394 5707 | .method("POST")
|
5395 5708 | .header("content-type", "application/json")
|
5396 - | .body(::aws_smithy_http_server::body::Body::from(
|
5397 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5398 - | "{ \"timestamp\": -Infinity }".as_bytes(),
|
5399 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5709 + | .body(::aws_smithy_http_server::body::boxed(
|
5710 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5711 + | &::aws_smithy_protocol_test::decode_body_data(
|
5712 + | "{ \"timestamp\": -Infinity }".as_bytes(),
|
5713 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5714 + | ),
|
5400 5715 | )),
|
5401 5716 | ))
|
5402 5717 | .unwrap();
|
5403 5718 | #[allow(unused_mut)]
|
5404 5719 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5405 5720 | let config = crate::service::RestJsonConfig::builder().build();
|
5406 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5721 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5407 5722 | .malformed_timestamp_body_default(move |input: crate::input::MalformedTimestampBodyDefaultInput| {
|
5408 5723 | let sender = sender.clone();
|
5409 5724 | async move {
|
5410 5725 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDefaultOutput, crate::error::MalformedTimestampBodyDefaultError> };
|
5411 5726 | sender.send(()).await.expect("receiver dropped early");
|
5412 5727 | result
|
5413 5728 | }
|
5414 5729 | })
|
5415 5730 | .build_unchecked();
|
5416 5731 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5417 5732 | .await
|
5418 5733 | .expect("unable to make an HTTP request");
|
5419 5734 | ::pretty_assertions::assert_eq!(
|
5420 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5735 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5421 5736 | http_response.status()
|
5422 5737 | );
|
5423 5738 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5424 5739 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5425 5740 | http_response.headers(),
|
5426 5741 | expected_headers,
|
5427 5742 | ));
|
5428 5743 | }
|
5429 5744 | }
|
5430 5745 |
|
5431 5746 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
5432 5747 | /// Test ID: RestJsonBodyTimestampDefaultRejectsMalformedEpochSeconds_case7
|
5433 5748 | #[::tokio::test]
|
5434 5749 | #[::tracing_test::traced_test]
|
5435 5750 | async fn rest_json_body_timestamp_default_rejects_malformed_epoch_seconds_case7_malformed_request(
|
5436 5751 | ) {
|
5437 5752 | {
|
5438 5753 | #[allow(unused_mut)]
|
5439 - | let mut http_request = http::Request::builder()
|
5754 + | let mut http_request = ::http_1x::Request::builder()
|
5440 5755 | .uri("/MalformedTimestampBodyDefault")
|
5441 5756 | .method("POST")
|
5442 5757 | .header("content-type", "application/json")
|
5443 - | .body(::aws_smithy_http_server::body::Body::from(
|
5444 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5445 - | "{ \"timestamp\": \"-Infinity\" }".as_bytes(),
|
5446 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5758 + | .body(::aws_smithy_http_server::body::boxed(
|
5759 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5760 + | &::aws_smithy_protocol_test::decode_body_data(
|
5761 + | "{ \"timestamp\": \"-Infinity\" }".as_bytes(),
|
5762 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5763 + | ),
|
5447 5764 | )),
|
5448 5765 | ))
|
5449 5766 | .unwrap();
|
5450 5767 | #[allow(unused_mut)]
|
5451 5768 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5452 5769 | let config = crate::service::RestJsonConfig::builder().build();
|
5453 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5770 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5454 5771 | .malformed_timestamp_body_default(move |input: crate::input::MalformedTimestampBodyDefaultInput| {
|
5455 5772 | let sender = sender.clone();
|
5456 5773 | async move {
|
5457 5774 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDefaultOutput, crate::error::MalformedTimestampBodyDefaultError> };
|
5458 5775 | sender.send(()).await.expect("receiver dropped early");
|
5459 5776 | result
|
5460 5777 | }
|
5461 5778 | })
|
5462 5779 | .build_unchecked();
|
5463 5780 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5464 5781 | .await
|
5465 5782 | .expect("unable to make an HTTP request");
|
5466 5783 | ::pretty_assertions::assert_eq!(
|
5467 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5784 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5468 5785 | http_response.status()
|
5469 5786 | );
|
5470 5787 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5471 5788 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5472 5789 | http_response.headers(),
|
5473 5790 | expected_headers,
|
5474 5791 | ));
|
5475 5792 | }
|
5476 5793 | }
|
5477 5794 |
|
5478 5795 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
5479 5796 | /// Test ID: RestJsonBodyTimestampDefaultRejectsMalformedEpochSeconds_case8
|
5480 5797 | #[::tokio::test]
|
5481 5798 | #[::tracing_test::traced_test]
|
5482 5799 | async fn rest_json_body_timestamp_default_rejects_malformed_epoch_seconds_case8_malformed_request(
|
5483 5800 | ) {
|
5484 5801 | {
|
5485 5802 | #[allow(unused_mut)]
|
5486 - | let mut http_request = http::Request::builder()
|
5803 + | let mut http_request = ::http_1x::Request::builder()
|
5487 5804 | .uri("/MalformedTimestampBodyDefault")
|
5488 5805 | .method("POST")
|
5489 5806 | .header("content-type", "application/json")
|
5490 - | .body(::aws_smithy_http_server::body::Body::from(
|
5491 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5492 - | "{ \"timestamp\": NaN }".as_bytes(),
|
5493 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5807 + | .body(::aws_smithy_http_server::body::boxed(
|
5808 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5809 + | &::aws_smithy_protocol_test::decode_body_data(
|
5810 + | "{ \"timestamp\": NaN }".as_bytes(),
|
5811 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5812 + | ),
|
5494 5813 | )),
|
5495 5814 | ))
|
5496 5815 | .unwrap();
|
5497 5816 | #[allow(unused_mut)]
|
5498 5817 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5499 5818 | let config = crate::service::RestJsonConfig::builder().build();
|
5500 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5819 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5501 5820 | .malformed_timestamp_body_default(move |input: crate::input::MalformedTimestampBodyDefaultInput| {
|
5502 5821 | let sender = sender.clone();
|
5503 5822 | async move {
|
5504 5823 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDefaultOutput, crate::error::MalformedTimestampBodyDefaultError> };
|
5505 5824 | sender.send(()).await.expect("receiver dropped early");
|
5506 5825 | result
|
5507 5826 | }
|
5508 5827 | })
|
5509 5828 | .build_unchecked();
|
5510 5829 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5511 5830 | .await
|
5512 5831 | .expect("unable to make an HTTP request");
|
5513 5832 | ::pretty_assertions::assert_eq!(
|
5514 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5833 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5515 5834 | http_response.status()
|
5516 5835 | );
|
5517 5836 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5518 5837 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5519 5838 | http_response.headers(),
|
5520 5839 | expected_headers,
|
5521 5840 | ));
|
5522 5841 | }
|
5523 5842 | }
|
5524 5843 |
|
5525 5844 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
5526 5845 | /// Test ID: RestJsonBodyTimestampDefaultRejectsMalformedEpochSeconds_case9
|
5527 5846 | #[::tokio::test]
|
5528 5847 | #[::tracing_test::traced_test]
|
5529 5848 | async fn rest_json_body_timestamp_default_rejects_malformed_epoch_seconds_case9_malformed_request(
|
5530 5849 | ) {
|
5531 5850 | {
|
5532 5851 | #[allow(unused_mut)]
|
5533 - | let mut http_request = http::Request::builder()
|
5852 + | let mut http_request = ::http_1x::Request::builder()
|
5534 5853 | .uri("/MalformedTimestampBodyDefault")
|
5535 5854 | .method("POST")
|
5536 5855 | .header("content-type", "application/json")
|
5537 - | .body(::aws_smithy_http_server::body::Body::from(
|
5538 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5539 - | "{ \"timestamp\": \"NaN\" }".as_bytes(),
|
5540 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5856 + | .body(::aws_smithy_http_server::body::boxed(
|
5857 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5858 + | &::aws_smithy_protocol_test::decode_body_data(
|
5859 + | "{ \"timestamp\": \"NaN\" }".as_bytes(),
|
5860 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5861 + | ),
|
5541 5862 | )),
|
5542 5863 | ))
|
5543 5864 | .unwrap();
|
5544 5865 | #[allow(unused_mut)]
|
5545 5866 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5546 5867 | let config = crate::service::RestJsonConfig::builder().build();
|
5547 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5868 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5548 5869 | .malformed_timestamp_body_default(move |input: crate::input::MalformedTimestampBodyDefaultInput| {
|
5549 5870 | let sender = sender.clone();
|
5550 5871 | async move {
|
5551 5872 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDefaultOutput, crate::error::MalformedTimestampBodyDefaultError> };
|
5552 5873 | sender.send(()).await.expect("receiver dropped early");
|
5553 5874 | result
|
5554 5875 | }
|
5555 5876 | })
|
5556 5877 | .build_unchecked();
|
5557 5878 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5558 5879 | .await
|
5559 5880 | .expect("unable to make an HTTP request");
|
5560 5881 | ::pretty_assertions::assert_eq!(
|
5561 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5882 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5562 5883 | http_response.status()
|
5563 5884 | );
|
5564 5885 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5565 5886 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5566 5887 | http_response.headers(),
|
5567 5888 | expected_headers,
|
5568 5889 | ));
|
5569 5890 | }
|
5570 5891 | }
|
5571 5892 |
|
5572 5893 | /// By default, IMF-fixdate timestamps are rejected with a
|
5573 5894 | /// 400 SerializationException
|
5574 5895 | /// Test ID: RestJsonBodyTimestampDefaultRejectsHttpDate_case0
|
5575 5896 | #[::tokio::test]
|
5576 5897 | #[::tracing_test::traced_test]
|
5577 5898 | async fn rest_json_body_timestamp_default_rejects_http_date_case0_malformed_request() {
|
5578 5899 | {
|
5579 5900 | #[allow(unused_mut)]
|
5580 - | let mut http_request = http::Request::builder()
|
5901 + | let mut http_request = ::http_1x::Request::builder()
|
5581 5902 | .uri("/MalformedTimestampBodyDefault")
|
5582 5903 | .method("POST")
|
5583 5904 | .header("content-type", "application/json")
|
5584 - | .body(::aws_smithy_http_server::body::Body::from(
|
5585 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
5586 - | "{ \"timestamp\": \"Tue, 29 Apr 2014 18:30:38 GMT\" }".as_bytes(),
|
5587 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5905 + | .body(::aws_smithy_http_server::body::boxed(
|
5906 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
5907 + | &::aws_smithy_protocol_test::decode_body_data(
|
5908 + | "{ \"timestamp\": \"Tue, 29 Apr 2014 18:30:38 GMT\" }".as_bytes(),
|
5909 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
5910 + | ),
|
5588 5911 | )),
|
5589 5912 | ))
|
5590 5913 | .unwrap();
|
5591 5914 | #[allow(unused_mut)]
|
5592 5915 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5593 5916 | let config = crate::service::RestJsonConfig::builder().build();
|
5594 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
5917 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5595 5918 | .malformed_timestamp_body_default(move |input: crate::input::MalformedTimestampBodyDefaultInput| {
|
5596 5919 | let sender = sender.clone();
|
5597 5920 | async move {
|
5598 5921 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampBodyDefaultOutput, crate::error::MalformedTimestampBodyDefaultError> };
|
5599 5922 | sender.send(()).await.expect("receiver dropped early");
|
5600 5923 | result
|
5601 5924 | }
|
5602 5925 | })
|
5603 5926 | .build_unchecked();
|
5604 5927 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5605 5928 | .await
|
5606 5929 | .expect("unable to make an HTTP request");
|
5607 5930 | ::pretty_assertions::assert_eq!(
|
5608 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5931 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5609 5932 | http_response.status()
|
5610 5933 | );
|
5611 5934 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5612 5935 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5613 5936 | http_response.headers(),
|
5614 5937 | expected_headers,
|
5615 5938 | ));
|
5616 5939 | }
|
5617 5940 | }
|
5941 + |
|
5942 + | /* ProtocolTestGenerator.kt:98 */
|
5618 5943 | }
|
5619 5944 |
|
5945 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
5620 5946 | ::pin_project_lite::pin_project! {
|
5621 5947 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
5622 5948 | /// [`MalformedTimestampHeaderEpochInput`](crate::input::MalformedTimestampHeaderEpochInput) using modelled bindings.
|
5623 5949 | pub struct MalformedTimestampHeaderEpochInputFuture {
|
5624 5950 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedTimestampHeaderEpochInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
5625 5951 | }
|
5626 5952 | }
|
5627 5953 |
|
5628 5954 | impl std::future::Future for MalformedTimestampHeaderEpochInputFuture {
|
5629 5955 | type Output = Result<
|
5630 5956 | crate::input::MalformedTimestampHeaderEpochInput,
|
5631 5957 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
5632 5958 | >;
|
5633 5959 |
|
5634 5960 | fn poll(
|
5635 5961 | self: std::pin::Pin<&mut Self>,
|
5636 5962 | cx: &mut std::task::Context<'_>,
|
5637 5963 | ) -> std::task::Poll<Self::Output> {
|
5638 5964 | let this = self.project();
|
5639 5965 | this.inner.as_mut().poll(cx)
|
5640 5966 | }
|
5641 5967 | }
|
5642 5968 |
|
5643 5969 | impl<B>
|
5644 5970 | ::aws_smithy_http_server::request::FromRequest<
|
5645 5971 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
5646 5972 | B,
|
5647 5973 | > for crate::input::MalformedTimestampHeaderEpochInput
|
5648 5974 | where
|
5649 5975 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
5650 5976 | B: 'static,
|
5651 5977 |
|
5652 5978 | B::Data: Send,
|
5653 5979 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
5654 5980 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
5655 5981 | {
|
5656 5982 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
5657 5983 | type Future = MalformedTimestampHeaderEpochInputFuture;
|
5658 5984 |
|
5659 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
5985 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
5660 5986 | let fut = async move {
|
5661 5987 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
5662 5988 | request.headers(),
|
5663 5989 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
5664 5990 | ) {
|
5665 5991 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
5666 5992 | }
|
5667 5993 | crate::protocol_serde::shape_malformed_timestamp_header_epoch::de_malformed_timestamp_header_epoch_http_request(request)
|
5668 5994 | .await
|
5669 5995 | };
|
5670 5996 | use ::futures_util::future::TryFutureExt;
|
5671 5997 | let fut = fut.map_err(
|
5672 5998 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
5673 5999 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
5674 6000 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
5675 6001 | e,
|
5676 6002 | )
|
5677 6003 | },
|
5678 6004 | );
|
5679 6005 | MalformedTimestampHeaderEpochInputFuture {
|
5680 6006 | inner: Box::pin(fut),
|
5681 6007 | }
|
5682 6008 | }
|
5683 6009 | }
|
6010 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
5684 6011 | impl
|
5685 6012 | ::aws_smithy_http_server::response::IntoResponse<
|
5686 6013 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
5687 6014 | > for crate::output::MalformedTimestampHeaderEpochOutput
|
5688 6015 | {
|
5689 6016 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
5690 6017 | match crate::protocol_serde::shape_malformed_timestamp_header_epoch::ser_malformed_timestamp_header_epoch_http_response(self) {
|
5691 6018 | Ok(response) => response,
|
5692 6019 | Err(e) => {
|
5693 6020 | ::tracing::error!(error = %e, "failed to serialize response");
|
5694 6021 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
5695 6022 | }
|
5696 6023 | }
|
5697 6024 | }
|
5698 6025 | }
|
6026 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
5699 6027 | impl
|
5700 6028 | ::aws_smithy_http_server::response::IntoResponse<
|
5701 6029 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
5702 6030 | > for crate::error::MalformedTimestampHeaderEpochError
|
5703 6031 | {
|
5704 6032 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
5705 6033 | match crate::protocol_serde::shape_malformed_timestamp_header_epoch::ser_malformed_timestamp_header_epoch_http_error(&self) {
|
5706 6034 | Ok(mut response) => {
|
5707 6035 | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
5708 6036 | response
|
5709 6037 | },
|
5710 6038 | Err(e) => {
|
5711 6039 | ::tracing::error!(error = %e, "failed to serialize response");
|
5712 6040 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
5713 6041 | }
|
5714 6042 | }
|
5715 6043 | }
|
5716 6044 | }
|
5717 6045 |
|
6046 + | /* RustType.kt:534 */
|
5718 6047 | #[allow(unreachable_code, unused_variables)]
|
6048 + | /* RustType.kt:534 */
|
5719 6049 | #[cfg(test)]
|
6050 + | /* ProtocolTestGenerator.kt:98 */
|
5720 6051 | mod malformed_timestamp_header_epoch_test {
|
5721 6052 |
|
5722 6053 | /// When the format is epoch-seconds, RFC3339 timestamps are rejected with a
|
5723 6054 | /// 400 SerializationException
|
5724 6055 | /// Test ID: RestJsonHeaderTimestampEpochRejectsDateTime_case0
|
5725 6056 | #[::tokio::test]
|
5726 6057 | #[::tracing_test::traced_test]
|
5727 6058 | async fn rest_json_header_timestamp_epoch_rejects_date_time_case0_malformed_request() {
|
5728 6059 | {
|
5729 6060 | #[allow(unused_mut)]
|
5730 - | let mut http_request = http::Request::builder()
|
6061 + | let mut http_request = ::http_1x::Request::builder()
|
5731 6062 | .uri("/MalformedTimestampHeaderEpoch")
|
5732 6063 | .method("POST")
|
5733 6064 | .header("timestamp", "1985-04-12T23:20:50.52Z")
|
5734 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6065 + | .body(::aws_smithy_http_server::body::boxed(
|
6066 + | ::http_body_util::Empty::new(),
|
6067 + | ))
|
5735 6068 | .unwrap();
|
5736 6069 | #[allow(unused_mut)]
|
5737 6070 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5738 6071 | let config = crate::service::RestJsonConfig::builder().build();
|
5739 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6072 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5740 6073 | .malformed_timestamp_header_epoch(move |input: crate::input::MalformedTimestampHeaderEpochInput| {
|
5741 6074 | let sender = sender.clone();
|
5742 6075 | async move {
|
5743 6076 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderEpochOutput, crate::error::MalformedTimestampHeaderEpochError> };
|
5744 6077 | sender.send(()).await.expect("receiver dropped early");
|
5745 6078 | result
|
5746 6079 | }
|
5747 6080 | })
|
5748 6081 | .build_unchecked();
|
5749 6082 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5750 6083 | .await
|
5751 6084 | .expect("unable to make an HTTP request");
|
5752 6085 | ::pretty_assertions::assert_eq!(
|
5753 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6086 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5754 6087 | http_response.status()
|
5755 6088 | );
|
5756 6089 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5757 6090 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5758 6091 | http_response.headers(),
|
5759 6092 | expected_headers,
|
5760 6093 | ));
|
5761 6094 | }
|
5762 6095 | }
|
5763 6096 |
|
5764 6097 | /// When the format is epoch-seconds, RFC3339 timestamps are rejected with a
|
5765 6098 | /// 400 SerializationException
|
5766 6099 | /// Test ID: RestJsonHeaderTimestampEpochRejectsDateTime_case1
|
5767 6100 | #[::tokio::test]
|
5768 6101 | #[::tracing_test::traced_test]
|
5769 6102 | async fn rest_json_header_timestamp_epoch_rejects_date_time_case1_malformed_request() {
|
5770 6103 | {
|
5771 6104 | #[allow(unused_mut)]
|
5772 - | let mut http_request = http::Request::builder()
|
6105 + | let mut http_request = ::http_1x::Request::builder()
|
5773 6106 | .uri("/MalformedTimestampHeaderEpoch")
|
5774 6107 | .method("POST")
|
5775 6108 | .header("timestamp", "1985-04-12T23:20:50Z")
|
5776 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6109 + | .body(::aws_smithy_http_server::body::boxed(
|
6110 + | ::http_body_util::Empty::new(),
|
6111 + | ))
|
5777 6112 | .unwrap();
|
5778 6113 | #[allow(unused_mut)]
|
5779 6114 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5780 6115 | let config = crate::service::RestJsonConfig::builder().build();
|
5781 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6116 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5782 6117 | .malformed_timestamp_header_epoch(move |input: crate::input::MalformedTimestampHeaderEpochInput| {
|
5783 6118 | let sender = sender.clone();
|
5784 6119 | async move {
|
5785 6120 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderEpochOutput, crate::error::MalformedTimestampHeaderEpochError> };
|
5786 6121 | sender.send(()).await.expect("receiver dropped early");
|
5787 6122 | result
|
5788 6123 | }
|
5789 6124 | })
|
5790 6125 | .build_unchecked();
|
5791 6126 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5792 6127 | .await
|
5793 6128 | .expect("unable to make an HTTP request");
|
5794 6129 | ::pretty_assertions::assert_eq!(
|
5795 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6130 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5796 6131 | http_response.status()
|
5797 6132 | );
|
5798 6133 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5799 6134 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5800 6135 | http_response.headers(),
|
5801 6136 | expected_headers,
|
5802 6137 | ));
|
5803 6138 | }
|
5804 6139 | }
|
5805 6140 |
|
5806 6141 | /// When the format is epoch-seconds, RFC3339 timestamps are rejected with a
|
5807 6142 | /// 400 SerializationException
|
5808 6143 | /// Test ID: RestJsonHeaderTimestampEpochRejectsDateTime_case2
|
5809 6144 | #[::tokio::test]
|
5810 6145 | #[::tracing_test::traced_test]
|
5811 6146 | async fn rest_json_header_timestamp_epoch_rejects_date_time_case2_malformed_request() {
|
5812 6147 | {
|
5813 6148 | #[allow(unused_mut)]
|
5814 - | let mut http_request = http::Request::builder()
|
6149 + | let mut http_request = ::http_1x::Request::builder()
|
5815 6150 | .uri("/MalformedTimestampHeaderEpoch")
|
5816 6151 | .method("POST")
|
5817 6152 | .header("timestamp", "1996-12-19T16:39:57-08:00")
|
5818 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6153 + | .body(::aws_smithy_http_server::body::boxed(
|
6154 + | ::http_body_util::Empty::new(),
|
6155 + | ))
|
5819 6156 | .unwrap();
|
5820 6157 | #[allow(unused_mut)]
|
5821 6158 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5822 6159 | let config = crate::service::RestJsonConfig::builder().build();
|
5823 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6160 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5824 6161 | .malformed_timestamp_header_epoch(move |input: crate::input::MalformedTimestampHeaderEpochInput| {
|
5825 6162 | let sender = sender.clone();
|
5826 6163 | async move {
|
5827 6164 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderEpochOutput, crate::error::MalformedTimestampHeaderEpochError> };
|
5828 6165 | sender.send(()).await.expect("receiver dropped early");
|
5829 6166 | result
|
5830 6167 | }
|
5831 6168 | })
|
5832 6169 | .build_unchecked();
|
5833 6170 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5834 6171 | .await
|
5835 6172 | .expect("unable to make an HTTP request");
|
5836 6173 | ::pretty_assertions::assert_eq!(
|
5837 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6174 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5838 6175 | http_response.status()
|
5839 6176 | );
|
5840 6177 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5841 6178 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5842 6179 | http_response.headers(),
|
5843 6180 | expected_headers,
|
5844 6181 | ));
|
5845 6182 | }
|
5846 6183 | }
|
5847 6184 |
|
5848 6185 | /// When the format is epoch-seconds, IMF-fixdate timestamps are rejected with a
|
5849 6186 | /// 400 SerializationException
|
5850 6187 | /// Test ID: RestJsonHeaderTimestampEpochRejectsHttpDate_case0
|
5851 6188 | #[::tokio::test]
|
5852 6189 | #[::tracing_test::traced_test]
|
5853 6190 | async fn rest_json_header_timestamp_epoch_rejects_http_date_case0_malformed_request() {
|
5854 6191 | {
|
5855 6192 | #[allow(unused_mut)]
|
5856 - | let mut http_request = http::Request::builder()
|
6193 + | let mut http_request = ::http_1x::Request::builder()
|
5857 6194 | .uri("/MalformedTimestampHeaderEpoch")
|
5858 6195 | .method("POST")
|
5859 6196 | .header("timestamp", "Tue, 29 Apr 2014 18:30:38 GMT")
|
5860 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6197 + | .body(::aws_smithy_http_server::body::boxed(
|
6198 + | ::http_body_util::Empty::new(),
|
6199 + | ))
|
5861 6200 | .unwrap();
|
5862 6201 | #[allow(unused_mut)]
|
5863 6202 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5864 6203 | let config = crate::service::RestJsonConfig::builder().build();
|
5865 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6204 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5866 6205 | .malformed_timestamp_header_epoch(move |input: crate::input::MalformedTimestampHeaderEpochInput| {
|
5867 6206 | let sender = sender.clone();
|
5868 6207 | async move {
|
5869 6208 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderEpochOutput, crate::error::MalformedTimestampHeaderEpochError> };
|
5870 6209 | sender.send(()).await.expect("receiver dropped early");
|
5871 6210 | result
|
5872 6211 | }
|
5873 6212 | })
|
5874 6213 | .build_unchecked();
|
5875 6214 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5876 6215 | .await
|
5877 6216 | .expect("unable to make an HTTP request");
|
5878 6217 | ::pretty_assertions::assert_eq!(
|
5879 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6218 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5880 6219 | http_response.status()
|
5881 6220 | );
|
5882 6221 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5883 6222 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5884 6223 | http_response.headers(),
|
5885 6224 | expected_headers,
|
5886 6225 | ));
|
5887 6226 | }
|
5888 6227 | }
|
5889 6228 |
|
5890 6229 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
5891 6230 | /// Test ID: RestJsonHeaderTimestampEpochRejectsMalformedValues_case0
|
5892 6231 | #[::tokio::test]
|
5893 6232 | #[::tracing_test::traced_test]
|
5894 6233 | async fn rest_json_header_timestamp_epoch_rejects_malformed_values_case0_malformed_request() {
|
5895 6234 | {
|
5896 6235 | #[allow(unused_mut)]
|
5897 - | let mut http_request = http::Request::builder()
|
6236 + | let mut http_request = ::http_1x::Request::builder()
|
5898 6237 | .uri("/MalformedTimestampHeaderEpoch")
|
5899 6238 | .method("POST")
|
5900 6239 | .header("timestamp", "true")
|
5901 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6240 + | .body(::aws_smithy_http_server::body::boxed(
|
6241 + | ::http_body_util::Empty::new(),
|
6242 + | ))
|
5902 6243 | .unwrap();
|
5903 6244 | #[allow(unused_mut)]
|
5904 6245 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5905 6246 | let config = crate::service::RestJsonConfig::builder().build();
|
5906 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6247 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5907 6248 | .malformed_timestamp_header_epoch(move |input: crate::input::MalformedTimestampHeaderEpochInput| {
|
5908 6249 | let sender = sender.clone();
|
5909 6250 | async move {
|
5910 6251 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderEpochOutput, crate::error::MalformedTimestampHeaderEpochError> };
|
5911 6252 | sender.send(()).await.expect("receiver dropped early");
|
5912 6253 | result
|
5913 6254 | }
|
5914 6255 | })
|
5915 6256 | .build_unchecked();
|
5916 6257 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5917 6258 | .await
|
5918 6259 | .expect("unable to make an HTTP request");
|
5919 6260 | ::pretty_assertions::assert_eq!(
|
5920 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6261 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5921 6262 | http_response.status()
|
5922 6263 | );
|
5923 6264 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5924 6265 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5925 6266 | http_response.headers(),
|
5926 6267 | expected_headers,
|
5927 6268 | ));
|
5928 6269 | }
|
5929 6270 | }
|
5930 6271 |
|
5931 6272 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
5932 6273 | /// Test ID: RestJsonHeaderTimestampEpochRejectsMalformedValues_case1
|
5933 6274 | #[::tokio::test]
|
5934 6275 | #[::tracing_test::traced_test]
|
5935 6276 | async fn rest_json_header_timestamp_epoch_rejects_malformed_values_case1_malformed_request() {
|
5936 6277 | {
|
5937 6278 | #[allow(unused_mut)]
|
5938 - | let mut http_request = http::Request::builder()
|
6279 + | let mut http_request = ::http_1x::Request::builder()
|
5939 6280 | .uri("/MalformedTimestampHeaderEpoch")
|
5940 6281 | .method("POST")
|
5941 6282 | .header("timestamp", "1515531081ABC")
|
5942 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6283 + | .body(::aws_smithy_http_server::body::boxed(
|
6284 + | ::http_body_util::Empty::new(),
|
6285 + | ))
|
5943 6286 | .unwrap();
|
5944 6287 | #[allow(unused_mut)]
|
5945 6288 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5946 6289 | let config = crate::service::RestJsonConfig::builder().build();
|
5947 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6290 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5948 6291 | .malformed_timestamp_header_epoch(move |input: crate::input::MalformedTimestampHeaderEpochInput| {
|
5949 6292 | let sender = sender.clone();
|
5950 6293 | async move {
|
5951 6294 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderEpochOutput, crate::error::MalformedTimestampHeaderEpochError> };
|
5952 6295 | sender.send(()).await.expect("receiver dropped early");
|
5953 6296 | result
|
5954 6297 | }
|
5955 6298 | })
|
5956 6299 | .build_unchecked();
|
5957 6300 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5958 6301 | .await
|
5959 6302 | .expect("unable to make an HTTP request");
|
5960 6303 | ::pretty_assertions::assert_eq!(
|
5961 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6304 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
5962 6305 | http_response.status()
|
5963 6306 | );
|
5964 6307 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
5965 6308 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
5966 6309 | http_response.headers(),
|
5967 6310 | expected_headers,
|
5968 6311 | ));
|
5969 6312 | }
|
5970 6313 | }
|
5971 6314 |
|
5972 6315 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
5973 6316 | /// Test ID: RestJsonHeaderTimestampEpochRejectsMalformedValues_case2
|
5974 6317 | #[::tokio::test]
|
5975 6318 | #[::tracing_test::traced_test]
|
5976 6319 | async fn rest_json_header_timestamp_epoch_rejects_malformed_values_case2_malformed_request() {
|
5977 6320 | {
|
5978 6321 | #[allow(unused_mut)]
|
5979 - | let mut http_request = http::Request::builder()
|
6322 + | let mut http_request = ::http_1x::Request::builder()
|
5980 6323 | .uri("/MalformedTimestampHeaderEpoch")
|
5981 6324 | .method("POST")
|
5982 6325 | .header("timestamp", "0x42")
|
5983 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6326 + | .body(::aws_smithy_http_server::body::boxed(
|
6327 + | ::http_body_util::Empty::new(),
|
6328 + | ))
|
5984 6329 | .unwrap();
|
5985 6330 | #[allow(unused_mut)]
|
5986 6331 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
5987 6332 | let config = crate::service::RestJsonConfig::builder().build();
|
5988 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6333 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
5989 6334 | .malformed_timestamp_header_epoch(move |input: crate::input::MalformedTimestampHeaderEpochInput| {
|
5990 6335 | let sender = sender.clone();
|
5991 6336 | async move {
|
5992 6337 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderEpochOutput, crate::error::MalformedTimestampHeaderEpochError> };
|
5993 6338 | sender.send(()).await.expect("receiver dropped early");
|
5994 6339 | result
|
5995 6340 | }
|
5996 6341 | })
|
5997 6342 | .build_unchecked();
|
5998 6343 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
5999 6344 | .await
|
6000 6345 | .expect("unable to make an HTTP request");
|
6001 6346 | ::pretty_assertions::assert_eq!(
|
6002 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6347 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6003 6348 | http_response.status()
|
6004 6349 | );
|
6005 6350 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6006 6351 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6007 6352 | http_response.headers(),
|
6008 6353 | expected_headers,
|
6009 6354 | ));
|
6010 6355 | }
|
6011 6356 | }
|
6012 6357 |
|
6013 6358 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
6014 6359 | /// Test ID: RestJsonHeaderTimestampEpochRejectsMalformedValues_case3
|
6015 6360 | #[::tokio::test]
|
6016 6361 | #[::tracing_test::traced_test]
|
6017 6362 | async fn rest_json_header_timestamp_epoch_rejects_malformed_values_case3_malformed_request() {
|
6018 6363 | {
|
6019 6364 | #[allow(unused_mut)]
|
6020 - | let mut http_request = http::Request::builder()
|
6365 + | let mut http_request = ::http_1x::Request::builder()
|
6021 6366 | .uri("/MalformedTimestampHeaderEpoch")
|
6022 6367 | .method("POST")
|
6023 6368 | .header("timestamp", "1515531081.123.456")
|
6024 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6369 + | .body(::aws_smithy_http_server::body::boxed(
|
6370 + | ::http_body_util::Empty::new(),
|
6371 + | ))
|
6025 6372 | .unwrap();
|
6026 6373 | #[allow(unused_mut)]
|
6027 6374 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6028 6375 | let config = crate::service::RestJsonConfig::builder().build();
|
6029 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6376 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6030 6377 | .malformed_timestamp_header_epoch(move |input: crate::input::MalformedTimestampHeaderEpochInput| {
|
6031 6378 | let sender = sender.clone();
|
6032 6379 | async move {
|
6033 6380 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderEpochOutput, crate::error::MalformedTimestampHeaderEpochError> };
|
6034 6381 | sender.send(()).await.expect("receiver dropped early");
|
6035 6382 | result
|
6036 6383 | }
|
6037 6384 | })
|
6038 6385 | .build_unchecked();
|
6039 6386 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6040 6387 | .await
|
6041 6388 | .expect("unable to make an HTTP request");
|
6042 6389 | ::pretty_assertions::assert_eq!(
|
6043 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6390 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6044 6391 | http_response.status()
|
6045 6392 | );
|
6046 6393 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6047 6394 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6048 6395 | http_response.headers(),
|
6049 6396 | expected_headers,
|
6050 6397 | ));
|
6051 6398 | }
|
6052 6399 | }
|
6053 6400 |
|
6054 6401 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
6055 6402 | /// Test ID: RestJsonHeaderTimestampEpochRejectsMalformedValues_case4
|
6056 6403 | #[::tokio::test]
|
6057 6404 | #[::tracing_test::traced_test]
|
6058 6405 | async fn rest_json_header_timestamp_epoch_rejects_malformed_values_case4_malformed_request() {
|
6059 6406 | {
|
6060 6407 | #[allow(unused_mut)]
|
6061 - | let mut http_request = http::Request::builder()
|
6408 + | let mut http_request = ::http_1x::Request::builder()
|
6062 6409 | .uri("/MalformedTimestampHeaderEpoch")
|
6063 6410 | .method("POST")
|
6064 6411 | .header("timestamp", "Infinity")
|
6065 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6412 + | .body(::aws_smithy_http_server::body::boxed(
|
6413 + | ::http_body_util::Empty::new(),
|
6414 + | ))
|
6066 6415 | .unwrap();
|
6067 6416 | #[allow(unused_mut)]
|
6068 6417 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6069 6418 | let config = crate::service::RestJsonConfig::builder().build();
|
6070 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6419 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6071 6420 | .malformed_timestamp_header_epoch(move |input: crate::input::MalformedTimestampHeaderEpochInput| {
|
6072 6421 | let sender = sender.clone();
|
6073 6422 | async move {
|
6074 6423 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderEpochOutput, crate::error::MalformedTimestampHeaderEpochError> };
|
6075 6424 | sender.send(()).await.expect("receiver dropped early");
|
6076 6425 | result
|
6077 6426 | }
|
6078 6427 | })
|
6079 6428 | .build_unchecked();
|
6080 6429 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6081 6430 | .await
|
6082 6431 | .expect("unable to make an HTTP request");
|
6083 6432 | ::pretty_assertions::assert_eq!(
|
6084 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6433 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6085 6434 | http_response.status()
|
6086 6435 | );
|
6087 6436 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6088 6437 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6089 6438 | http_response.headers(),
|
6090 6439 | expected_headers,
|
6091 6440 | ));
|
6092 6441 | }
|
6093 6442 | }
|
6094 6443 |
|
6095 6444 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
6096 6445 | /// Test ID: RestJsonHeaderTimestampEpochRejectsMalformedValues_case5
|
6097 6446 | #[::tokio::test]
|
6098 6447 | #[::tracing_test::traced_test]
|
6099 6448 | async fn rest_json_header_timestamp_epoch_rejects_malformed_values_case5_malformed_request() {
|
6100 6449 | {
|
6101 6450 | #[allow(unused_mut)]
|
6102 - | let mut http_request = http::Request::builder()
|
6451 + | let mut http_request = ::http_1x::Request::builder()
|
6103 6452 | .uri("/MalformedTimestampHeaderEpoch")
|
6104 6453 | .method("POST")
|
6105 6454 | .header("timestamp", "-Infinity")
|
6106 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6455 + | .body(::aws_smithy_http_server::body::boxed(
|
6456 + | ::http_body_util::Empty::new(),
|
6457 + | ))
|
6107 6458 | .unwrap();
|
6108 6459 | #[allow(unused_mut)]
|
6109 6460 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6110 6461 | let config = crate::service::RestJsonConfig::builder().build();
|
6111 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6462 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6112 6463 | .malformed_timestamp_header_epoch(move |input: crate::input::MalformedTimestampHeaderEpochInput| {
|
6113 6464 | let sender = sender.clone();
|
6114 6465 | async move {
|
6115 6466 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderEpochOutput, crate::error::MalformedTimestampHeaderEpochError> };
|
6116 6467 | sender.send(()).await.expect("receiver dropped early");
|
6117 6468 | result
|
6118 6469 | }
|
6119 6470 | })
|
6120 6471 | .build_unchecked();
|
6121 6472 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6122 6473 | .await
|
6123 6474 | .expect("unable to make an HTTP request");
|
6124 6475 | ::pretty_assertions::assert_eq!(
|
6125 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6476 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6126 6477 | http_response.status()
|
6127 6478 | );
|
6128 6479 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6129 6480 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6130 6481 | http_response.headers(),
|
6131 6482 | expected_headers,
|
6132 6483 | ));
|
6133 6484 | }
|
6134 6485 | }
|
6135 6486 |
|
6136 6487 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
6137 6488 | /// Test ID: RestJsonHeaderTimestampEpochRejectsMalformedValues_case6
|
6138 6489 | #[::tokio::test]
|
6139 6490 | #[::tracing_test::traced_test]
|
6140 6491 | async fn rest_json_header_timestamp_epoch_rejects_malformed_values_case6_malformed_request() {
|
6141 6492 | {
|
6142 6493 | #[allow(unused_mut)]
|
6143 - | let mut http_request = http::Request::builder()
|
6494 + | let mut http_request = ::http_1x::Request::builder()
|
6144 6495 | .uri("/MalformedTimestampHeaderEpoch")
|
6145 6496 | .method("POST")
|
6146 6497 | .header("timestamp", "NaN")
|
6147 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6498 + | .body(::aws_smithy_http_server::body::boxed(
|
6499 + | ::http_body_util::Empty::new(),
|
6500 + | ))
|
6148 6501 | .unwrap();
|
6149 6502 | #[allow(unused_mut)]
|
6150 6503 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6151 6504 | let config = crate::service::RestJsonConfig::builder().build();
|
6152 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6505 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6153 6506 | .malformed_timestamp_header_epoch(move |input: crate::input::MalformedTimestampHeaderEpochInput| {
|
6154 6507 | let sender = sender.clone();
|
6155 6508 | async move {
|
6156 6509 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderEpochOutput, crate::error::MalformedTimestampHeaderEpochError> };
|
6157 6510 | sender.send(()).await.expect("receiver dropped early");
|
6158 6511 | result
|
6159 6512 | }
|
6160 6513 | })
|
6161 6514 | .build_unchecked();
|
6162 6515 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6163 6516 | .await
|
6164 6517 | .expect("unable to make an HTTP request");
|
6165 6518 | ::pretty_assertions::assert_eq!(
|
6166 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6519 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6167 6520 | http_response.status()
|
6168 6521 | );
|
6169 6522 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6170 6523 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6171 6524 | http_response.headers(),
|
6172 6525 | expected_headers,
|
6173 6526 | ));
|
6174 6527 | }
|
6175 6528 | }
|
6529 + |
|
6530 + | /* ProtocolTestGenerator.kt:98 */
|
6176 6531 | }
|
6177 6532 |
|
6533 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
6178 6534 | ::pin_project_lite::pin_project! {
|
6179 6535 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
6180 6536 | /// [`MalformedTimestampHeaderDateTimeInput`](crate::input::MalformedTimestampHeaderDateTimeInput) using modelled bindings.
|
6181 6537 | pub struct MalformedTimestampHeaderDateTimeInputFuture {
|
6182 6538 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedTimestampHeaderDateTimeInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
6183 6539 | }
|
6184 6540 | }
|
6185 6541 |
|
6186 6542 | impl std::future::Future for MalformedTimestampHeaderDateTimeInputFuture {
|
6187 6543 | type Output = Result<
|
6188 6544 | crate::input::MalformedTimestampHeaderDateTimeInput,
|
6189 6545 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
6190 6546 | >;
|
6191 6547 |
|
6192 6548 | fn poll(
|
6193 6549 | self: std::pin::Pin<&mut Self>,
|
6194 6550 | cx: &mut std::task::Context<'_>,
|
6195 6551 | ) -> std::task::Poll<Self::Output> {
|
6196 6552 | let this = self.project();
|
6197 6553 | this.inner.as_mut().poll(cx)
|
6198 6554 | }
|
6199 6555 | }
|
6200 6556 |
|
6201 6557 | impl<B>
|
6202 6558 | ::aws_smithy_http_server::request::FromRequest<
|
6203 6559 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6204 6560 | B,
|
6205 6561 | > for crate::input::MalformedTimestampHeaderDateTimeInput
|
6206 6562 | where
|
6207 6563 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
6208 6564 | B: 'static,
|
6209 6565 |
|
6210 6566 | B::Data: Send,
|
6211 6567 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
6212 6568 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
6213 6569 | {
|
6214 6570 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
6215 6571 | type Future = MalformedTimestampHeaderDateTimeInputFuture;
|
6216 6572 |
|
6217 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
6573 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
6218 6574 | let fut = async move {
|
6219 6575 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
6220 6576 | request.headers(),
|
6221 6577 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
6222 6578 | ) {
|
6223 6579 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
6224 6580 | }
|
6225 6581 | crate::protocol_serde::shape_malformed_timestamp_header_date_time::de_malformed_timestamp_header_date_time_http_request(request)
|
6226 6582 | .await
|
6227 6583 | };
|
6228 6584 | use ::futures_util::future::TryFutureExt;
|
6229 6585 | let fut = fut.map_err(
|
6230 6586 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
6231 6587 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
6232 6588 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
6233 6589 | e,
|
6234 6590 | )
|
6235 6591 | },
|
6236 6592 | );
|
6237 6593 | MalformedTimestampHeaderDateTimeInputFuture {
|
6238 6594 | inner: Box::pin(fut),
|
6239 6595 | }
|
6240 6596 | }
|
6241 6597 | }
|
6598 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
6242 6599 | impl
|
6243 6600 | ::aws_smithy_http_server::response::IntoResponse<
|
6244 6601 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6245 6602 | > for crate::output::MalformedTimestampHeaderDateTimeOutput
|
6246 6603 | {
|
6247 6604 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6248 6605 | match crate::protocol_serde::shape_malformed_timestamp_header_date_time::ser_malformed_timestamp_header_date_time_http_response(self) {
|
6249 6606 | Ok(response) => response,
|
6250 6607 | Err(e) => {
|
6251 6608 | ::tracing::error!(error = %e, "failed to serialize response");
|
6252 6609 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6253 6610 | }
|
6254 6611 | }
|
6255 6612 | }
|
6256 6613 | }
|
6614 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
6257 6615 | impl
|
6258 6616 | ::aws_smithy_http_server::response::IntoResponse<
|
6259 6617 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
6260 6618 | > for crate::error::MalformedTimestampHeaderDateTimeError
|
6261 6619 | {
|
6262 6620 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
6263 6621 | match crate::protocol_serde::shape_malformed_timestamp_header_date_time::ser_malformed_timestamp_header_date_time_http_error(&self) {
|
6264 6622 | Ok(mut response) => {
|
6265 6623 | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
6266 6624 | response
|
6267 6625 | },
|
6268 6626 | Err(e) => {
|
6269 6627 | ::tracing::error!(error = %e, "failed to serialize response");
|
6270 6628 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
6271 6629 | }
|
6272 6630 | }
|
6273 6631 | }
|
6274 6632 | }
|
6275 6633 |
|
6634 + | /* RustType.kt:534 */
|
6276 6635 | #[allow(unreachable_code, unused_variables)]
|
6636 + | /* RustType.kt:534 */
|
6277 6637 | #[cfg(test)]
|
6638 + | /* ProtocolTestGenerator.kt:98 */
|
6278 6639 | mod malformed_timestamp_header_date_time_test {
|
6279 6640 |
|
6280 6641 | /// When the format is date-time, IMF-fixdate timestamps are rejected with a
|
6281 6642 | /// 400 SerializationException
|
6282 6643 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsHttpDate_case0
|
6283 6644 | #[::tokio::test]
|
6284 6645 | #[::tracing_test::traced_test]
|
6285 6646 | async fn rest_json_header_timestamp_date_time_rejects_http_date_case0_malformed_request() {
|
6286 6647 | {
|
6287 6648 | #[allow(unused_mut)]
|
6288 - | let mut http_request = http::Request::builder()
|
6649 + | let mut http_request = ::http_1x::Request::builder()
|
6289 6650 | .uri("/MalformedTimestampHeaderDateTime")
|
6290 6651 | .method("POST")
|
6291 6652 | .header("timestamp", "Tue, 29 Apr 2014 18:30:38 GMT")
|
6292 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6653 + | .body(::aws_smithy_http_server::body::boxed(
|
6654 + | ::http_body_util::Empty::new(),
|
6655 + | ))
|
6293 6656 | .unwrap();
|
6294 6657 | #[allow(unused_mut)]
|
6295 6658 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6296 6659 | let config = crate::service::RestJsonConfig::builder().build();
|
6297 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6660 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6298 6661 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6299 6662 | let sender = sender.clone();
|
6300 6663 | async move {
|
6301 6664 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6302 6665 | sender.send(()).await.expect("receiver dropped early");
|
6303 6666 | result
|
6304 6667 | }
|
6305 6668 | })
|
6306 6669 | .build_unchecked();
|
6307 6670 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6308 6671 | .await
|
6309 6672 | .expect("unable to make an HTTP request");
|
6310 6673 | ::pretty_assertions::assert_eq!(
|
6311 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6674 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6312 6675 | http_response.status()
|
6313 6676 | );
|
6314 6677 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6315 6678 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6316 6679 | http_response.headers(),
|
6317 6680 | expected_headers,
|
6318 6681 | ));
|
6319 6682 | }
|
6320 6683 | }
|
6321 6684 |
|
6322 6685 | /// When the format is date-time, epoch-seconds timestamps are rejected with a
|
6323 6686 | /// 400 SerializationException
|
6324 6687 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsEpochSeconds_case0
|
6325 6688 | #[::tokio::test]
|
6326 6689 | #[::tracing_test::traced_test]
|
6327 6690 | async fn rest_json_header_timestamp_date_time_rejects_epoch_seconds_case0_malformed_request() {
|
6328 6691 | {
|
6329 6692 | #[allow(unused_mut)]
|
6330 - | let mut http_request = http::Request::builder()
|
6693 + | let mut http_request = ::http_1x::Request::builder()
|
6331 6694 | .uri("/MalformedTimestampHeaderDateTime")
|
6332 6695 | .method("POST")
|
6333 6696 | .header("timestamp", "1515531081.1234")
|
6334 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6697 + | .body(::aws_smithy_http_server::body::boxed(
|
6698 + | ::http_body_util::Empty::new(),
|
6699 + | ))
|
6335 6700 | .unwrap();
|
6336 6701 | #[allow(unused_mut)]
|
6337 6702 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6338 6703 | let config = crate::service::RestJsonConfig::builder().build();
|
6339 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6704 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6340 6705 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6341 6706 | let sender = sender.clone();
|
6342 6707 | async move {
|
6343 6708 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6344 6709 | sender.send(()).await.expect("receiver dropped early");
|
6345 6710 | result
|
6346 6711 | }
|
6347 6712 | })
|
6348 6713 | .build_unchecked();
|
6349 6714 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6350 6715 | .await
|
6351 6716 | .expect("unable to make an HTTP request");
|
6352 6717 | ::pretty_assertions::assert_eq!(
|
6353 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6718 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6354 6719 | http_response.status()
|
6355 6720 | );
|
6356 6721 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6357 6722 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6358 6723 | http_response.headers(),
|
6359 6724 | expected_headers,
|
6360 6725 | ));
|
6361 6726 | }
|
6362 6727 | }
|
6363 6728 |
|
6364 6729 | /// When the format is date-time, epoch-seconds timestamps are rejected with a
|
6365 6730 | /// 400 SerializationException
|
6366 6731 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsEpochSeconds_case1
|
6367 6732 | #[::tokio::test]
|
6368 6733 | #[::tracing_test::traced_test]
|
6369 6734 | async fn rest_json_header_timestamp_date_time_rejects_epoch_seconds_case1_malformed_request() {
|
6370 6735 | {
|
6371 6736 | #[allow(unused_mut)]
|
6372 - | let mut http_request = http::Request::builder()
|
6737 + | let mut http_request = ::http_1x::Request::builder()
|
6373 6738 | .uri("/MalformedTimestampHeaderDateTime")
|
6374 6739 | .method("POST")
|
6375 6740 | .header("timestamp", "1515531081")
|
6376 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6741 + | .body(::aws_smithy_http_server::body::boxed(
|
6742 + | ::http_body_util::Empty::new(),
|
6743 + | ))
|
6377 6744 | .unwrap();
|
6378 6745 | #[allow(unused_mut)]
|
6379 6746 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6380 6747 | let config = crate::service::RestJsonConfig::builder().build();
|
6381 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6748 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6382 6749 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6383 6750 | let sender = sender.clone();
|
6384 6751 | async move {
|
6385 6752 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6386 6753 | sender.send(()).await.expect("receiver dropped early");
|
6387 6754 | result
|
6388 6755 | }
|
6389 6756 | })
|
6390 6757 | .build_unchecked();
|
6391 6758 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6392 6759 | .await
|
6393 6760 | .expect("unable to make an HTTP request");
|
6394 6761 | ::pretty_assertions::assert_eq!(
|
6395 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6762 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6396 6763 | http_response.status()
|
6397 6764 | );
|
6398 6765 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6399 6766 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6400 6767 | http_response.headers(),
|
6401 6768 | expected_headers,
|
6402 6769 | ));
|
6403 6770 | }
|
6404 6771 | }
|
6405 6772 |
|
6406 6773 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
6407 6774 | /// are rejected with a 400 SerializationException
|
6408 6775 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsDifferent8601Formats_case0
|
6409 6776 | #[::tokio::test]
|
6410 6777 | #[::tracing_test::traced_test]
|
6411 6778 | async fn rest_json_header_timestamp_date_time_rejects_different8601_formats_case0_malformed_request(
|
6412 6779 | ) {
|
6413 6780 | {
|
6414 6781 | #[allow(unused_mut)]
|
6415 - | let mut http_request = http::Request::builder()
|
6782 + | let mut http_request = ::http_1x::Request::builder()
|
6416 6783 | .uri("/MalformedTimestampHeaderDateTime")
|
6417 6784 | .method("POST")
|
6418 6785 | .header("timestamp", "1996-12-19T16:39:57+00")
|
6419 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6786 + | .body(::aws_smithy_http_server::body::boxed(
|
6787 + | ::http_body_util::Empty::new(),
|
6788 + | ))
|
6420 6789 | .unwrap();
|
6421 6790 | #[allow(unused_mut)]
|
6422 6791 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6423 6792 | let config = crate::service::RestJsonConfig::builder().build();
|
6424 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6793 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6425 6794 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6426 6795 | let sender = sender.clone();
|
6427 6796 | async move {
|
6428 6797 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6429 6798 | sender.send(()).await.expect("receiver dropped early");
|
6430 6799 | result
|
6431 6800 | }
|
6432 6801 | })
|
6433 6802 | .build_unchecked();
|
6434 6803 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6435 6804 | .await
|
6436 6805 | .expect("unable to make an HTTP request");
|
6437 6806 | ::pretty_assertions::assert_eq!(
|
6438 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6807 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6439 6808 | http_response.status()
|
6440 6809 | );
|
6441 6810 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6442 6811 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6443 6812 | http_response.headers(),
|
6444 6813 | expected_headers,
|
6445 6814 | ));
|
6446 6815 | }
|
6447 6816 | }
|
6448 6817 |
|
6449 6818 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
6450 6819 | /// are rejected with a 400 SerializationException
|
6451 6820 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsDifferent8601Formats_case1
|
6452 6821 | #[::tokio::test]
|
6453 6822 | #[::tracing_test::traced_test]
|
6454 6823 | async fn rest_json_header_timestamp_date_time_rejects_different8601_formats_case1_malformed_request(
|
6455 6824 | ) {
|
6456 6825 | {
|
6457 6826 | #[allow(unused_mut)]
|
6458 - | let mut http_request = http::Request::builder()
|
6827 + | let mut http_request = ::http_1x::Request::builder()
|
6459 6828 | .uri("/MalformedTimestampHeaderDateTime")
|
6460 6829 | .method("POST")
|
6461 6830 | .header("timestamp", "1996-12-19T16:39:57+00Z")
|
6462 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6831 + | .body(::aws_smithy_http_server::body::boxed(
|
6832 + | ::http_body_util::Empty::new(),
|
6833 + | ))
|
6463 6834 | .unwrap();
|
6464 6835 | #[allow(unused_mut)]
|
6465 6836 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6466 6837 | let config = crate::service::RestJsonConfig::builder().build();
|
6467 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6838 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6468 6839 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6469 6840 | let sender = sender.clone();
|
6470 6841 | async move {
|
6471 6842 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6472 6843 | sender.send(()).await.expect("receiver dropped early");
|
6473 6844 | result
|
6474 6845 | }
|
6475 6846 | })
|
6476 6847 | .build_unchecked();
|
6477 6848 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6478 6849 | .await
|
6479 6850 | .expect("unable to make an HTTP request");
|
6480 6851 | ::pretty_assertions::assert_eq!(
|
6481 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6852 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6482 6853 | http_response.status()
|
6483 6854 | );
|
6484 6855 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6485 6856 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6486 6857 | http_response.headers(),
|
6487 6858 | expected_headers,
|
6488 6859 | ));
|
6489 6860 | }
|
6490 6861 | }
|
6491 6862 |
|
6492 6863 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
6493 6864 | /// are rejected with a 400 SerializationException
|
6494 6865 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsDifferent8601Formats_case2
|
6495 6866 | #[::tokio::test]
|
6496 6867 | #[::tracing_test::traced_test]
|
6497 6868 | async fn rest_json_header_timestamp_date_time_rejects_different8601_formats_case2_malformed_request(
|
6498 6869 | ) {
|
6499 6870 | {
|
6500 6871 | #[allow(unused_mut)]
|
6501 - | let mut http_request = http::Request::builder()
|
6872 + | let mut http_request = ::http_1x::Request::builder()
|
6502 6873 | .uri("/MalformedTimestampHeaderDateTime")
|
6503 6874 | .method("POST")
|
6504 6875 | .header("timestamp", "1996-12-19T16:39:57")
|
6505 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6876 + | .body(::aws_smithy_http_server::body::boxed(
|
6877 + | ::http_body_util::Empty::new(),
|
6878 + | ))
|
6506 6879 | .unwrap();
|
6507 6880 | #[allow(unused_mut)]
|
6508 6881 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6509 6882 | let config = crate::service::RestJsonConfig::builder().build();
|
6510 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6883 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6511 6884 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6512 6885 | let sender = sender.clone();
|
6513 6886 | async move {
|
6514 6887 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6515 6888 | sender.send(()).await.expect("receiver dropped early");
|
6516 6889 | result
|
6517 6890 | }
|
6518 6891 | })
|
6519 6892 | .build_unchecked();
|
6520 6893 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6521 6894 | .await
|
6522 6895 | .expect("unable to make an HTTP request");
|
6523 6896 | ::pretty_assertions::assert_eq!(
|
6524 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6897 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6525 6898 | http_response.status()
|
6526 6899 | );
|
6527 6900 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6528 6901 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6529 6902 | http_response.headers(),
|
6530 6903 | expected_headers,
|
6531 6904 | ));
|
6532 6905 | }
|
6533 6906 | }
|
6534 6907 |
|
6535 6908 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
6536 6909 | /// are rejected with a 400 SerializationException
|
6537 6910 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsDifferent8601Formats_case3
|
6538 6911 | #[::tokio::test]
|
6539 6912 | #[::tracing_test::traced_test]
|
6540 6913 | async fn rest_json_header_timestamp_date_time_rejects_different8601_formats_case3_malformed_request(
|
6541 6914 | ) {
|
6542 6915 | {
|
6543 6916 | #[allow(unused_mut)]
|
6544 - | let mut http_request = http::Request::builder()
|
6917 + | let mut http_request = ::http_1x::Request::builder()
|
6545 6918 | .uri("/MalformedTimestampHeaderDateTime")
|
6546 6919 | .method("POST")
|
6547 6920 | .header("timestamp", "1996-12-19T163957")
|
6548 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6921 + | .body(::aws_smithy_http_server::body::boxed(
|
6922 + | ::http_body_util::Empty::new(),
|
6923 + | ))
|
6549 6924 | .unwrap();
|
6550 6925 | #[allow(unused_mut)]
|
6551 6926 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6552 6927 | let config = crate::service::RestJsonConfig::builder().build();
|
6553 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6928 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6554 6929 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6555 6930 | let sender = sender.clone();
|
6556 6931 | async move {
|
6557 6932 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6558 6933 | sender.send(()).await.expect("receiver dropped early");
|
6559 6934 | result
|
6560 6935 | }
|
6561 6936 | })
|
6562 6937 | .build_unchecked();
|
6563 6938 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6564 6939 | .await
|
6565 6940 | .expect("unable to make an HTTP request");
|
6566 6941 | ::pretty_assertions::assert_eq!(
|
6567 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6942 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6568 6943 | http_response.status()
|
6569 6944 | );
|
6570 6945 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6571 6946 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6572 6947 | http_response.headers(),
|
6573 6948 | expected_headers,
|
6574 6949 | ));
|
6575 6950 | }
|
6576 6951 | }
|
6577 6952 |
|
6578 6953 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
6579 6954 | /// are rejected with a 400 SerializationException
|
6580 6955 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsDifferent8601Formats_case4
|
6581 6956 | #[::tokio::test]
|
6582 6957 | #[::tracing_test::traced_test]
|
6583 6958 | async fn rest_json_header_timestamp_date_time_rejects_different8601_formats_case4_malformed_request(
|
6584 6959 | ) {
|
6585 6960 | {
|
6586 6961 | #[allow(unused_mut)]
|
6587 - | let mut http_request = http::Request::builder()
|
6962 + | let mut http_request = ::http_1x::Request::builder()
|
6588 6963 | .uri("/MalformedTimestampHeaderDateTime")
|
6589 6964 | .method("POST")
|
6590 6965 | .header("timestamp", "19961219T163957Z")
|
6591 - | .body(::aws_smithy_http_server::body::Body::empty())
|
6966 + | .body(::aws_smithy_http_server::body::boxed(
|
6967 + | ::http_body_util::Empty::new(),
|
6968 + | ))
|
6592 6969 | .unwrap();
|
6593 6970 | #[allow(unused_mut)]
|
6594 6971 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6595 6972 | let config = crate::service::RestJsonConfig::builder().build();
|
6596 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
6973 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6597 6974 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6598 6975 | let sender = sender.clone();
|
6599 6976 | async move {
|
6600 6977 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6601 6978 | sender.send(()).await.expect("receiver dropped early");
|
6602 6979 | result
|
6603 6980 | }
|
6604 6981 | })
|
6605 6982 | .build_unchecked();
|
6606 6983 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6607 6984 | .await
|
6608 6985 | .expect("unable to make an HTTP request");
|
6609 6986 | ::pretty_assertions::assert_eq!(
|
6610 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6987 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6611 6988 | http_response.status()
|
6612 6989 | );
|
6613 6990 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6614 6991 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6615 6992 | http_response.headers(),
|
6616 6993 | expected_headers,
|
6617 6994 | ));
|
6618 6995 | }
|
6619 6996 | }
|
6620 6997 |
|
6621 6998 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
6622 6999 | /// are rejected with a 400 SerializationException
|
6623 7000 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsDifferent8601Formats_case5
|
6624 7001 | #[::tokio::test]
|
6625 7002 | #[::tracing_test::traced_test]
|
6626 7003 | async fn rest_json_header_timestamp_date_time_rejects_different8601_formats_case5_malformed_request(
|
6627 7004 | ) {
|
6628 7005 | {
|
6629 7006 | #[allow(unused_mut)]
|
6630 - | let mut http_request = http::Request::builder()
|
7007 + | let mut http_request = ::http_1x::Request::builder()
|
6631 7008 | .uri("/MalformedTimestampHeaderDateTime")
|
6632 7009 | .method("POST")
|
6633 7010 | .header("timestamp", "19961219T163957")
|
6634 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7011 + | .body(::aws_smithy_http_server::body::boxed(
|
7012 + | ::http_body_util::Empty::new(),
|
7013 + | ))
|
6635 7014 | .unwrap();
|
6636 7015 | #[allow(unused_mut)]
|
6637 7016 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6638 7017 | let config = crate::service::RestJsonConfig::builder().build();
|
6639 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7018 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6640 7019 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6641 7020 | let sender = sender.clone();
|
6642 7021 | async move {
|
6643 7022 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6644 7023 | sender.send(()).await.expect("receiver dropped early");
|
6645 7024 | result
|
6646 7025 | }
|
6647 7026 | })
|
6648 7027 | .build_unchecked();
|
6649 7028 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6650 7029 | .await
|
6651 7030 | .expect("unable to make an HTTP request");
|
6652 7031 | ::pretty_assertions::assert_eq!(
|
6653 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7032 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6654 7033 | http_response.status()
|
6655 7034 | );
|
6656 7035 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6657 7036 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6658 7037 | http_response.headers(),
|
6659 7038 | expected_headers,
|
6660 7039 | ));
|
6661 7040 | }
|
6662 7041 | }
|
6663 7042 |
|
6664 7043 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
6665 7044 | /// are rejected with a 400 SerializationException
|
6666 7045 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsDifferent8601Formats_case6
|
6667 7046 | #[::tokio::test]
|
6668 7047 | #[::tracing_test::traced_test]
|
6669 7048 | async fn rest_json_header_timestamp_date_time_rejects_different8601_formats_case6_malformed_request(
|
6670 7049 | ) {
|
6671 7050 | {
|
6672 7051 | #[allow(unused_mut)]
|
6673 - | let mut http_request = http::Request::builder()
|
7052 + | let mut http_request = ::http_1x::Request::builder()
|
6674 7053 | .uri("/MalformedTimestampHeaderDateTime")
|
6675 7054 | .method("POST")
|
6676 7055 | .header("timestamp", "19961219T16:39:57Z")
|
6677 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7056 + | .body(::aws_smithy_http_server::body::boxed(
|
7057 + | ::http_body_util::Empty::new(),
|
7058 + | ))
|
6678 7059 | .unwrap();
|
6679 7060 | #[allow(unused_mut)]
|
6680 7061 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6681 7062 | let config = crate::service::RestJsonConfig::builder().build();
|
6682 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7063 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6683 7064 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6684 7065 | let sender = sender.clone();
|
6685 7066 | async move {
|
6686 7067 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6687 7068 | sender.send(()).await.expect("receiver dropped early");
|
6688 7069 | result
|
6689 7070 | }
|
6690 7071 | })
|
6691 7072 | .build_unchecked();
|
6692 7073 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6693 7074 | .await
|
6694 7075 | .expect("unable to make an HTTP request");
|
6695 7076 | ::pretty_assertions::assert_eq!(
|
6696 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7077 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6697 7078 | http_response.status()
|
6698 7079 | );
|
6699 7080 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6700 7081 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6701 7082 | http_response.headers(),
|
6702 7083 | expected_headers,
|
6703 7084 | ));
|
6704 7085 | }
|
6705 7086 | }
|
6706 7087 |
|
6707 7088 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
6708 7089 | /// are rejected with a 400 SerializationException
|
6709 7090 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsDifferent8601Formats_case7
|
6710 7091 | #[::tokio::test]
|
6711 7092 | #[::tracing_test::traced_test]
|
6712 7093 | async fn rest_json_header_timestamp_date_time_rejects_different8601_formats_case7_malformed_request(
|
6713 7094 | ) {
|
6714 7095 | {
|
6715 7096 | #[allow(unused_mut)]
|
6716 - | let mut http_request = http::Request::builder()
|
7097 + | let mut http_request = ::http_1x::Request::builder()
|
6717 7098 | .uri("/MalformedTimestampHeaderDateTime")
|
6718 7099 | .method("POST")
|
6719 7100 | .header("timestamp", "19961219T16:39:57")
|
6720 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7101 + | .body(::aws_smithy_http_server::body::boxed(
|
7102 + | ::http_body_util::Empty::new(),
|
7103 + | ))
|
6721 7104 | .unwrap();
|
6722 7105 | #[allow(unused_mut)]
|
6723 7106 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6724 7107 | let config = crate::service::RestJsonConfig::builder().build();
|
6725 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7108 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6726 7109 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6727 7110 | let sender = sender.clone();
|
6728 7111 | async move {
|
6729 7112 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6730 7113 | sender.send(()).await.expect("receiver dropped early");
|
6731 7114 | result
|
6732 7115 | }
|
6733 7116 | })
|
6734 7117 | .build_unchecked();
|
6735 7118 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6736 7119 | .await
|
6737 7120 | .expect("unable to make an HTTP request");
|
6738 7121 | ::pretty_assertions::assert_eq!(
|
6739 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7122 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6740 7123 | http_response.status()
|
6741 7124 | );
|
6742 7125 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6743 7126 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6744 7127 | http_response.headers(),
|
6745 7128 | expected_headers,
|
6746 7129 | ));
|
6747 7130 | }
|
6748 7131 | }
|
6749 7132 |
|
6750 7133 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
6751 7134 | /// are rejected with a 400 SerializationException
|
6752 7135 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsDifferent8601Formats_case8
|
6753 7136 | #[::tokio::test]
|
6754 7137 | #[::tracing_test::traced_test]
|
6755 7138 | async fn rest_json_header_timestamp_date_time_rejects_different8601_formats_case8_malformed_request(
|
6756 7139 | ) {
|
6757 7140 | {
|
6758 7141 | #[allow(unused_mut)]
|
6759 - | let mut http_request = http::Request::builder()
|
7142 + | let mut http_request = ::http_1x::Request::builder()
|
6760 7143 | .uri("/MalformedTimestampHeaderDateTime")
|
6761 7144 | .method("POST")
|
6762 7145 | .header("timestamp", "1996-12-19T16:39Z")
|
6763 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7146 + | .body(::aws_smithy_http_server::body::boxed(
|
7147 + | ::http_body_util::Empty::new(),
|
7148 + | ))
|
6764 7149 | .unwrap();
|
6765 7150 | #[allow(unused_mut)]
|
6766 7151 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6767 7152 | let config = crate::service::RestJsonConfig::builder().build();
|
6768 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7153 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6769 7154 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6770 7155 | let sender = sender.clone();
|
6771 7156 | async move {
|
6772 7157 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6773 7158 | sender.send(()).await.expect("receiver dropped early");
|
6774 7159 | result
|
6775 7160 | }
|
6776 7161 | })
|
6777 7162 | .build_unchecked();
|
6778 7163 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6779 7164 | .await
|
6780 7165 | .expect("unable to make an HTTP request");
|
6781 7166 | ::pretty_assertions::assert_eq!(
|
6782 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7167 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6783 7168 | http_response.status()
|
6784 7169 | );
|
6785 7170 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6786 7171 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6787 7172 | http_response.headers(),
|
6788 7173 | expected_headers,
|
6789 7174 | ));
|
6790 7175 | }
|
6791 7176 | }
|
6792 7177 |
|
6793 7178 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
6794 7179 | /// are rejected with a 400 SerializationException
|
6795 7180 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsDifferent8601Formats_case9
|
6796 7181 | #[::tokio::test]
|
6797 7182 | #[::tracing_test::traced_test]
|
6798 7183 | async fn rest_json_header_timestamp_date_time_rejects_different8601_formats_case9_malformed_request(
|
6799 7184 | ) {
|
6800 7185 | {
|
6801 7186 | #[allow(unused_mut)]
|
6802 - | let mut http_request = http::Request::builder()
|
7187 + | let mut http_request = ::http_1x::Request::builder()
|
6803 7188 | .uri("/MalformedTimestampHeaderDateTime")
|
6804 7189 | .method("POST")
|
6805 7190 | .header("timestamp", "1996-12-19T16:39")
|
6806 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7191 + | .body(::aws_smithy_http_server::body::boxed(
|
7192 + | ::http_body_util::Empty::new(),
|
7193 + | ))
|
6807 7194 | .unwrap();
|
6808 7195 | #[allow(unused_mut)]
|
6809 7196 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6810 7197 | let config = crate::service::RestJsonConfig::builder().build();
|
6811 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7198 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6812 7199 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6813 7200 | let sender = sender.clone();
|
6814 7201 | async move {
|
6815 7202 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6816 7203 | sender.send(()).await.expect("receiver dropped early");
|
6817 7204 | result
|
6818 7205 | }
|
6819 7206 | })
|
6820 7207 | .build_unchecked();
|
6821 7208 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6822 7209 | .await
|
6823 7210 | .expect("unable to make an HTTP request");
|
6824 7211 | ::pretty_assertions::assert_eq!(
|
6825 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7212 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6826 7213 | http_response.status()
|
6827 7214 | );
|
6828 7215 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6829 7216 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6830 7217 | http_response.headers(),
|
6831 7218 | expected_headers,
|
6832 7219 | ));
|
6833 7220 | }
|
6834 7221 | }
|
6835 7222 |
|
6836 7223 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
6837 7224 | /// are rejected with a 400 SerializationException
|
6838 7225 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsDifferent8601Formats_case10
|
6839 7226 | #[::tokio::test]
|
6840 7227 | #[::tracing_test::traced_test]
|
6841 7228 | async fn rest_json_header_timestamp_date_time_rejects_different8601_formats_case10_malformed_request(
|
6842 7229 | ) {
|
6843 7230 | {
|
6844 7231 | #[allow(unused_mut)]
|
6845 - | let mut http_request = http::Request::builder()
|
7232 + | let mut http_request = ::http_1x::Request::builder()
|
6846 7233 | .uri("/MalformedTimestampHeaderDateTime")
|
6847 7234 | .method("POST")
|
6848 7235 | .header("timestamp", "1996-12-19T1639")
|
6849 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7236 + | .body(::aws_smithy_http_server::body::boxed(
|
7237 + | ::http_body_util::Empty::new(),
|
7238 + | ))
|
6850 7239 | .unwrap();
|
6851 7240 | #[allow(unused_mut)]
|
6852 7241 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6853 7242 | let config = crate::service::RestJsonConfig::builder().build();
|
6854 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7243 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6855 7244 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6856 7245 | let sender = sender.clone();
|
6857 7246 | async move {
|
6858 7247 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6859 7248 | sender.send(()).await.expect("receiver dropped early");
|
6860 7249 | result
|
6861 7250 | }
|
6862 7251 | })
|
6863 7252 | .build_unchecked();
|
6864 7253 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6865 7254 | .await
|
6866 7255 | .expect("unable to make an HTTP request");
|
6867 7256 | ::pretty_assertions::assert_eq!(
|
6868 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7257 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6869 7258 | http_response.status()
|
6870 7259 | );
|
6871 7260 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6872 7261 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6873 7262 | http_response.headers(),
|
6874 7263 | expected_headers,
|
6875 7264 | ));
|
6876 7265 | }
|
6877 7266 | }
|
6878 7267 |
|
6879 7268 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
6880 7269 | /// are rejected with a 400 SerializationException
|
6881 7270 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsDifferent8601Formats_case11
|
6882 7271 | #[::tokio::test]
|
6883 7272 | #[::tracing_test::traced_test]
|
6884 7273 | async fn rest_json_header_timestamp_date_time_rejects_different8601_formats_case11_malformed_request(
|
6885 7274 | ) {
|
6886 7275 | {
|
6887 7276 | #[allow(unused_mut)]
|
6888 - | let mut http_request = http::Request::builder()
|
7277 + | let mut http_request = ::http_1x::Request::builder()
|
6889 7278 | .uri("/MalformedTimestampHeaderDateTime")
|
6890 7279 | .method("POST")
|
6891 7280 | .header("timestamp", "1996-12-19T16Z")
|
6892 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7281 + | .body(::aws_smithy_http_server::body::boxed(
|
7282 + | ::http_body_util::Empty::new(),
|
7283 + | ))
|
6893 7284 | .unwrap();
|
6894 7285 | #[allow(unused_mut)]
|
6895 7286 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6896 7287 | let config = crate::service::RestJsonConfig::builder().build();
|
6897 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7288 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6898 7289 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6899 7290 | let sender = sender.clone();
|
6900 7291 | async move {
|
6901 7292 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6902 7293 | sender.send(()).await.expect("receiver dropped early");
|
6903 7294 | result
|
6904 7295 | }
|
6905 7296 | })
|
6906 7297 | .build_unchecked();
|
6907 7298 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6908 7299 | .await
|
6909 7300 | .expect("unable to make an HTTP request");
|
6910 7301 | ::pretty_assertions::assert_eq!(
|
6911 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7302 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6912 7303 | http_response.status()
|
6913 7304 | );
|
6914 7305 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6915 7306 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6916 7307 | http_response.headers(),
|
6917 7308 | expected_headers,
|
6918 7309 | ));
|
6919 7310 | }
|
6920 7311 | }
|
6921 7312 |
|
6922 7313 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
6923 7314 | /// are rejected with a 400 SerializationException
|
6924 7315 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsDifferent8601Formats_case12
|
6925 7316 | #[::tokio::test]
|
6926 7317 | #[::tracing_test::traced_test]
|
6927 7318 | async fn rest_json_header_timestamp_date_time_rejects_different8601_formats_case12_malformed_request(
|
6928 7319 | ) {
|
6929 7320 | {
|
6930 7321 | #[allow(unused_mut)]
|
6931 - | let mut http_request = http::Request::builder()
|
7322 + | let mut http_request = ::http_1x::Request::builder()
|
6932 7323 | .uri("/MalformedTimestampHeaderDateTime")
|
6933 7324 | .method("POST")
|
6934 7325 | .header("timestamp", "1996-12-19T16")
|
6935 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7326 + | .body(::aws_smithy_http_server::body::boxed(
|
7327 + | ::http_body_util::Empty::new(),
|
7328 + | ))
|
6936 7329 | .unwrap();
|
6937 7330 | #[allow(unused_mut)]
|
6938 7331 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6939 7332 | let config = crate::service::RestJsonConfig::builder().build();
|
6940 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7333 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6941 7334 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6942 7335 | let sender = sender.clone();
|
6943 7336 | async move {
|
6944 7337 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6945 7338 | sender.send(()).await.expect("receiver dropped early");
|
6946 7339 | result
|
6947 7340 | }
|
6948 7341 | })
|
6949 7342 | .build_unchecked();
|
6950 7343 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6951 7344 | .await
|
6952 7345 | .expect("unable to make an HTTP request");
|
6953 7346 | ::pretty_assertions::assert_eq!(
|
6954 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7347 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6955 7348 | http_response.status()
|
6956 7349 | );
|
6957 7350 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
6958 7351 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
6959 7352 | http_response.headers(),
|
6960 7353 | expected_headers,
|
6961 7354 | ));
|
6962 7355 | }
|
6963 7356 | }
|
6964 7357 |
|
6965 7358 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
6966 7359 | /// are rejected with a 400 SerializationException
|
6967 7360 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsDifferent8601Formats_case13
|
6968 7361 | #[::tokio::test]
|
6969 7362 | #[::tracing_test::traced_test]
|
6970 7363 | async fn rest_json_header_timestamp_date_time_rejects_different8601_formats_case13_malformed_request(
|
6971 7364 | ) {
|
6972 7365 | {
|
6973 7366 | #[allow(unused_mut)]
|
6974 - | let mut http_request = http::Request::builder()
|
7367 + | let mut http_request = ::http_1x::Request::builder()
|
6975 7368 | .uri("/MalformedTimestampHeaderDateTime")
|
6976 7369 | .method("POST")
|
6977 7370 | .header("timestamp", "1996-12-19 16:39:57Z")
|
6978 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7371 + | .body(::aws_smithy_http_server::body::boxed(
|
7372 + | ::http_body_util::Empty::new(),
|
7373 + | ))
|
6979 7374 | .unwrap();
|
6980 7375 | #[allow(unused_mut)]
|
6981 7376 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
6982 7377 | let config = crate::service::RestJsonConfig::builder().build();
|
6983 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7378 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
6984 7379 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
6985 7380 | let sender = sender.clone();
|
6986 7381 | async move {
|
6987 7382 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
6988 7383 | sender.send(()).await.expect("receiver dropped early");
|
6989 7384 | result
|
6990 7385 | }
|
6991 7386 | })
|
6992 7387 | .build_unchecked();
|
6993 7388 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
6994 7389 | .await
|
6995 7390 | .expect("unable to make an HTTP request");
|
6996 7391 | ::pretty_assertions::assert_eq!(
|
6997 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7392 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
6998 7393 | http_response.status()
|
6999 7394 | );
|
7000 7395 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7001 7396 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7002 7397 | http_response.headers(),
|
7003 7398 | expected_headers,
|
7004 7399 | ));
|
7005 7400 | }
|
7006 7401 | }
|
7007 7402 |
|
7008 7403 | /// When the format is date-time, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
7009 7404 | /// are rejected with a 400 SerializationException
|
7010 7405 | /// Test ID: RestJsonHeaderTimestampDateTimeRejectsDifferent8601Formats_case14
|
7011 7406 | #[::tokio::test]
|
7012 7407 | #[::tracing_test::traced_test]
|
7013 7408 | async fn rest_json_header_timestamp_date_time_rejects_different8601_formats_case14_malformed_request(
|
7014 7409 | ) {
|
7015 7410 | {
|
7016 7411 | #[allow(unused_mut)]
|
7017 - | let mut http_request = http::Request::builder()
|
7412 + | let mut http_request = ::http_1x::Request::builder()
|
7018 7413 | .uri("/MalformedTimestampHeaderDateTime")
|
7019 7414 | .method("POST")
|
7020 7415 | .header("timestamp", "2011-12-03T10:15:30+01:00[Europe/Paris]")
|
7021 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7416 + | .body(::aws_smithy_http_server::body::boxed(
|
7417 + | ::http_body_util::Empty::new(),
|
7418 + | ))
|
7022 7419 | .unwrap();
|
7023 7420 | #[allow(unused_mut)]
|
7024 7421 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7025 7422 | let config = crate::service::RestJsonConfig::builder().build();
|
7026 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7423 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7027 7424 | .malformed_timestamp_header_date_time(move |input: crate::input::MalformedTimestampHeaderDateTimeInput| {
|
7028 7425 | let sender = sender.clone();
|
7029 7426 | async move {
|
7030 7427 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDateTimeOutput, crate::error::MalformedTimestampHeaderDateTimeError> };
|
7031 7428 | sender.send(()).await.expect("receiver dropped early");
|
7032 7429 | result
|
7033 7430 | }
|
7034 7431 | })
|
7035 7432 | .build_unchecked();
|
7036 7433 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7037 7434 | .await
|
7038 7435 | .expect("unable to make an HTTP request");
|
7039 7436 | ::pretty_assertions::assert_eq!(
|
7040 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7437 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7041 7438 | http_response.status()
|
7042 7439 | );
|
7043 7440 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7044 7441 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7045 7442 | http_response.headers(),
|
7046 7443 | expected_headers,
|
7047 7444 | ));
|
7048 7445 | }
|
7049 7446 | }
|
7447 + |
|
7448 + | /* ProtocolTestGenerator.kt:98 */
|
7050 7449 | }
|
7051 7450 |
|
7451 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
7052 7452 | ::pin_project_lite::pin_project! {
|
7053 7453 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
7054 7454 | /// [`MalformedTimestampHeaderDefaultInput`](crate::input::MalformedTimestampHeaderDefaultInput) using modelled bindings.
|
7055 7455 | pub struct MalformedTimestampHeaderDefaultInputFuture {
|
7056 7456 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedTimestampHeaderDefaultInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
7057 7457 | }
|
7058 7458 | }
|
7059 7459 |
|
7060 7460 | impl std::future::Future for MalformedTimestampHeaderDefaultInputFuture {
|
7061 7461 | type Output = Result<
|
7062 7462 | crate::input::MalformedTimestampHeaderDefaultInput,
|
7063 7463 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
7064 7464 | >;
|
7065 7465 |
|
7066 7466 | fn poll(
|
7067 7467 | self: std::pin::Pin<&mut Self>,
|
7068 7468 | cx: &mut std::task::Context<'_>,
|
7069 7469 | ) -> std::task::Poll<Self::Output> {
|
7070 7470 | let this = self.project();
|
7071 7471 | this.inner.as_mut().poll(cx)
|
7072 7472 | }
|
7073 7473 | }
|
7074 7474 |
|
7075 7475 | impl<B>
|
7076 7476 | ::aws_smithy_http_server::request::FromRequest<
|
7077 7477 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7078 7478 | B,
|
7079 7479 | > for crate::input::MalformedTimestampHeaderDefaultInput
|
7080 7480 | where
|
7081 7481 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
7082 7482 | B: 'static,
|
7083 7483 |
|
7084 7484 | B::Data: Send,
|
7085 7485 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
7086 7486 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
7087 7487 | {
|
7088 7488 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
7089 7489 | type Future = MalformedTimestampHeaderDefaultInputFuture;
|
7090 7490 |
|
7091 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
7491 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
7092 7492 | let fut = async move {
|
7093 7493 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
7094 7494 | request.headers(),
|
7095 7495 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
7096 7496 | ) {
|
7097 7497 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
7098 7498 | }
|
7099 7499 | crate::protocol_serde::shape_malformed_timestamp_header_default::de_malformed_timestamp_header_default_http_request(request)
|
7100 7500 | .await
|
7101 7501 | };
|
7102 7502 | use ::futures_util::future::TryFutureExt;
|
7103 7503 | let fut = fut.map_err(
|
7104 7504 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
7105 7505 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
7106 7506 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
7107 7507 | e,
|
7108 7508 | )
|
7109 7509 | },
|
7110 7510 | );
|
7111 7511 | MalformedTimestampHeaderDefaultInputFuture {
|
7112 7512 | inner: Box::pin(fut),
|
7113 7513 | }
|
7114 7514 | }
|
7115 7515 | }
|
7516 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
7116 7517 | impl
|
7117 7518 | ::aws_smithy_http_server::response::IntoResponse<
|
7118 7519 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7119 7520 | > for crate::output::MalformedTimestampHeaderDefaultOutput
|
7120 7521 | {
|
7121 7522 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
7122 7523 | match crate::protocol_serde::shape_malformed_timestamp_header_default::ser_malformed_timestamp_header_default_http_response(self) {
|
7123 7524 | Ok(response) => response,
|
7124 7525 | Err(e) => {
|
7125 7526 | ::tracing::error!(error = %e, "failed to serialize response");
|
7126 7527 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7127 7528 | }
|
7128 7529 | }
|
7129 7530 | }
|
7130 7531 | }
|
7532 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
7131 7533 | impl
|
7132 7534 | ::aws_smithy_http_server::response::IntoResponse<
|
7133 7535 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7134 7536 | > for crate::error::MalformedTimestampHeaderDefaultError
|
7135 7537 | {
|
7136 7538 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
7137 7539 | match crate::protocol_serde::shape_malformed_timestamp_header_default::ser_malformed_timestamp_header_default_http_error(&self) {
|
7138 7540 | Ok(mut response) => {
|
7139 7541 | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
7140 7542 | response
|
7141 7543 | },
|
7142 7544 | Err(e) => {
|
7143 7545 | ::tracing::error!(error = %e, "failed to serialize response");
|
7144 7546 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7145 7547 | }
|
7146 7548 | }
|
7147 7549 | }
|
7148 7550 | }
|
7149 7551 |
|
7552 + | /* RustType.kt:534 */
|
7150 7553 | #[allow(unreachable_code, unused_variables)]
|
7554 + | /* RustType.kt:534 */
|
7151 7555 | #[cfg(test)]
|
7556 + | /* ProtocolTestGenerator.kt:98 */
|
7152 7557 | mod malformed_timestamp_header_default_test {
|
7153 7558 |
|
7154 7559 | /// By default, RFC3339 timestamps are rejected with a
|
7155 7560 | /// 400 SerializationException
|
7156 7561 | /// Test ID: RestJsonHeaderTimestampDefaultRejectsDateTime_case0
|
7157 7562 | #[::tokio::test]
|
7158 7563 | #[::tracing_test::traced_test]
|
7159 7564 | async fn rest_json_header_timestamp_default_rejects_date_time_case0_malformed_request() {
|
7160 7565 | {
|
7161 7566 | #[allow(unused_mut)]
|
7162 - | let mut http_request = http::Request::builder()
|
7567 + | let mut http_request = ::http_1x::Request::builder()
|
7163 7568 | .uri("/MalformedTimestampHeaderDefault")
|
7164 7569 | .method("POST")
|
7165 7570 | .header("timestamp", "1985-04-12T23:20:50.52Z")
|
7166 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7571 + | .body(::aws_smithy_http_server::body::boxed(
|
7572 + | ::http_body_util::Empty::new(),
|
7573 + | ))
|
7167 7574 | .unwrap();
|
7168 7575 | #[allow(unused_mut)]
|
7169 7576 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7170 7577 | let config = crate::service::RestJsonConfig::builder().build();
|
7171 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7578 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7172 7579 | .malformed_timestamp_header_default(move |input: crate::input::MalformedTimestampHeaderDefaultInput| {
|
7173 7580 | let sender = sender.clone();
|
7174 7581 | async move {
|
7175 7582 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDefaultOutput, crate::error::MalformedTimestampHeaderDefaultError> };
|
7176 7583 | sender.send(()).await.expect("receiver dropped early");
|
7177 7584 | result
|
7178 7585 | }
|
7179 7586 | })
|
7180 7587 | .build_unchecked();
|
7181 7588 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7182 7589 | .await
|
7183 7590 | .expect("unable to make an HTTP request");
|
7184 7591 | ::pretty_assertions::assert_eq!(
|
7185 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7592 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7186 7593 | http_response.status()
|
7187 7594 | );
|
7188 7595 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7189 7596 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7190 7597 | http_response.headers(),
|
7191 7598 | expected_headers,
|
7192 7599 | ));
|
7193 7600 | }
|
7194 7601 | }
|
7195 7602 |
|
7196 7603 | /// By default, RFC3339 timestamps are rejected with a
|
7197 7604 | /// 400 SerializationException
|
7198 7605 | /// Test ID: RestJsonHeaderTimestampDefaultRejectsDateTime_case1
|
7199 7606 | #[::tokio::test]
|
7200 7607 | #[::tracing_test::traced_test]
|
7201 7608 | async fn rest_json_header_timestamp_default_rejects_date_time_case1_malformed_request() {
|
7202 7609 | {
|
7203 7610 | #[allow(unused_mut)]
|
7204 - | let mut http_request = http::Request::builder()
|
7611 + | let mut http_request = ::http_1x::Request::builder()
|
7205 7612 | .uri("/MalformedTimestampHeaderDefault")
|
7206 7613 | .method("POST")
|
7207 7614 | .header("timestamp", "1985-04-12T23:20:50Z")
|
7208 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7615 + | .body(::aws_smithy_http_server::body::boxed(
|
7616 + | ::http_body_util::Empty::new(),
|
7617 + | ))
|
7209 7618 | .unwrap();
|
7210 7619 | #[allow(unused_mut)]
|
7211 7620 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7212 7621 | let config = crate::service::RestJsonConfig::builder().build();
|
7213 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7622 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7214 7623 | .malformed_timestamp_header_default(move |input: crate::input::MalformedTimestampHeaderDefaultInput| {
|
7215 7624 | let sender = sender.clone();
|
7216 7625 | async move {
|
7217 7626 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDefaultOutput, crate::error::MalformedTimestampHeaderDefaultError> };
|
7218 7627 | sender.send(()).await.expect("receiver dropped early");
|
7219 7628 | result
|
7220 7629 | }
|
7221 7630 | })
|
7222 7631 | .build_unchecked();
|
7223 7632 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7224 7633 | .await
|
7225 7634 | .expect("unable to make an HTTP request");
|
7226 7635 | ::pretty_assertions::assert_eq!(
|
7227 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7636 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7228 7637 | http_response.status()
|
7229 7638 | );
|
7230 7639 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7231 7640 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7232 7641 | http_response.headers(),
|
7233 7642 | expected_headers,
|
7234 7643 | ));
|
7235 7644 | }
|
7236 7645 | }
|
7237 7646 |
|
7238 7647 | /// By default, RFC3339 timestamps are rejected with a
|
7239 7648 | /// 400 SerializationException
|
7240 7649 | /// Test ID: RestJsonHeaderTimestampDefaultRejectsDateTime_case2
|
7241 7650 | #[::tokio::test]
|
7242 7651 | #[::tracing_test::traced_test]
|
7243 7652 | async fn rest_json_header_timestamp_default_rejects_date_time_case2_malformed_request() {
|
7244 7653 | {
|
7245 7654 | #[allow(unused_mut)]
|
7246 - | let mut http_request = http::Request::builder()
|
7655 + | let mut http_request = ::http_1x::Request::builder()
|
7247 7656 | .uri("/MalformedTimestampHeaderDefault")
|
7248 7657 | .method("POST")
|
7249 7658 | .header("timestamp", "1996-12-19T16:39:57-08:00")
|
7250 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7659 + | .body(::aws_smithy_http_server::body::boxed(
|
7660 + | ::http_body_util::Empty::new(),
|
7661 + | ))
|
7251 7662 | .unwrap();
|
7252 7663 | #[allow(unused_mut)]
|
7253 7664 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7254 7665 | let config = crate::service::RestJsonConfig::builder().build();
|
7255 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7666 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7256 7667 | .malformed_timestamp_header_default(move |input: crate::input::MalformedTimestampHeaderDefaultInput| {
|
7257 7668 | let sender = sender.clone();
|
7258 7669 | async move {
|
7259 7670 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDefaultOutput, crate::error::MalformedTimestampHeaderDefaultError> };
|
7260 7671 | sender.send(()).await.expect("receiver dropped early");
|
7261 7672 | result
|
7262 7673 | }
|
7263 7674 | })
|
7264 7675 | .build_unchecked();
|
7265 7676 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7266 7677 | .await
|
7267 7678 | .expect("unable to make an HTTP request");
|
7268 7679 | ::pretty_assertions::assert_eq!(
|
7269 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7680 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7270 7681 | http_response.status()
|
7271 7682 | );
|
7272 7683 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7273 7684 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7274 7685 | http_response.headers(),
|
7275 7686 | expected_headers,
|
7276 7687 | ));
|
7277 7688 | }
|
7278 7689 | }
|
7279 7690 |
|
7280 7691 | /// By default, epoch second timestamps are rejected with a
|
7281 7692 | /// 400 SerializationException
|
7282 7693 | /// Test ID: RestJsonHeaderTimestampDefaultRejectsEpochSeconds_case0
|
7283 7694 | #[::tokio::test]
|
7284 7695 | #[::tracing_test::traced_test]
|
7285 7696 | async fn rest_json_header_timestamp_default_rejects_epoch_seconds_case0_malformed_request() {
|
7286 7697 | {
|
7287 7698 | #[allow(unused_mut)]
|
7288 - | let mut http_request = http::Request::builder()
|
7699 + | let mut http_request = ::http_1x::Request::builder()
|
7289 7700 | .uri("/MalformedTimestampHeaderDefault")
|
7290 7701 | .method("POST")
|
7291 7702 | .header("timestamp", "1515531081.1234")
|
7292 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7703 + | .body(::aws_smithy_http_server::body::boxed(
|
7704 + | ::http_body_util::Empty::new(),
|
7705 + | ))
|
7293 7706 | .unwrap();
|
7294 7707 | #[allow(unused_mut)]
|
7295 7708 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7296 7709 | let config = crate::service::RestJsonConfig::builder().build();
|
7297 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7710 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7298 7711 | .malformed_timestamp_header_default(move |input: crate::input::MalformedTimestampHeaderDefaultInput| {
|
7299 7712 | let sender = sender.clone();
|
7300 7713 | async move {
|
7301 7714 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDefaultOutput, crate::error::MalformedTimestampHeaderDefaultError> };
|
7302 7715 | sender.send(()).await.expect("receiver dropped early");
|
7303 7716 | result
|
7304 7717 | }
|
7305 7718 | })
|
7306 7719 | .build_unchecked();
|
7307 7720 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7308 7721 | .await
|
7309 7722 | .expect("unable to make an HTTP request");
|
7310 7723 | ::pretty_assertions::assert_eq!(
|
7311 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7724 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7312 7725 | http_response.status()
|
7313 7726 | );
|
7314 7727 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7315 7728 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7316 7729 | http_response.headers(),
|
7317 7730 | expected_headers,
|
7318 7731 | ));
|
7319 7732 | }
|
7320 7733 | }
|
7321 7734 |
|
7322 7735 | /// By default, epoch second timestamps are rejected with a
|
7323 7736 | /// 400 SerializationException
|
7324 7737 | /// Test ID: RestJsonHeaderTimestampDefaultRejectsEpochSeconds_case1
|
7325 7738 | #[::tokio::test]
|
7326 7739 | #[::tracing_test::traced_test]
|
7327 7740 | async fn rest_json_header_timestamp_default_rejects_epoch_seconds_case1_malformed_request() {
|
7328 7741 | {
|
7329 7742 | #[allow(unused_mut)]
|
7330 - | let mut http_request = http::Request::builder()
|
7743 + | let mut http_request = ::http_1x::Request::builder()
|
7331 7744 | .uri("/MalformedTimestampHeaderDefault")
|
7332 7745 | .method("POST")
|
7333 7746 | .header("timestamp", "1515531081")
|
7334 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7747 + | .body(::aws_smithy_http_server::body::boxed(
|
7748 + | ::http_body_util::Empty::new(),
|
7749 + | ))
|
7335 7750 | .unwrap();
|
7336 7751 | #[allow(unused_mut)]
|
7337 7752 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7338 7753 | let config = crate::service::RestJsonConfig::builder().build();
|
7339 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7754 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7340 7755 | .malformed_timestamp_header_default(move |input: crate::input::MalformedTimestampHeaderDefaultInput| {
|
7341 7756 | let sender = sender.clone();
|
7342 7757 | async move {
|
7343 7758 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampHeaderDefaultOutput, crate::error::MalformedTimestampHeaderDefaultError> };
|
7344 7759 | sender.send(()).await.expect("receiver dropped early");
|
7345 7760 | result
|
7346 7761 | }
|
7347 7762 | })
|
7348 7763 | .build_unchecked();
|
7349 7764 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7350 7765 | .await
|
7351 7766 | .expect("unable to make an HTTP request");
|
7352 7767 | ::pretty_assertions::assert_eq!(
|
7353 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7768 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7354 7769 | http_response.status()
|
7355 7770 | );
|
7356 7771 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7357 7772 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7358 7773 | http_response.headers(),
|
7359 7774 | expected_headers,
|
7360 7775 | ));
|
7361 7776 | }
|
7362 7777 | }
|
7778 + |
|
7779 + | /* ProtocolTestGenerator.kt:98 */
|
7363 7780 | }
|
7364 7781 |
|
7782 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
7365 7783 | ::pin_project_lite::pin_project! {
|
7366 7784 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
7367 7785 | /// [`MalformedTimestampQueryEpochInput`](crate::input::MalformedTimestampQueryEpochInput) using modelled bindings.
|
7368 7786 | pub struct MalformedTimestampQueryEpochInputFuture {
|
7369 7787 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedTimestampQueryEpochInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
7370 7788 | }
|
7371 7789 | }
|
7372 7790 |
|
7373 7791 | impl std::future::Future for MalformedTimestampQueryEpochInputFuture {
|
7374 7792 | type Output = Result<
|
7375 7793 | crate::input::MalformedTimestampQueryEpochInput,
|
7376 7794 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
7377 7795 | >;
|
7378 7796 |
|
7379 7797 | fn poll(
|
7380 7798 | self: std::pin::Pin<&mut Self>,
|
7381 7799 | cx: &mut std::task::Context<'_>,
|
7382 7800 | ) -> std::task::Poll<Self::Output> {
|
7383 7801 | let this = self.project();
|
7384 7802 | this.inner.as_mut().poll(cx)
|
7385 7803 | }
|
7386 7804 | }
|
7387 7805 |
|
7388 7806 | impl<B>
|
7389 7807 | ::aws_smithy_http_server::request::FromRequest<
|
7390 7808 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7391 7809 | B,
|
7392 7810 | > for crate::input::MalformedTimestampQueryEpochInput
|
7393 7811 | where
|
7394 7812 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
7395 7813 | B: 'static,
|
7396 7814 |
|
7397 7815 | B::Data: Send,
|
7398 7816 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
7399 7817 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
7400 7818 | {
|
7401 7819 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
7402 7820 | type Future = MalformedTimestampQueryEpochInputFuture;
|
7403 7821 |
|
7404 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
7822 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
7405 7823 | let fut = async move {
|
7406 7824 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
7407 7825 | request.headers(),
|
7408 7826 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
7409 7827 | ) {
|
7410 7828 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
7411 7829 | }
|
7412 7830 | crate::protocol_serde::shape_malformed_timestamp_query_epoch::de_malformed_timestamp_query_epoch_http_request(request)
|
7413 7831 | .await
|
7414 7832 | };
|
7415 7833 | use ::futures_util::future::TryFutureExt;
|
7416 7834 | let fut = fut.map_err(
|
7417 7835 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
7418 7836 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
7419 7837 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
7420 7838 | e,
|
7421 7839 | )
|
7422 7840 | },
|
7423 7841 | );
|
7424 7842 | MalformedTimestampQueryEpochInputFuture {
|
7425 7843 | inner: Box::pin(fut),
|
7426 7844 | }
|
7427 7845 | }
|
7428 7846 | }
|
7847 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
7429 7848 | impl
|
7430 7849 | ::aws_smithy_http_server::response::IntoResponse<
|
7431 7850 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7432 7851 | > for crate::output::MalformedTimestampQueryEpochOutput
|
7433 7852 | {
|
7434 7853 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
7435 7854 | match crate::protocol_serde::shape_malformed_timestamp_query_epoch::ser_malformed_timestamp_query_epoch_http_response(self) {
|
7436 7855 | Ok(response) => response,
|
7437 7856 | Err(e) => {
|
7438 7857 | ::tracing::error!(error = %e, "failed to serialize response");
|
7439 7858 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7440 7859 | }
|
7441 7860 | }
|
7442 7861 | }
|
7443 7862 | }
|
7863 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
7444 7864 | impl
|
7445 7865 | ::aws_smithy_http_server::response::IntoResponse<
|
7446 7866 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
7447 7867 | > for crate::error::MalformedTimestampQueryEpochError
|
7448 7868 | {
|
7449 7869 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
7450 7870 | match crate::protocol_serde::shape_malformed_timestamp_query_epoch::ser_malformed_timestamp_query_epoch_http_error(&self) {
|
7451 7871 | Ok(mut response) => {
|
7452 7872 | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
7453 7873 | response
|
7454 7874 | },
|
7455 7875 | Err(e) => {
|
7456 7876 | ::tracing::error!(error = %e, "failed to serialize response");
|
7457 7877 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
7458 7878 | }
|
7459 7879 | }
|
7460 7880 | }
|
7461 7881 | }
|
7462 7882 |
|
7883 + | /* RustType.kt:534 */
|
7463 7884 | #[allow(unreachable_code, unused_variables)]
|
7885 + | /* RustType.kt:534 */
|
7464 7886 | #[cfg(test)]
|
7887 + | /* ProtocolTestGenerator.kt:98 */
|
7465 7888 | mod malformed_timestamp_query_epoch_test {
|
7466 7889 |
|
7467 7890 | /// When the format is epoch-seconds, RFC3339 timestamps are rejected with a
|
7468 7891 | /// 400 SerializationException
|
7469 7892 | /// Test ID: RestJsonQueryTimestampEpochRejectsDateTime_case0
|
7470 7893 | #[::tokio::test]
|
7471 7894 | #[::tracing_test::traced_test]
|
7472 7895 | async fn rest_json_query_timestamp_epoch_rejects_date_time_case0_malformed_request() {
|
7473 7896 | {
|
7474 7897 | #[allow(unused_mut)]
|
7475 - | let mut http_request = http::Request::builder()
|
7898 + | let mut http_request = ::http_1x::Request::builder()
|
7476 7899 | .uri("/MalformedTimestampQueryEpoch")
|
7477 7900 | .method("POST")
|
7478 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7901 + | .body(::aws_smithy_http_server::body::boxed(
|
7902 + | ::http_body_util::Empty::new(),
|
7903 + | ))
|
7479 7904 | .unwrap();
|
7480 7905 | *http_request.uri_mut() =
|
7481 7906 | "/MalformedTimestampQueryEpoch?timestamp=1985-04-12T23%3A20%3A50.52Z"
|
7482 7907 | .parse()
|
7483 7908 | .unwrap();
|
7484 7909 | #[allow(unused_mut)]
|
7485 7910 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7486 7911 | let config = crate::service::RestJsonConfig::builder().build();
|
7487 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7912 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7488 7913 | .malformed_timestamp_query_epoch(move |input: crate::input::MalformedTimestampQueryEpochInput| {
|
7489 7914 | let sender = sender.clone();
|
7490 7915 | async move {
|
7491 7916 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryEpochOutput, crate::error::MalformedTimestampQueryEpochError> };
|
7492 7917 | sender.send(()).await.expect("receiver dropped early");
|
7493 7918 | result
|
7494 7919 | }
|
7495 7920 | })
|
7496 7921 | .build_unchecked();
|
7497 7922 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7498 7923 | .await
|
7499 7924 | .expect("unable to make an HTTP request");
|
7500 7925 | ::pretty_assertions::assert_eq!(
|
7501 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7926 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7502 7927 | http_response.status()
|
7503 7928 | );
|
7504 7929 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7505 7930 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7506 7931 | http_response.headers(),
|
7507 7932 | expected_headers,
|
7508 7933 | ));
|
7509 7934 | }
|
7510 7935 | }
|
7511 7936 |
|
7512 7937 | /// When the format is epoch-seconds, RFC3339 timestamps are rejected with a
|
7513 7938 | /// 400 SerializationException
|
7514 7939 | /// Test ID: RestJsonQueryTimestampEpochRejectsDateTime_case1
|
7515 7940 | #[::tokio::test]
|
7516 7941 | #[::tracing_test::traced_test]
|
7517 7942 | async fn rest_json_query_timestamp_epoch_rejects_date_time_case1_malformed_request() {
|
7518 7943 | {
|
7519 7944 | #[allow(unused_mut)]
|
7520 - | let mut http_request = http::Request::builder()
|
7945 + | let mut http_request = ::http_1x::Request::builder()
|
7521 7946 | .uri("/MalformedTimestampQueryEpoch")
|
7522 7947 | .method("POST")
|
7523 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7948 + | .body(::aws_smithy_http_server::body::boxed(
|
7949 + | ::http_body_util::Empty::new(),
|
7950 + | ))
|
7524 7951 | .unwrap();
|
7525 7952 | *http_request.uri_mut() =
|
7526 7953 | "/MalformedTimestampQueryEpoch?timestamp=1985-04-12T23%3A20%3A50Z"
|
7527 7954 | .parse()
|
7528 7955 | .unwrap();
|
7529 7956 | #[allow(unused_mut)]
|
7530 7957 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7531 7958 | let config = crate::service::RestJsonConfig::builder().build();
|
7532 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
7959 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7533 7960 | .malformed_timestamp_query_epoch(move |input: crate::input::MalformedTimestampQueryEpochInput| {
|
7534 7961 | let sender = sender.clone();
|
7535 7962 | async move {
|
7536 7963 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryEpochOutput, crate::error::MalformedTimestampQueryEpochError> };
|
7537 7964 | sender.send(()).await.expect("receiver dropped early");
|
7538 7965 | result
|
7539 7966 | }
|
7540 7967 | })
|
7541 7968 | .build_unchecked();
|
7542 7969 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7543 7970 | .await
|
7544 7971 | .expect("unable to make an HTTP request");
|
7545 7972 | ::pretty_assertions::assert_eq!(
|
7546 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7973 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7547 7974 | http_response.status()
|
7548 7975 | );
|
7549 7976 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7550 7977 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7551 7978 | http_response.headers(),
|
7552 7979 | expected_headers,
|
7553 7980 | ));
|
7554 7981 | }
|
7555 7982 | }
|
7556 7983 |
|
7557 7984 | /// When the format is epoch-seconds, RFC3339 timestamps are rejected with a
|
7558 7985 | /// 400 SerializationException
|
7559 7986 | /// Test ID: RestJsonQueryTimestampEpochRejectsDateTime_case2
|
7560 7987 | #[::tokio::test]
|
7561 7988 | #[::tracing_test::traced_test]
|
7562 7989 | async fn rest_json_query_timestamp_epoch_rejects_date_time_case2_malformed_request() {
|
7563 7990 | {
|
7564 7991 | #[allow(unused_mut)]
|
7565 - | let mut http_request = http::Request::builder()
|
7992 + | let mut http_request = ::http_1x::Request::builder()
|
7566 7993 | .uri("/MalformedTimestampQueryEpoch")
|
7567 7994 | .method("POST")
|
7568 - | .body(::aws_smithy_http_server::body::Body::empty())
|
7995 + | .body(::aws_smithy_http_server::body::boxed(
|
7996 + | ::http_body_util::Empty::new(),
|
7997 + | ))
|
7569 7998 | .unwrap();
|
7570 7999 | *http_request.uri_mut() =
|
7571 8000 | "/MalformedTimestampQueryEpoch?timestamp=1996-12-19T16%3A39%3A57-08%3A00"
|
7572 8001 | .parse()
|
7573 8002 | .unwrap();
|
7574 8003 | #[allow(unused_mut)]
|
7575 8004 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7576 8005 | let config = crate::service::RestJsonConfig::builder().build();
|
7577 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8006 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7578 8007 | .malformed_timestamp_query_epoch(move |input: crate::input::MalformedTimestampQueryEpochInput| {
|
7579 8008 | let sender = sender.clone();
|
7580 8009 | async move {
|
7581 8010 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryEpochOutput, crate::error::MalformedTimestampQueryEpochError> };
|
7582 8011 | sender.send(()).await.expect("receiver dropped early");
|
7583 8012 | result
|
7584 8013 | }
|
7585 8014 | })
|
7586 8015 | .build_unchecked();
|
7587 8016 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7588 8017 | .await
|
7589 8018 | .expect("unable to make an HTTP request");
|
7590 8019 | ::pretty_assertions::assert_eq!(
|
7591 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8020 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7592 8021 | http_response.status()
|
7593 8022 | );
|
7594 8023 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7595 8024 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7596 8025 | http_response.headers(),
|
7597 8026 | expected_headers,
|
7598 8027 | ));
|
7599 8028 | }
|
7600 8029 | }
|
7601 8030 |
|
7602 8031 | /// When the format is epoch-seconds, IMF-fixdate timestamps are rejected with a
|
7603 8032 | /// 400 SerializationException
|
7604 8033 | /// Test ID: RestJsonQueryTimestampEpochRejectsHttpDate_case0
|
7605 8034 | #[::tokio::test]
|
7606 8035 | #[::tracing_test::traced_test]
|
7607 8036 | async fn rest_json_query_timestamp_epoch_rejects_http_date_case0_malformed_request() {
|
7608 8037 | {
|
7609 8038 | #[allow(unused_mut)]
|
7610 - | let mut http_request = http::Request::builder()
|
8039 + | let mut http_request = ::http_1x::Request::builder()
|
7611 8040 | .uri("/MalformedTimestampQueryEpoch")
|
7612 8041 | .method("POST")
|
7613 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8042 + | .body(::aws_smithy_http_server::body::boxed(
|
8043 + | ::http_body_util::Empty::new(),
|
8044 + | ))
|
7614 8045 | .unwrap();
|
7615 8046 | *http_request.uri_mut() = "/MalformedTimestampQueryEpoch?timestamp=Tue%2C%2029%20Apr%202014%2018%3A30%3A38%20GMT".parse().unwrap();
|
7616 8047 | #[allow(unused_mut)]
|
7617 8048 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7618 8049 | let config = crate::service::RestJsonConfig::builder().build();
|
7619 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8050 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7620 8051 | .malformed_timestamp_query_epoch(move |input: crate::input::MalformedTimestampQueryEpochInput| {
|
7621 8052 | let sender = sender.clone();
|
7622 8053 | async move {
|
7623 8054 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryEpochOutput, crate::error::MalformedTimestampQueryEpochError> };
|
7624 8055 | sender.send(()).await.expect("receiver dropped early");
|
7625 8056 | result
|
7626 8057 | }
|
7627 8058 | })
|
7628 8059 | .build_unchecked();
|
7629 8060 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7630 8061 | .await
|
7631 8062 | .expect("unable to make an HTTP request");
|
7632 8063 | ::pretty_assertions::assert_eq!(
|
7633 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8064 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7634 8065 | http_response.status()
|
7635 8066 | );
|
7636 8067 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7637 8068 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7638 8069 | http_response.headers(),
|
7639 8070 | expected_headers,
|
7640 8071 | ));
|
7641 8072 | }
|
7642 8073 | }
|
7643 8074 |
|
7644 8075 | /// When the format is epoch-seconds, IMF-fixdate timestamps are rejected with a
|
7645 8076 | /// 400 SerializationException
|
7646 8077 | /// Test ID: RestJsonQueryTimestampEpochRejectsHttpDate_case1
|
7647 8078 | #[::tokio::test]
|
7648 8079 | #[::tracing_test::traced_test]
|
7649 8080 | async fn rest_json_query_timestamp_epoch_rejects_http_date_case1_malformed_request() {
|
7650 8081 | {
|
7651 8082 | #[allow(unused_mut)]
|
7652 - | let mut http_request = http::Request::builder()
|
8083 + | let mut http_request = ::http_1x::Request::builder()
|
7653 8084 | .uri("/MalformedTimestampQueryEpoch")
|
7654 8085 | .method("POST")
|
7655 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8086 + | .body(::aws_smithy_http_server::body::boxed(
|
8087 + | ::http_body_util::Empty::new(),
|
8088 + | ))
|
7656 8089 | .unwrap();
|
7657 8090 | *http_request.uri_mut() = "/MalformedTimestampQueryEpoch?timestamp=Sun%2C%2002%20Jan%202000%2020%3A34%3A56.000%20GMT".parse().unwrap();
|
7658 8091 | #[allow(unused_mut)]
|
7659 8092 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7660 8093 | let config = crate::service::RestJsonConfig::builder().build();
|
7661 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8094 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7662 8095 | .malformed_timestamp_query_epoch(move |input: crate::input::MalformedTimestampQueryEpochInput| {
|
7663 8096 | let sender = sender.clone();
|
7664 8097 | async move {
|
7665 8098 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryEpochOutput, crate::error::MalformedTimestampQueryEpochError> };
|
7666 8099 | sender.send(()).await.expect("receiver dropped early");
|
7667 8100 | result
|
7668 8101 | }
|
7669 8102 | })
|
7670 8103 | .build_unchecked();
|
7671 8104 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7672 8105 | .await
|
7673 8106 | .expect("unable to make an HTTP request");
|
7674 8107 | ::pretty_assertions::assert_eq!(
|
7675 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8108 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7676 8109 | http_response.status()
|
7677 8110 | );
|
7678 8111 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7679 8112 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7680 8113 | http_response.headers(),
|
7681 8114 | expected_headers,
|
7682 8115 | ));
|
7683 8116 | }
|
7684 8117 | }
|
7685 8118 |
|
7686 8119 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
7687 8120 | /// Test ID: RestJsonQueryTimestampEpochRejectsMalformedValues_case0
|
7688 8121 | #[::tokio::test]
|
7689 8122 | #[::tracing_test::traced_test]
|
7690 8123 | async fn rest_json_query_timestamp_epoch_rejects_malformed_values_case0_malformed_request() {
|
7691 8124 | {
|
7692 8125 | #[allow(unused_mut)]
|
7693 - | let mut http_request = http::Request::builder()
|
8126 + | let mut http_request = ::http_1x::Request::builder()
|
7694 8127 | .uri("/MalformedTimestampQueryEpoch")
|
7695 8128 | .method("POST")
|
7696 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8129 + | .body(::aws_smithy_http_server::body::boxed(
|
8130 + | ::http_body_util::Empty::new(),
|
8131 + | ))
|
7697 8132 | .unwrap();
|
7698 8133 | *http_request.uri_mut() = "/MalformedTimestampQueryEpoch?timestamp=true"
|
7699 8134 | .parse()
|
7700 8135 | .unwrap();
|
7701 8136 | #[allow(unused_mut)]
|
7702 8137 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7703 8138 | let config = crate::service::RestJsonConfig::builder().build();
|
7704 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8139 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7705 8140 | .malformed_timestamp_query_epoch(move |input: crate::input::MalformedTimestampQueryEpochInput| {
|
7706 8141 | let sender = sender.clone();
|
7707 8142 | async move {
|
7708 8143 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryEpochOutput, crate::error::MalformedTimestampQueryEpochError> };
|
7709 8144 | sender.send(()).await.expect("receiver dropped early");
|
7710 8145 | result
|
7711 8146 | }
|
7712 8147 | })
|
7713 8148 | .build_unchecked();
|
7714 8149 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7715 8150 | .await
|
7716 8151 | .expect("unable to make an HTTP request");
|
7717 8152 | ::pretty_assertions::assert_eq!(
|
7718 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8153 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7719 8154 | http_response.status()
|
7720 8155 | );
|
7721 8156 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7722 8157 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7723 8158 | http_response.headers(),
|
7724 8159 | expected_headers,
|
7725 8160 | ));
|
7726 8161 | }
|
7727 8162 | }
|
7728 8163 |
|
7729 8164 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
7730 8165 | /// Test ID: RestJsonQueryTimestampEpochRejectsMalformedValues_case1
|
7731 8166 | #[::tokio::test]
|
7732 8167 | #[::tracing_test::traced_test]
|
7733 8168 | async fn rest_json_query_timestamp_epoch_rejects_malformed_values_case1_malformed_request() {
|
7734 8169 | {
|
7735 8170 | #[allow(unused_mut)]
|
7736 - | let mut http_request = http::Request::builder()
|
8171 + | let mut http_request = ::http_1x::Request::builder()
|
7737 8172 | .uri("/MalformedTimestampQueryEpoch")
|
7738 8173 | .method("POST")
|
7739 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8174 + | .body(::aws_smithy_http_server::body::boxed(
|
8175 + | ::http_body_util::Empty::new(),
|
8176 + | ))
|
7740 8177 | .unwrap();
|
7741 8178 | *http_request.uri_mut() = "/MalformedTimestampQueryEpoch?timestamp=1515531081ABC"
|
7742 8179 | .parse()
|
7743 8180 | .unwrap();
|
7744 8181 | #[allow(unused_mut)]
|
7745 8182 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7746 8183 | let config = crate::service::RestJsonConfig::builder().build();
|
7747 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8184 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7748 8185 | .malformed_timestamp_query_epoch(move |input: crate::input::MalformedTimestampQueryEpochInput| {
|
7749 8186 | let sender = sender.clone();
|
7750 8187 | async move {
|
7751 8188 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryEpochOutput, crate::error::MalformedTimestampQueryEpochError> };
|
7752 8189 | sender.send(()).await.expect("receiver dropped early");
|
7753 8190 | result
|
7754 8191 | }
|
7755 8192 | })
|
7756 8193 | .build_unchecked();
|
7757 8194 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7758 8195 | .await
|
7759 8196 | .expect("unable to make an HTTP request");
|
7760 8197 | ::pretty_assertions::assert_eq!(
|
7761 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8198 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7762 8199 | http_response.status()
|
7763 8200 | );
|
7764 8201 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7765 8202 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7766 8203 | http_response.headers(),
|
7767 8204 | expected_headers,
|
7768 8205 | ));
|
7769 8206 | }
|
7770 8207 | }
|
7771 8208 |
|
7772 8209 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
7773 8210 | /// Test ID: RestJsonQueryTimestampEpochRejectsMalformedValues_case2
|
7774 8211 | #[::tokio::test]
|
7775 8212 | #[::tracing_test::traced_test]
|
7776 8213 | async fn rest_json_query_timestamp_epoch_rejects_malformed_values_case2_malformed_request() {
|
7777 8214 | {
|
7778 8215 | #[allow(unused_mut)]
|
7779 - | let mut http_request = http::Request::builder()
|
8216 + | let mut http_request = ::http_1x::Request::builder()
|
7780 8217 | .uri("/MalformedTimestampQueryEpoch")
|
7781 8218 | .method("POST")
|
7782 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8219 + | .body(::aws_smithy_http_server::body::boxed(
|
8220 + | ::http_body_util::Empty::new(),
|
8221 + | ))
|
7783 8222 | .unwrap();
|
7784 8223 | *http_request.uri_mut() = "/MalformedTimestampQueryEpoch?timestamp=0x42"
|
7785 8224 | .parse()
|
7786 8225 | .unwrap();
|
7787 8226 | #[allow(unused_mut)]
|
7788 8227 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7789 8228 | let config = crate::service::RestJsonConfig::builder().build();
|
7790 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8229 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7791 8230 | .malformed_timestamp_query_epoch(move |input: crate::input::MalformedTimestampQueryEpochInput| {
|
7792 8231 | let sender = sender.clone();
|
7793 8232 | async move {
|
7794 8233 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryEpochOutput, crate::error::MalformedTimestampQueryEpochError> };
|
7795 8234 | sender.send(()).await.expect("receiver dropped early");
|
7796 8235 | result
|
7797 8236 | }
|
7798 8237 | })
|
7799 8238 | .build_unchecked();
|
7800 8239 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7801 8240 | .await
|
7802 8241 | .expect("unable to make an HTTP request");
|
7803 8242 | ::pretty_assertions::assert_eq!(
|
7804 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8243 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7805 8244 | http_response.status()
|
7806 8245 | );
|
7807 8246 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7808 8247 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7809 8248 | http_response.headers(),
|
7810 8249 | expected_headers,
|
7811 8250 | ));
|
7812 8251 | }
|
7813 8252 | }
|
7814 8253 |
|
7815 8254 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
7816 8255 | /// Test ID: RestJsonQueryTimestampEpochRejectsMalformedValues_case3
|
7817 8256 | #[::tokio::test]
|
7818 8257 | #[::tracing_test::traced_test]
|
7819 8258 | async fn rest_json_query_timestamp_epoch_rejects_malformed_values_case3_malformed_request() {
|
7820 8259 | {
|
7821 8260 | #[allow(unused_mut)]
|
7822 - | let mut http_request = http::Request::builder()
|
8261 + | let mut http_request = ::http_1x::Request::builder()
|
7823 8262 | .uri("/MalformedTimestampQueryEpoch")
|
7824 8263 | .method("POST")
|
7825 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8264 + | .body(::aws_smithy_http_server::body::boxed(
|
8265 + | ::http_body_util::Empty::new(),
|
8266 + | ))
|
7826 8267 | .unwrap();
|
7827 8268 | *http_request.uri_mut() = "/MalformedTimestampQueryEpoch?timestamp=1515531081.123.456"
|
7828 8269 | .parse()
|
7829 8270 | .unwrap();
|
7830 8271 | #[allow(unused_mut)]
|
7831 8272 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7832 8273 | let config = crate::service::RestJsonConfig::builder().build();
|
7833 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8274 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7834 8275 | .malformed_timestamp_query_epoch(move |input: crate::input::MalformedTimestampQueryEpochInput| {
|
7835 8276 | let sender = sender.clone();
|
7836 8277 | async move {
|
7837 8278 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryEpochOutput, crate::error::MalformedTimestampQueryEpochError> };
|
7838 8279 | sender.send(()).await.expect("receiver dropped early");
|
7839 8280 | result
|
7840 8281 | }
|
7841 8282 | })
|
7842 8283 | .build_unchecked();
|
7843 8284 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7844 8285 | .await
|
7845 8286 | .expect("unable to make an HTTP request");
|
7846 8287 | ::pretty_assertions::assert_eq!(
|
7847 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8288 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7848 8289 | http_response.status()
|
7849 8290 | );
|
7850 8291 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7851 8292 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7852 8293 | http_response.headers(),
|
7853 8294 | expected_headers,
|
7854 8295 | ));
|
7855 8296 | }
|
7856 8297 | }
|
7857 8298 |
|
7858 8299 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
7859 8300 | /// Test ID: RestJsonQueryTimestampEpochRejectsMalformedValues_case4
|
7860 8301 | #[::tokio::test]
|
7861 8302 | #[::tracing_test::traced_test]
|
7862 8303 | async fn rest_json_query_timestamp_epoch_rejects_malformed_values_case4_malformed_request() {
|
7863 8304 | {
|
7864 8305 | #[allow(unused_mut)]
|
7865 - | let mut http_request = http::Request::builder()
|
8306 + | let mut http_request = ::http_1x::Request::builder()
|
7866 8307 | .uri("/MalformedTimestampQueryEpoch")
|
7867 8308 | .method("POST")
|
7868 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8309 + | .body(::aws_smithy_http_server::body::boxed(
|
8310 + | ::http_body_util::Empty::new(),
|
8311 + | ))
|
7869 8312 | .unwrap();
|
7870 8313 | *http_request.uri_mut() = "/MalformedTimestampQueryEpoch?timestamp=Infinity"
|
7871 8314 | .parse()
|
7872 8315 | .unwrap();
|
7873 8316 | #[allow(unused_mut)]
|
7874 8317 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7875 8318 | let config = crate::service::RestJsonConfig::builder().build();
|
7876 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8319 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7877 8320 | .malformed_timestamp_query_epoch(move |input: crate::input::MalformedTimestampQueryEpochInput| {
|
7878 8321 | let sender = sender.clone();
|
7879 8322 | async move {
|
7880 8323 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryEpochOutput, crate::error::MalformedTimestampQueryEpochError> };
|
7881 8324 | sender.send(()).await.expect("receiver dropped early");
|
7882 8325 | result
|
7883 8326 | }
|
7884 8327 | })
|
7885 8328 | .build_unchecked();
|
7886 8329 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7887 8330 | .await
|
7888 8331 | .expect("unable to make an HTTP request");
|
7889 8332 | ::pretty_assertions::assert_eq!(
|
7890 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8333 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7891 8334 | http_response.status()
|
7892 8335 | );
|
7893 8336 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7894 8337 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7895 8338 | http_response.headers(),
|
7896 8339 | expected_headers,
|
7897 8340 | ));
|
7898 8341 | }
|
7899 8342 | }
|
7900 8343 |
|
7901 8344 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
7902 8345 | /// Test ID: RestJsonQueryTimestampEpochRejectsMalformedValues_case5
|
7903 8346 | #[::tokio::test]
|
7904 8347 | #[::tracing_test::traced_test]
|
7905 8348 | async fn rest_json_query_timestamp_epoch_rejects_malformed_values_case5_malformed_request() {
|
7906 8349 | {
|
7907 8350 | #[allow(unused_mut)]
|
7908 - | let mut http_request = http::Request::builder()
|
8351 + | let mut http_request = ::http_1x::Request::builder()
|
7909 8352 | .uri("/MalformedTimestampQueryEpoch")
|
7910 8353 | .method("POST")
|
7911 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8354 + | .body(::aws_smithy_http_server::body::boxed(
|
8355 + | ::http_body_util::Empty::new(),
|
8356 + | ))
|
7912 8357 | .unwrap();
|
7913 8358 | *http_request.uri_mut() = "/MalformedTimestampQueryEpoch?timestamp=-Infinity"
|
7914 8359 | .parse()
|
7915 8360 | .unwrap();
|
7916 8361 | #[allow(unused_mut)]
|
7917 8362 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7918 8363 | let config = crate::service::RestJsonConfig::builder().build();
|
7919 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8364 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7920 8365 | .malformed_timestamp_query_epoch(move |input: crate::input::MalformedTimestampQueryEpochInput| {
|
7921 8366 | let sender = sender.clone();
|
7922 8367 | async move {
|
7923 8368 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryEpochOutput, crate::error::MalformedTimestampQueryEpochError> };
|
7924 8369 | sender.send(()).await.expect("receiver dropped early");
|
7925 8370 | result
|
7926 8371 | }
|
7927 8372 | })
|
7928 8373 | .build_unchecked();
|
7929 8374 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7930 8375 | .await
|
7931 8376 | .expect("unable to make an HTTP request");
|
7932 8377 | ::pretty_assertions::assert_eq!(
|
7933 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8378 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7934 8379 | http_response.status()
|
7935 8380 | );
|
7936 8381 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7937 8382 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7938 8383 | http_response.headers(),
|
7939 8384 | expected_headers,
|
7940 8385 | ));
|
7941 8386 | }
|
7942 8387 | }
|
7943 8388 |
|
7944 8389 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
7945 8390 | /// Test ID: RestJsonQueryTimestampEpochRejectsMalformedValues_case6
|
7946 8391 | #[::tokio::test]
|
7947 8392 | #[::tracing_test::traced_test]
|
7948 8393 | async fn rest_json_query_timestamp_epoch_rejects_malformed_values_case6_malformed_request() {
|
7949 8394 | {
|
7950 8395 | #[allow(unused_mut)]
|
7951 - | let mut http_request = http::Request::builder()
|
8396 + | let mut http_request = ::http_1x::Request::builder()
|
7952 8397 | .uri("/MalformedTimestampQueryEpoch")
|
7953 8398 | .method("POST")
|
7954 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8399 + | .body(::aws_smithy_http_server::body::boxed(
|
8400 + | ::http_body_util::Empty::new(),
|
8401 + | ))
|
7955 8402 | .unwrap();
|
7956 8403 | *http_request.uri_mut() = "/MalformedTimestampQueryEpoch?timestamp=NaN"
|
7957 8404 | .parse()
|
7958 8405 | .unwrap();
|
7959 8406 | #[allow(unused_mut)]
|
7960 8407 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
7961 8408 | let config = crate::service::RestJsonConfig::builder().build();
|
7962 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8409 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
7963 8410 | .malformed_timestamp_query_epoch(move |input: crate::input::MalformedTimestampQueryEpochInput| {
|
7964 8411 | let sender = sender.clone();
|
7965 8412 | async move {
|
7966 8413 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryEpochOutput, crate::error::MalformedTimestampQueryEpochError> };
|
7967 8414 | sender.send(()).await.expect("receiver dropped early");
|
7968 8415 | result
|
7969 8416 | }
|
7970 8417 | })
|
7971 8418 | .build_unchecked();
|
7972 8419 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
7973 8420 | .await
|
7974 8421 | .expect("unable to make an HTTP request");
|
7975 8422 | ::pretty_assertions::assert_eq!(
|
7976 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8423 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
7977 8424 | http_response.status()
|
7978 8425 | );
|
7979 8426 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
7980 8427 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
7981 8428 | http_response.headers(),
|
7982 8429 | expected_headers,
|
7983 8430 | ));
|
7984 8431 | }
|
7985 8432 | }
|
8433 + |
|
8434 + | /* ProtocolTestGenerator.kt:98 */
|
7986 8435 | }
|
7987 8436 |
|
8437 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
7988 8438 | ::pin_project_lite::pin_project! {
|
7989 8439 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
7990 8440 | /// [`MalformedTimestampQueryHttpDateInput`](crate::input::MalformedTimestampQueryHttpDateInput) using modelled bindings.
|
7991 8441 | pub struct MalformedTimestampQueryHttpDateInputFuture {
|
7992 8442 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedTimestampQueryHttpDateInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
7993 8443 | }
|
7994 8444 | }
|
7995 8445 |
|
7996 8446 | impl std::future::Future for MalformedTimestampQueryHttpDateInputFuture {
|
7997 8447 | type Output = Result<
|
7998 8448 | crate::input::MalformedTimestampQueryHttpDateInput,
|
7999 8449 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
8000 8450 | >;
|
8001 8451 |
|
8002 8452 | fn poll(
|
8003 8453 | self: std::pin::Pin<&mut Self>,
|
8004 8454 | cx: &mut std::task::Context<'_>,
|
8005 8455 | ) -> std::task::Poll<Self::Output> {
|
8006 8456 | let this = self.project();
|
8007 8457 | this.inner.as_mut().poll(cx)
|
8008 8458 | }
|
8009 8459 | }
|
8010 8460 |
|
8011 8461 | impl<B>
|
8012 8462 | ::aws_smithy_http_server::request::FromRequest<
|
8013 8463 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
8014 8464 | B,
|
8015 8465 | > for crate::input::MalformedTimestampQueryHttpDateInput
|
8016 8466 | where
|
8017 8467 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
8018 8468 | B: 'static,
|
8019 8469 |
|
8020 8470 | B::Data: Send,
|
8021 8471 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
8022 8472 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
8023 8473 | {
|
8024 8474 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
8025 8475 | type Future = MalformedTimestampQueryHttpDateInputFuture;
|
8026 8476 |
|
8027 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
8477 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
8028 8478 | let fut = async move {
|
8029 8479 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
8030 8480 | request.headers(),
|
8031 8481 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
8032 8482 | ) {
|
8033 8483 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
8034 8484 | }
|
8035 8485 | crate::protocol_serde::shape_malformed_timestamp_query_http_date::de_malformed_timestamp_query_http_date_http_request(request)
|
8036 8486 | .await
|
8037 8487 | };
|
8038 8488 | use ::futures_util::future::TryFutureExt;
|
8039 8489 | let fut = fut.map_err(
|
8040 8490 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
8041 8491 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
8042 8492 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
8043 8493 | e,
|
8044 8494 | )
|
8045 8495 | },
|
8046 8496 | );
|
8047 8497 | MalformedTimestampQueryHttpDateInputFuture {
|
8048 8498 | inner: Box::pin(fut),
|
8049 8499 | }
|
8050 8500 | }
|
8051 8501 | }
|
8502 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
8052 8503 | impl
|
8053 8504 | ::aws_smithy_http_server::response::IntoResponse<
|
8054 8505 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
8055 8506 | > for crate::output::MalformedTimestampQueryHttpDateOutput
|
8056 8507 | {
|
8057 8508 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
8058 8509 | match crate::protocol_serde::shape_malformed_timestamp_query_http_date::ser_malformed_timestamp_query_http_date_http_response(self) {
|
8059 8510 | Ok(response) => response,
|
8060 8511 | Err(e) => {
|
8061 8512 | ::tracing::error!(error = %e, "failed to serialize response");
|
8062 8513 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
8063 8514 | }
|
8064 8515 | }
|
8065 8516 | }
|
8066 8517 | }
|
8518 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
8067 8519 | impl
|
8068 8520 | ::aws_smithy_http_server::response::IntoResponse<
|
8069 8521 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
8070 8522 | > for crate::error::MalformedTimestampQueryHttpDateError
|
8071 8523 | {
|
8072 8524 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
8073 8525 | match crate::protocol_serde::shape_malformed_timestamp_query_http_date::ser_malformed_timestamp_query_http_date_http_error(&self) {
|
8074 8526 | Ok(mut response) => {
|
8075 8527 | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
8076 8528 | response
|
8077 8529 | },
|
8078 8530 | Err(e) => {
|
8079 8531 | ::tracing::error!(error = %e, "failed to serialize response");
|
8080 8532 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
8081 8533 | }
|
8082 8534 | }
|
8083 8535 | }
|
8084 8536 | }
|
8085 8537 |
|
8538 + | /* RustType.kt:534 */
|
8086 8539 | #[allow(unreachable_code, unused_variables)]
|
8540 + | /* RustType.kt:534 */
|
8087 8541 | #[cfg(test)]
|
8542 + | /* ProtocolTestGenerator.kt:98 */
|
8088 8543 | mod malformed_timestamp_query_http_date_test {
|
8089 8544 |
|
8090 8545 | /// When the format is http-date, RFC3339 timestamps are rejected with a
|
8091 8546 | /// 400 SerializationException
|
8092 8547 | /// Test ID: RestJsonQueryTimestampHttpDateRejectsDateTime_case0
|
8093 8548 | #[::tokio::test]
|
8094 8549 | #[::tracing_test::traced_test]
|
8095 8550 | async fn rest_json_query_timestamp_http_date_rejects_date_time_case0_malformed_request() {
|
8096 8551 | {
|
8097 8552 | #[allow(unused_mut)]
|
8098 - | let mut http_request = http::Request::builder()
|
8553 + | let mut http_request = ::http_1x::Request::builder()
|
8099 8554 | .uri("/MalformedTimestampQueryHttpDate")
|
8100 8555 | .method("POST")
|
8101 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8556 + | .body(::aws_smithy_http_server::body::boxed(
|
8557 + | ::http_body_util::Empty::new(),
|
8558 + | ))
|
8102 8559 | .unwrap();
|
8103 8560 | *http_request.uri_mut() =
|
8104 8561 | "/MalformedTimestampQueryHttpDate?timestamp=1985-04-12T23%3A20%3A50.52Z"
|
8105 8562 | .parse()
|
8106 8563 | .unwrap();
|
8107 8564 | #[allow(unused_mut)]
|
8108 8565 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8109 8566 | let config = crate::service::RestJsonConfig::builder().build();
|
8110 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8567 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8111 8568 | .malformed_timestamp_query_http_date(move |input: crate::input::MalformedTimestampQueryHttpDateInput| {
|
8112 8569 | let sender = sender.clone();
|
8113 8570 | async move {
|
8114 8571 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryHttpDateOutput, crate::error::MalformedTimestampQueryHttpDateError> };
|
8115 8572 | sender.send(()).await.expect("receiver dropped early");
|
8116 8573 | result
|
8117 8574 | }
|
8118 8575 | })
|
8119 8576 | .build_unchecked();
|
8120 8577 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8121 8578 | .await
|
8122 8579 | .expect("unable to make an HTTP request");
|
8123 8580 | ::pretty_assertions::assert_eq!(
|
8124 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8581 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8125 8582 | http_response.status()
|
8126 8583 | );
|
8127 8584 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8128 8585 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8129 8586 | http_response.headers(),
|
8130 8587 | expected_headers,
|
8131 8588 | ));
|
8132 8589 | }
|
8133 8590 | }
|
8134 8591 |
|
8135 8592 | /// When the format is http-date, RFC3339 timestamps are rejected with a
|
8136 8593 | /// 400 SerializationException
|
8137 8594 | /// Test ID: RestJsonQueryTimestampHttpDateRejectsDateTime_case1
|
8138 8595 | #[::tokio::test]
|
8139 8596 | #[::tracing_test::traced_test]
|
8140 8597 | async fn rest_json_query_timestamp_http_date_rejects_date_time_case1_malformed_request() {
|
8141 8598 | {
|
8142 8599 | #[allow(unused_mut)]
|
8143 - | let mut http_request = http::Request::builder()
|
8600 + | let mut http_request = ::http_1x::Request::builder()
|
8144 8601 | .uri("/MalformedTimestampQueryHttpDate")
|
8145 8602 | .method("POST")
|
8146 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8603 + | .body(::aws_smithy_http_server::body::boxed(
|
8604 + | ::http_body_util::Empty::new(),
|
8605 + | ))
|
8147 8606 | .unwrap();
|
8148 8607 | *http_request.uri_mut() =
|
8149 8608 | "/MalformedTimestampQueryHttpDate?timestamp=1985-04-12T23%3A20%3A50Z"
|
8150 8609 | .parse()
|
8151 8610 | .unwrap();
|
8152 8611 | #[allow(unused_mut)]
|
8153 8612 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8154 8613 | let config = crate::service::RestJsonConfig::builder().build();
|
8155 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8614 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8156 8615 | .malformed_timestamp_query_http_date(move |input: crate::input::MalformedTimestampQueryHttpDateInput| {
|
8157 8616 | let sender = sender.clone();
|
8158 8617 | async move {
|
8159 8618 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryHttpDateOutput, crate::error::MalformedTimestampQueryHttpDateError> };
|
8160 8619 | sender.send(()).await.expect("receiver dropped early");
|
8161 8620 | result
|
8162 8621 | }
|
8163 8622 | })
|
8164 8623 | .build_unchecked();
|
8165 8624 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8166 8625 | .await
|
8167 8626 | .expect("unable to make an HTTP request");
|
8168 8627 | ::pretty_assertions::assert_eq!(
|
8169 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8628 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8170 8629 | http_response.status()
|
8171 8630 | );
|
8172 8631 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8173 8632 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8174 8633 | http_response.headers(),
|
8175 8634 | expected_headers,
|
8176 8635 | ));
|
8177 8636 | }
|
8178 8637 | }
|
8179 8638 |
|
8180 8639 | /// When the format is http-date, RFC3339 timestamps are rejected with a
|
8181 8640 | /// 400 SerializationException
|
8182 8641 | /// Test ID: RestJsonQueryTimestampHttpDateRejectsDateTime_case2
|
8183 8642 | #[::tokio::test]
|
8184 8643 | #[::tracing_test::traced_test]
|
8185 8644 | async fn rest_json_query_timestamp_http_date_rejects_date_time_case2_malformed_request() {
|
8186 8645 | {
|
8187 8646 | #[allow(unused_mut)]
|
8188 - | let mut http_request = http::Request::builder()
|
8647 + | let mut http_request = ::http_1x::Request::builder()
|
8189 8648 | .uri("/MalformedTimestampQueryHttpDate")
|
8190 8649 | .method("POST")
|
8191 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8650 + | .body(::aws_smithy_http_server::body::boxed(
|
8651 + | ::http_body_util::Empty::new(),
|
8652 + | ))
|
8192 8653 | .unwrap();
|
8193 8654 | *http_request.uri_mut() =
|
8194 8655 | "/MalformedTimestampQueryHttpDate?timestamp=1996-12-19T16%3A39%3A57-08%3A00"
|
8195 8656 | .parse()
|
8196 8657 | .unwrap();
|
8197 8658 | #[allow(unused_mut)]
|
8198 8659 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8199 8660 | let config = crate::service::RestJsonConfig::builder().build();
|
8200 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8661 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8201 8662 | .malformed_timestamp_query_http_date(move |input: crate::input::MalformedTimestampQueryHttpDateInput| {
|
8202 8663 | let sender = sender.clone();
|
8203 8664 | async move {
|
8204 8665 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryHttpDateOutput, crate::error::MalformedTimestampQueryHttpDateError> };
|
8205 8666 | sender.send(()).await.expect("receiver dropped early");
|
8206 8667 | result
|
8207 8668 | }
|
8208 8669 | })
|
8209 8670 | .build_unchecked();
|
8210 8671 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8211 8672 | .await
|
8212 8673 | .expect("unable to make an HTTP request");
|
8213 8674 | ::pretty_assertions::assert_eq!(
|
8214 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8675 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8215 8676 | http_response.status()
|
8216 8677 | );
|
8217 8678 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8218 8679 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8219 8680 | http_response.headers(),
|
8220 8681 | expected_headers,
|
8221 8682 | ));
|
8222 8683 | }
|
8223 8684 | }
|
8224 8685 |
|
8225 8686 | /// When the format is http-date, epoch second timestamps are rejected with a
|
8226 8687 | /// 400 SerializationException
|
8227 8688 | /// Test ID: RestJsonQueryTimestampHttpDateRejectsEpochSeconds_case0
|
8228 8689 | #[::tokio::test]
|
8229 8690 | #[::tracing_test::traced_test]
|
8230 8691 | async fn rest_json_query_timestamp_http_date_rejects_epoch_seconds_case0_malformed_request() {
|
8231 8692 | {
|
8232 8693 | #[allow(unused_mut)]
|
8233 - | let mut http_request = http::Request::builder()
|
8694 + | let mut http_request = ::http_1x::Request::builder()
|
8234 8695 | .uri("/MalformedTimestampQueryHttpDate")
|
8235 8696 | .method("POST")
|
8236 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8697 + | .body(::aws_smithy_http_server::body::boxed(
|
8698 + | ::http_body_util::Empty::new(),
|
8699 + | ))
|
8237 8700 | .unwrap();
|
8238 8701 | *http_request.uri_mut() = "/MalformedTimestampQueryHttpDate?timestamp=1515531081.1234"
|
8239 8702 | .parse()
|
8240 8703 | .unwrap();
|
8241 8704 | #[allow(unused_mut)]
|
8242 8705 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8243 8706 | let config = crate::service::RestJsonConfig::builder().build();
|
8244 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8707 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8245 8708 | .malformed_timestamp_query_http_date(move |input: crate::input::MalformedTimestampQueryHttpDateInput| {
|
8246 8709 | let sender = sender.clone();
|
8247 8710 | async move {
|
8248 8711 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryHttpDateOutput, crate::error::MalformedTimestampQueryHttpDateError> };
|
8249 8712 | sender.send(()).await.expect("receiver dropped early");
|
8250 8713 | result
|
8251 8714 | }
|
8252 8715 | })
|
8253 8716 | .build_unchecked();
|
8254 8717 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8255 8718 | .await
|
8256 8719 | .expect("unable to make an HTTP request");
|
8257 8720 | ::pretty_assertions::assert_eq!(
|
8258 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8721 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8259 8722 | http_response.status()
|
8260 8723 | );
|
8261 8724 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8262 8725 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8263 8726 | http_response.headers(),
|
8264 8727 | expected_headers,
|
8265 8728 | ));
|
8266 8729 | }
|
8267 8730 | }
|
8268 8731 |
|
8269 8732 | /// When the format is http-date, epoch second timestamps are rejected with a
|
8270 8733 | /// 400 SerializationException
|
8271 8734 | /// Test ID: RestJsonQueryTimestampHttpDateRejectsEpochSeconds_case1
|
8272 8735 | #[::tokio::test]
|
8273 8736 | #[::tracing_test::traced_test]
|
8274 8737 | async fn rest_json_query_timestamp_http_date_rejects_epoch_seconds_case1_malformed_request() {
|
8275 8738 | {
|
8276 8739 | #[allow(unused_mut)]
|
8277 - | let mut http_request = http::Request::builder()
|
8740 + | let mut http_request = ::http_1x::Request::builder()
|
8278 8741 | .uri("/MalformedTimestampQueryHttpDate")
|
8279 8742 | .method("POST")
|
8280 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8743 + | .body(::aws_smithy_http_server::body::boxed(
|
8744 + | ::http_body_util::Empty::new(),
|
8745 + | ))
|
8281 8746 | .unwrap();
|
8282 8747 | *http_request.uri_mut() = "/MalformedTimestampQueryHttpDate?timestamp=1515531081"
|
8283 8748 | .parse()
|
8284 8749 | .unwrap();
|
8285 8750 | #[allow(unused_mut)]
|
8286 8751 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8287 8752 | let config = crate::service::RestJsonConfig::builder().build();
|
8288 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8753 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8289 8754 | .malformed_timestamp_query_http_date(move |input: crate::input::MalformedTimestampQueryHttpDateInput| {
|
8290 8755 | let sender = sender.clone();
|
8291 8756 | async move {
|
8292 8757 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryHttpDateOutput, crate::error::MalformedTimestampQueryHttpDateError> };
|
8293 8758 | sender.send(()).await.expect("receiver dropped early");
|
8294 8759 | result
|
8295 8760 | }
|
8296 8761 | })
|
8297 8762 | .build_unchecked();
|
8298 8763 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8299 8764 | .await
|
8300 8765 | .expect("unable to make an HTTP request");
|
8301 8766 | ::pretty_assertions::assert_eq!(
|
8302 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8767 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8303 8768 | http_response.status()
|
8304 8769 | );
|
8305 8770 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8306 8771 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8307 8772 | http_response.headers(),
|
8308 8773 | expected_headers,
|
8309 8774 | ));
|
8310 8775 | }
|
8311 8776 | }
|
8777 + |
|
8778 + | /* ProtocolTestGenerator.kt:98 */
|
8312 8779 | }
|
8313 8780 |
|
8781 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
8314 8782 | ::pin_project_lite::pin_project! {
|
8315 8783 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
8316 8784 | /// [`MalformedTimestampQueryDefaultInput`](crate::input::MalformedTimestampQueryDefaultInput) using modelled bindings.
|
8317 8785 | pub struct MalformedTimestampQueryDefaultInputFuture {
|
8318 8786 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedTimestampQueryDefaultInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
8319 8787 | }
|
8320 8788 | }
|
8321 8789 |
|
8322 8790 | impl std::future::Future for MalformedTimestampQueryDefaultInputFuture {
|
8323 8791 | type Output = Result<
|
8324 8792 | crate::input::MalformedTimestampQueryDefaultInput,
|
8325 8793 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
8326 8794 | >;
|
8327 8795 |
|
8328 8796 | fn poll(
|
8329 8797 | self: std::pin::Pin<&mut Self>,
|
8330 8798 | cx: &mut std::task::Context<'_>,
|
8331 8799 | ) -> std::task::Poll<Self::Output> {
|
8332 8800 | let this = self.project();
|
8333 8801 | this.inner.as_mut().poll(cx)
|
8334 8802 | }
|
8335 8803 | }
|
8336 8804 |
|
8337 8805 | impl<B>
|
8338 8806 | ::aws_smithy_http_server::request::FromRequest<
|
8339 8807 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
8340 8808 | B,
|
8341 8809 | > for crate::input::MalformedTimestampQueryDefaultInput
|
8342 8810 | where
|
8343 8811 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
8344 8812 | B: 'static,
|
8345 8813 |
|
8346 8814 | B::Data: Send,
|
8347 8815 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
8348 8816 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
8349 8817 | {
|
8350 8818 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
8351 8819 | type Future = MalformedTimestampQueryDefaultInputFuture;
|
8352 8820 |
|
8353 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
8821 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
8354 8822 | let fut = async move {
|
8355 8823 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
8356 8824 | request.headers(),
|
8357 8825 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
8358 8826 | ) {
|
8359 8827 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
8360 8828 | }
|
8361 8829 | crate::protocol_serde::shape_malformed_timestamp_query_default::de_malformed_timestamp_query_default_http_request(request)
|
8362 8830 | .await
|
8363 8831 | };
|
8364 8832 | use ::futures_util::future::TryFutureExt;
|
8365 8833 | let fut = fut.map_err(
|
8366 8834 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
8367 8835 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
8368 8836 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
8369 8837 | e,
|
8370 8838 | )
|
8371 8839 | },
|
8372 8840 | );
|
8373 8841 | MalformedTimestampQueryDefaultInputFuture {
|
8374 8842 | inner: Box::pin(fut),
|
8375 8843 | }
|
8376 8844 | }
|
8377 8845 | }
|
8846 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
8378 8847 | impl
|
8379 8848 | ::aws_smithy_http_server::response::IntoResponse<
|
8380 8849 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
8381 8850 | > for crate::output::MalformedTimestampQueryDefaultOutput
|
8382 8851 | {
|
8383 8852 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
8384 8853 | match crate::protocol_serde::shape_malformed_timestamp_query_default::ser_malformed_timestamp_query_default_http_response(self) {
|
8385 8854 | Ok(response) => response,
|
8386 8855 | Err(e) => {
|
8387 8856 | ::tracing::error!(error = %e, "failed to serialize response");
|
8388 8857 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
8389 8858 | }
|
8390 8859 | }
|
8391 8860 | }
|
8392 8861 | }
|
8862 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
8393 8863 | impl
|
8394 8864 | ::aws_smithy_http_server::response::IntoResponse<
|
8395 8865 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
8396 8866 | > for crate::error::MalformedTimestampQueryDefaultError
|
8397 8867 | {
|
8398 8868 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
8399 8869 | match crate::protocol_serde::shape_malformed_timestamp_query_default::ser_malformed_timestamp_query_default_http_error(&self) {
|
8400 8870 | Ok(mut response) => {
|
8401 8871 | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
8402 8872 | response
|
8403 8873 | },
|
8404 8874 | Err(e) => {
|
8405 8875 | ::tracing::error!(error = %e, "failed to serialize response");
|
8406 8876 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
8407 8877 | }
|
8408 8878 | }
|
8409 8879 | }
|
8410 8880 | }
|
8411 8881 |
|
8882 + | /* RustType.kt:534 */
|
8412 8883 | #[allow(unreachable_code, unused_variables)]
|
8884 + | /* RustType.kt:534 */
|
8413 8885 | #[cfg(test)]
|
8886 + | /* ProtocolTestGenerator.kt:98 */
|
8414 8887 | mod malformed_timestamp_query_default_test {
|
8415 8888 |
|
8416 8889 | /// By default, IMF-fixdate timestamps are rejected with a
|
8417 8890 | /// 400 SerializationException
|
8418 8891 | /// Test ID: RestJsonQueryTimestampDefaultRejectsHttpDate_case0
|
8419 8892 | #[::tokio::test]
|
8420 8893 | #[::tracing_test::traced_test]
|
8421 8894 | async fn rest_json_query_timestamp_default_rejects_http_date_case0_malformed_request() {
|
8422 8895 | {
|
8423 8896 | #[allow(unused_mut)]
|
8424 - | let mut http_request = http::Request::builder()
|
8897 + | let mut http_request = ::http_1x::Request::builder()
|
8425 8898 | .uri("/MalformedTimestampQueryDefault")
|
8426 8899 | .method("POST")
|
8427 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8900 + | .body(::aws_smithy_http_server::body::boxed(
|
8901 + | ::http_body_util::Empty::new(),
|
8902 + | ))
|
8428 8903 | .unwrap();
|
8429 8904 | *http_request.uri_mut() = "/MalformedTimestampQueryDefault?timestamp=Tue%2C%2029%20Apr%202014%2018%3A30%3A38%20GMT".parse().unwrap();
|
8430 8905 | #[allow(unused_mut)]
|
8431 8906 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8432 8907 | let config = crate::service::RestJsonConfig::builder().build();
|
8433 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8908 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8434 8909 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
8435 8910 | let sender = sender.clone();
|
8436 8911 | async move {
|
8437 8912 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
8438 8913 | sender.send(()).await.expect("receiver dropped early");
|
8439 8914 | result
|
8440 8915 | }
|
8441 8916 | })
|
8442 8917 | .build_unchecked();
|
8443 8918 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8444 8919 | .await
|
8445 8920 | .expect("unable to make an HTTP request");
|
8446 8921 | ::pretty_assertions::assert_eq!(
|
8447 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8922 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8448 8923 | http_response.status()
|
8449 8924 | );
|
8450 8925 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8451 8926 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8452 8927 | http_response.headers(),
|
8453 8928 | expected_headers,
|
8454 8929 | ));
|
8455 8930 | }
|
8456 8931 | }
|
8457 8932 |
|
8458 8933 | /// By default, IMF-fixdate timestamps are rejected with a
|
8459 8934 | /// 400 SerializationException
|
8460 8935 | /// Test ID: RestJsonQueryTimestampDefaultRejectsHttpDate_case1
|
8461 8936 | #[::tokio::test]
|
8462 8937 | #[::tracing_test::traced_test]
|
8463 8938 | async fn rest_json_query_timestamp_default_rejects_http_date_case1_malformed_request() {
|
8464 8939 | {
|
8465 8940 | #[allow(unused_mut)]
|
8466 - | let mut http_request = http::Request::builder()
|
8941 + | let mut http_request = ::http_1x::Request::builder()
|
8467 8942 | .uri("/MalformedTimestampQueryDefault")
|
8468 8943 | .method("POST")
|
8469 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8944 + | .body(::aws_smithy_http_server::body::boxed(
|
8945 + | ::http_body_util::Empty::new(),
|
8946 + | ))
|
8470 8947 | .unwrap();
|
8471 8948 | *http_request.uri_mut() = "/MalformedTimestampQueryDefault?timestamp=Sun%2C%2002%20Jan%202000%2020%3A34%3A56.000%20GMT".parse().unwrap();
|
8472 8949 | #[allow(unused_mut)]
|
8473 8950 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8474 8951 | let config = crate::service::RestJsonConfig::builder().build();
|
8475 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8952 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8476 8953 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
8477 8954 | let sender = sender.clone();
|
8478 8955 | async move {
|
8479 8956 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
8480 8957 | sender.send(()).await.expect("receiver dropped early");
|
8481 8958 | result
|
8482 8959 | }
|
8483 8960 | })
|
8484 8961 | .build_unchecked();
|
8485 8962 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8486 8963 | .await
|
8487 8964 | .expect("unable to make an HTTP request");
|
8488 8965 | ::pretty_assertions::assert_eq!(
|
8489 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8966 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8490 8967 | http_response.status()
|
8491 8968 | );
|
8492 8969 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8493 8970 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8494 8971 | http_response.headers(),
|
8495 8972 | expected_headers,
|
8496 8973 | ));
|
8497 8974 | }
|
8498 8975 | }
|
8499 8976 |
|
8500 8977 | /// By default, epoch second timestamps are rejected with a
|
8501 8978 | /// 400 SerializationException
|
8502 8979 | /// Test ID: RestJsonQueryTimestampDefaultRejectsEpochSeconds_case0
|
8503 8980 | #[::tokio::test]
|
8504 8981 | #[::tracing_test::traced_test]
|
8505 8982 | async fn rest_json_query_timestamp_default_rejects_epoch_seconds_case0_malformed_request() {
|
8506 8983 | {
|
8507 8984 | #[allow(unused_mut)]
|
8508 - | let mut http_request = http::Request::builder()
|
8985 + | let mut http_request = ::http_1x::Request::builder()
|
8509 8986 | .uri("/MalformedTimestampQueryDefault")
|
8510 8987 | .method("POST")
|
8511 - | .body(::aws_smithy_http_server::body::Body::empty())
|
8988 + | .body(::aws_smithy_http_server::body::boxed(
|
8989 + | ::http_body_util::Empty::new(),
|
8990 + | ))
|
8512 8991 | .unwrap();
|
8513 8992 | *http_request.uri_mut() = "/MalformedTimestampQueryDefault?timestamp=1515531081.1234"
|
8514 8993 | .parse()
|
8515 8994 | .unwrap();
|
8516 8995 | #[allow(unused_mut)]
|
8517 8996 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8518 8997 | let config = crate::service::RestJsonConfig::builder().build();
|
8519 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
8998 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8520 8999 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
8521 9000 | let sender = sender.clone();
|
8522 9001 | async move {
|
8523 9002 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
8524 9003 | sender.send(()).await.expect("receiver dropped early");
|
8525 9004 | result
|
8526 9005 | }
|
8527 9006 | })
|
8528 9007 | .build_unchecked();
|
8529 9008 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8530 9009 | .await
|
8531 9010 | .expect("unable to make an HTTP request");
|
8532 9011 | ::pretty_assertions::assert_eq!(
|
8533 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9012 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8534 9013 | http_response.status()
|
8535 9014 | );
|
8536 9015 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8537 9016 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8538 9017 | http_response.headers(),
|
8539 9018 | expected_headers,
|
8540 9019 | ));
|
8541 9020 | }
|
8542 9021 | }
|
8543 9022 |
|
8544 9023 | /// By default, epoch second timestamps are rejected with a
|
8545 9024 | /// 400 SerializationException
|
8546 9025 | /// Test ID: RestJsonQueryTimestampDefaultRejectsEpochSeconds_case1
|
8547 9026 | #[::tokio::test]
|
8548 9027 | #[::tracing_test::traced_test]
|
8549 9028 | async fn rest_json_query_timestamp_default_rejects_epoch_seconds_case1_malformed_request() {
|
8550 9029 | {
|
8551 9030 | #[allow(unused_mut)]
|
8552 - | let mut http_request = http::Request::builder()
|
9031 + | let mut http_request = ::http_1x::Request::builder()
|
8553 9032 | .uri("/MalformedTimestampQueryDefault")
|
8554 9033 | .method("POST")
|
8555 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9034 + | .body(::aws_smithy_http_server::body::boxed(
|
9035 + | ::http_body_util::Empty::new(),
|
9036 + | ))
|
8556 9037 | .unwrap();
|
8557 9038 | *http_request.uri_mut() = "/MalformedTimestampQueryDefault?timestamp=1515531081"
|
8558 9039 | .parse()
|
8559 9040 | .unwrap();
|
8560 9041 | #[allow(unused_mut)]
|
8561 9042 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8562 9043 | let config = crate::service::RestJsonConfig::builder().build();
|
8563 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9044 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8564 9045 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
8565 9046 | let sender = sender.clone();
|
8566 9047 | async move {
|
8567 9048 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
8568 9049 | sender.send(()).await.expect("receiver dropped early");
|
8569 9050 | result
|
8570 9051 | }
|
8571 9052 | })
|
8572 9053 | .build_unchecked();
|
8573 9054 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8574 9055 | .await
|
8575 9056 | .expect("unable to make an HTTP request");
|
8576 9057 | ::pretty_assertions::assert_eq!(
|
8577 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9058 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8578 9059 | http_response.status()
|
8579 9060 | );
|
8580 9061 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8581 9062 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8582 9063 | http_response.headers(),
|
8583 9064 | expected_headers,
|
8584 9065 | ));
|
8585 9066 | }
|
8586 9067 | }
|
8587 9068 |
|
8588 9069 | /// UTC offsets must be rejected with a
|
8589 9070 | /// 400 SerializationException
|
8590 9071 | /// Test ID: RestJsonQueryTimestampDefaultRejectsUTCOffsets
|
8591 9072 | #[::tokio::test]
|
8592 9073 | #[::tracing_test::traced_test]
|
8593 9074 | async fn rest_json_query_timestamp_default_rejects_utc_offsets_malformed_request() {
|
8594 9075 | {
|
8595 9076 | #[allow(unused_mut)]
|
8596 - | let mut http_request = http::Request::builder()
|
9077 + | let mut http_request = ::http_1x::Request::builder()
|
8597 9078 | .uri("/MalformedTimestampQueryDefault")
|
8598 9079 | .method("POST")
|
8599 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9080 + | .body(::aws_smithy_http_server::body::boxed(
|
9081 + | ::http_body_util::Empty::new(),
|
9082 + | ))
|
8600 9083 | .unwrap();
|
8601 9084 | *http_request.uri_mut() = "/MalformedTimestampQueryDefault?timestamp=$value:L"
|
8602 9085 | .parse()
|
8603 9086 | .unwrap();
|
8604 9087 | #[allow(unused_mut)]
|
8605 9088 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8606 9089 | let config = crate::service::RestJsonConfig::builder().build();
|
8607 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9090 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8608 9091 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
8609 9092 | let sender = sender.clone();
|
8610 9093 | async move {
|
8611 9094 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
8612 9095 | sender.send(()).await.expect("receiver dropped early");
|
8613 9096 | result
|
8614 9097 | }
|
8615 9098 | })
|
8616 9099 | .build_unchecked();
|
8617 9100 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8618 9101 | .await
|
8619 9102 | .expect("unable to make an HTTP request");
|
8620 9103 | ::pretty_assertions::assert_eq!(
|
8621 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9104 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8622 9105 | http_response.status()
|
8623 9106 | );
|
8624 9107 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8625 9108 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8626 9109 | http_response.headers(),
|
8627 9110 | expected_headers,
|
8628 9111 | ));
|
8629 9112 | }
|
8630 9113 | }
|
8631 9114 |
|
8632 9115 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
8633 9116 | /// are rejected with a 400 SerializationException
|
8634 9117 | /// Test ID: RestJsonQueryTimestampDefaultRejectsDifferent8601Formats_case0
|
8635 9118 | #[::tokio::test]
|
8636 9119 | #[::tracing_test::traced_test]
|
8637 9120 | async fn rest_json_query_timestamp_default_rejects_different8601_formats_case0_malformed_request(
|
8638 9121 | ) {
|
8639 9122 | {
|
8640 9123 | #[allow(unused_mut)]
|
8641 - | let mut http_request = http::Request::builder()
|
9124 + | let mut http_request = ::http_1x::Request::builder()
|
8642 9125 | .uri("/MalformedTimestampQueryDefault")
|
8643 9126 | .method("POST")
|
8644 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9127 + | .body(::aws_smithy_http_server::body::boxed(
|
9128 + | ::http_body_util::Empty::new(),
|
9129 + | ))
|
8645 9130 | .unwrap();
|
8646 9131 | *http_request.uri_mut() =
|
8647 9132 | "/MalformedTimestampQueryDefault?timestamp=1996-12-19T16:39:57+00"
|
8648 9133 | .parse()
|
8649 9134 | .unwrap();
|
8650 9135 | #[allow(unused_mut)]
|
8651 9136 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8652 9137 | let config = crate::service::RestJsonConfig::builder().build();
|
8653 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9138 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8654 9139 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
8655 9140 | let sender = sender.clone();
|
8656 9141 | async move {
|
8657 9142 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
8658 9143 | sender.send(()).await.expect("receiver dropped early");
|
8659 9144 | result
|
8660 9145 | }
|
8661 9146 | })
|
8662 9147 | .build_unchecked();
|
8663 9148 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8664 9149 | .await
|
8665 9150 | .expect("unable to make an HTTP request");
|
8666 9151 | ::pretty_assertions::assert_eq!(
|
8667 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9152 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8668 9153 | http_response.status()
|
8669 9154 | );
|
8670 9155 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8671 9156 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8672 9157 | http_response.headers(),
|
8673 9158 | expected_headers,
|
8674 9159 | ));
|
8675 9160 | }
|
8676 9161 | }
|
8677 9162 |
|
8678 9163 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
8679 9164 | /// are rejected with a 400 SerializationException
|
8680 9165 | /// Test ID: RestJsonQueryTimestampDefaultRejectsDifferent8601Formats_case1
|
8681 9166 | #[::tokio::test]
|
8682 9167 | #[::tracing_test::traced_test]
|
8683 9168 | async fn rest_json_query_timestamp_default_rejects_different8601_formats_case1_malformed_request(
|
8684 9169 | ) {
|
8685 9170 | {
|
8686 9171 | #[allow(unused_mut)]
|
8687 - | let mut http_request = http::Request::builder()
|
9172 + | let mut http_request = ::http_1x::Request::builder()
|
8688 9173 | .uri("/MalformedTimestampQueryDefault")
|
8689 9174 | .method("POST")
|
8690 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9175 + | .body(::aws_smithy_http_server::body::boxed(
|
9176 + | ::http_body_util::Empty::new(),
|
9177 + | ))
|
8691 9178 | .unwrap();
|
8692 9179 | *http_request.uri_mut() =
|
8693 9180 | "/MalformedTimestampQueryDefault?timestamp=1996-12-19T16:39:57+00Z"
|
8694 9181 | .parse()
|
8695 9182 | .unwrap();
|
8696 9183 | #[allow(unused_mut)]
|
8697 9184 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8698 9185 | let config = crate::service::RestJsonConfig::builder().build();
|
8699 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9186 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8700 9187 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
8701 9188 | let sender = sender.clone();
|
8702 9189 | async move {
|
8703 9190 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
8704 9191 | sender.send(()).await.expect("receiver dropped early");
|
8705 9192 | result
|
8706 9193 | }
|
8707 9194 | })
|
8708 9195 | .build_unchecked();
|
8709 9196 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8710 9197 | .await
|
8711 9198 | .expect("unable to make an HTTP request");
|
8712 9199 | ::pretty_assertions::assert_eq!(
|
8713 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9200 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8714 9201 | http_response.status()
|
8715 9202 | );
|
8716 9203 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8717 9204 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8718 9205 | http_response.headers(),
|
8719 9206 | expected_headers,
|
8720 9207 | ));
|
8721 9208 | }
|
8722 9209 | }
|
8723 9210 |
|
8724 9211 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
8725 9212 | /// are rejected with a 400 SerializationException
|
8726 9213 | /// Test ID: RestJsonQueryTimestampDefaultRejectsDifferent8601Formats_case2
|
8727 9214 | #[::tokio::test]
|
8728 9215 | #[::tracing_test::traced_test]
|
8729 9216 | async fn rest_json_query_timestamp_default_rejects_different8601_formats_case2_malformed_request(
|
8730 9217 | ) {
|
8731 9218 | {
|
8732 9219 | #[allow(unused_mut)]
|
8733 - | let mut http_request = http::Request::builder()
|
9220 + | let mut http_request = ::http_1x::Request::builder()
|
8734 9221 | .uri("/MalformedTimestampQueryDefault")
|
8735 9222 | .method("POST")
|
8736 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9223 + | .body(::aws_smithy_http_server::body::boxed(
|
9224 + | ::http_body_util::Empty::new(),
|
9225 + | ))
|
8737 9226 | .unwrap();
|
8738 9227 | *http_request.uri_mut() =
|
8739 9228 | "/MalformedTimestampQueryDefault?timestamp=1996-12-19T16:39:57"
|
8740 9229 | .parse()
|
8741 9230 | .unwrap();
|
8742 9231 | #[allow(unused_mut)]
|
8743 9232 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8744 9233 | let config = crate::service::RestJsonConfig::builder().build();
|
8745 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9234 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8746 9235 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
8747 9236 | let sender = sender.clone();
|
8748 9237 | async move {
|
8749 9238 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
8750 9239 | sender.send(()).await.expect("receiver dropped early");
|
8751 9240 | result
|
8752 9241 | }
|
8753 9242 | })
|
8754 9243 | .build_unchecked();
|
8755 9244 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8756 9245 | .await
|
8757 9246 | .expect("unable to make an HTTP request");
|
8758 9247 | ::pretty_assertions::assert_eq!(
|
8759 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9248 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8760 9249 | http_response.status()
|
8761 9250 | );
|
8762 9251 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8763 9252 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8764 9253 | http_response.headers(),
|
8765 9254 | expected_headers,
|
8766 9255 | ));
|
8767 9256 | }
|
8768 9257 | }
|
8769 9258 |
|
8770 9259 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
8771 9260 | /// are rejected with a 400 SerializationException
|
8772 9261 | /// Test ID: RestJsonQueryTimestampDefaultRejectsDifferent8601Formats_case3
|
8773 9262 | #[::tokio::test]
|
8774 9263 | #[::tracing_test::traced_test]
|
8775 9264 | async fn rest_json_query_timestamp_default_rejects_different8601_formats_case3_malformed_request(
|
8776 9265 | ) {
|
8777 9266 | {
|
8778 9267 | #[allow(unused_mut)]
|
8779 - | let mut http_request = http::Request::builder()
|
9268 + | let mut http_request = ::http_1x::Request::builder()
|
8780 9269 | .uri("/MalformedTimestampQueryDefault")
|
8781 9270 | .method("POST")
|
8782 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9271 + | .body(::aws_smithy_http_server::body::boxed(
|
9272 + | ::http_body_util::Empty::new(),
|
9273 + | ))
|
8783 9274 | .unwrap();
|
8784 9275 | *http_request.uri_mut() = "/MalformedTimestampQueryDefault?timestamp=1996-12-19T163957"
|
8785 9276 | .parse()
|
8786 9277 | .unwrap();
|
8787 9278 | #[allow(unused_mut)]
|
8788 9279 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8789 9280 | let config = crate::service::RestJsonConfig::builder().build();
|
8790 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9281 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8791 9282 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
8792 9283 | let sender = sender.clone();
|
8793 9284 | async move {
|
8794 9285 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
8795 9286 | sender.send(()).await.expect("receiver dropped early");
|
8796 9287 | result
|
8797 9288 | }
|
8798 9289 | })
|
8799 9290 | .build_unchecked();
|
8800 9291 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8801 9292 | .await
|
8802 9293 | .expect("unable to make an HTTP request");
|
8803 9294 | ::pretty_assertions::assert_eq!(
|
8804 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9295 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8805 9296 | http_response.status()
|
8806 9297 | );
|
8807 9298 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8808 9299 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8809 9300 | http_response.headers(),
|
8810 9301 | expected_headers,
|
8811 9302 | ));
|
8812 9303 | }
|
8813 9304 | }
|
8814 9305 |
|
8815 9306 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
8816 9307 | /// are rejected with a 400 SerializationException
|
8817 9308 | /// Test ID: RestJsonQueryTimestampDefaultRejectsDifferent8601Formats_case4
|
8818 9309 | #[::tokio::test]
|
8819 9310 | #[::tracing_test::traced_test]
|
8820 9311 | async fn rest_json_query_timestamp_default_rejects_different8601_formats_case4_malformed_request(
|
8821 9312 | ) {
|
8822 9313 | {
|
8823 9314 | #[allow(unused_mut)]
|
8824 - | let mut http_request = http::Request::builder()
|
9315 + | let mut http_request = ::http_1x::Request::builder()
|
8825 9316 | .uri("/MalformedTimestampQueryDefault")
|
8826 9317 | .method("POST")
|
8827 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9318 + | .body(::aws_smithy_http_server::body::boxed(
|
9319 + | ::http_body_util::Empty::new(),
|
9320 + | ))
|
8828 9321 | .unwrap();
|
8829 9322 | *http_request.uri_mut() = "/MalformedTimestampQueryDefault?timestamp=19961219T163957Z"
|
8830 9323 | .parse()
|
8831 9324 | .unwrap();
|
8832 9325 | #[allow(unused_mut)]
|
8833 9326 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8834 9327 | let config = crate::service::RestJsonConfig::builder().build();
|
8835 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9328 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8836 9329 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
8837 9330 | let sender = sender.clone();
|
8838 9331 | async move {
|
8839 9332 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
8840 9333 | sender.send(()).await.expect("receiver dropped early");
|
8841 9334 | result
|
8842 9335 | }
|
8843 9336 | })
|
8844 9337 | .build_unchecked();
|
8845 9338 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8846 9339 | .await
|
8847 9340 | .expect("unable to make an HTTP request");
|
8848 9341 | ::pretty_assertions::assert_eq!(
|
8849 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9342 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8850 9343 | http_response.status()
|
8851 9344 | );
|
8852 9345 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8853 9346 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8854 9347 | http_response.headers(),
|
8855 9348 | expected_headers,
|
8856 9349 | ));
|
8857 9350 | }
|
8858 9351 | }
|
8859 9352 |
|
8860 9353 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
8861 9354 | /// are rejected with a 400 SerializationException
|
8862 9355 | /// Test ID: RestJsonQueryTimestampDefaultRejectsDifferent8601Formats_case5
|
8863 9356 | #[::tokio::test]
|
8864 9357 | #[::tracing_test::traced_test]
|
8865 9358 | async fn rest_json_query_timestamp_default_rejects_different8601_formats_case5_malformed_request(
|
8866 9359 | ) {
|
8867 9360 | {
|
8868 9361 | #[allow(unused_mut)]
|
8869 - | let mut http_request = http::Request::builder()
|
9362 + | let mut http_request = ::http_1x::Request::builder()
|
8870 9363 | .uri("/MalformedTimestampQueryDefault")
|
8871 9364 | .method("POST")
|
8872 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9365 + | .body(::aws_smithy_http_server::body::boxed(
|
9366 + | ::http_body_util::Empty::new(),
|
9367 + | ))
|
8873 9368 | .unwrap();
|
8874 9369 | *http_request.uri_mut() = "/MalformedTimestampQueryDefault?timestamp=19961219T163957"
|
8875 9370 | .parse()
|
8876 9371 | .unwrap();
|
8877 9372 | #[allow(unused_mut)]
|
8878 9373 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8879 9374 | let config = crate::service::RestJsonConfig::builder().build();
|
8880 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9375 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8881 9376 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
8882 9377 | let sender = sender.clone();
|
8883 9378 | async move {
|
8884 9379 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
8885 9380 | sender.send(()).await.expect("receiver dropped early");
|
8886 9381 | result
|
8887 9382 | }
|
8888 9383 | })
|
8889 9384 | .build_unchecked();
|
8890 9385 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8891 9386 | .await
|
8892 9387 | .expect("unable to make an HTTP request");
|
8893 9388 | ::pretty_assertions::assert_eq!(
|
8894 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9389 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8895 9390 | http_response.status()
|
8896 9391 | );
|
8897 9392 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8898 9393 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8899 9394 | http_response.headers(),
|
8900 9395 | expected_headers,
|
8901 9396 | ));
|
8902 9397 | }
|
8903 9398 | }
|
8904 9399 |
|
8905 9400 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
8906 9401 | /// are rejected with a 400 SerializationException
|
8907 9402 | /// Test ID: RestJsonQueryTimestampDefaultRejectsDifferent8601Formats_case6
|
8908 9403 | #[::tokio::test]
|
8909 9404 | #[::tracing_test::traced_test]
|
8910 9405 | async fn rest_json_query_timestamp_default_rejects_different8601_formats_case6_malformed_request(
|
8911 9406 | ) {
|
8912 9407 | {
|
8913 9408 | #[allow(unused_mut)]
|
8914 - | let mut http_request = http::Request::builder()
|
9409 + | let mut http_request = ::http_1x::Request::builder()
|
8915 9410 | .uri("/MalformedTimestampQueryDefault")
|
8916 9411 | .method("POST")
|
8917 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9412 + | .body(::aws_smithy_http_server::body::boxed(
|
9413 + | ::http_body_util::Empty::new(),
|
9414 + | ))
|
8918 9415 | .unwrap();
|
8919 9416 | *http_request.uri_mut() =
|
8920 9417 | "/MalformedTimestampQueryDefault?timestamp=19961219T16:39:57Z"
|
8921 9418 | .parse()
|
8922 9419 | .unwrap();
|
8923 9420 | #[allow(unused_mut)]
|
8924 9421 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8925 9422 | let config = crate::service::RestJsonConfig::builder().build();
|
8926 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9423 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8927 9424 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
8928 9425 | let sender = sender.clone();
|
8929 9426 | async move {
|
8930 9427 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
8931 9428 | sender.send(()).await.expect("receiver dropped early");
|
8932 9429 | result
|
8933 9430 | }
|
8934 9431 | })
|
8935 9432 | .build_unchecked();
|
8936 9433 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8937 9434 | .await
|
8938 9435 | .expect("unable to make an HTTP request");
|
8939 9436 | ::pretty_assertions::assert_eq!(
|
8940 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9437 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8941 9438 | http_response.status()
|
8942 9439 | );
|
8943 9440 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8944 9441 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8945 9442 | http_response.headers(),
|
8946 9443 | expected_headers,
|
8947 9444 | ));
|
8948 9445 | }
|
8949 9446 | }
|
8950 9447 |
|
8951 9448 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
8952 9449 | /// are rejected with a 400 SerializationException
|
8953 9450 | /// Test ID: RestJsonQueryTimestampDefaultRejectsDifferent8601Formats_case7
|
8954 9451 | #[::tokio::test]
|
8955 9452 | #[::tracing_test::traced_test]
|
8956 9453 | async fn rest_json_query_timestamp_default_rejects_different8601_formats_case7_malformed_request(
|
8957 9454 | ) {
|
8958 9455 | {
|
8959 9456 | #[allow(unused_mut)]
|
8960 - | let mut http_request = http::Request::builder()
|
9457 + | let mut http_request = ::http_1x::Request::builder()
|
8961 9458 | .uri("/MalformedTimestampQueryDefault")
|
8962 9459 | .method("POST")
|
8963 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9460 + | .body(::aws_smithy_http_server::body::boxed(
|
9461 + | ::http_body_util::Empty::new(),
|
9462 + | ))
|
8964 9463 | .unwrap();
|
8965 9464 | *http_request.uri_mut() = "/MalformedTimestampQueryDefault?timestamp=19961219T16:39:57"
|
8966 9465 | .parse()
|
8967 9466 | .unwrap();
|
8968 9467 | #[allow(unused_mut)]
|
8969 9468 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
8970 9469 | let config = crate::service::RestJsonConfig::builder().build();
|
8971 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9470 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
8972 9471 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
8973 9472 | let sender = sender.clone();
|
8974 9473 | async move {
|
8975 9474 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
8976 9475 | sender.send(()).await.expect("receiver dropped early");
|
8977 9476 | result
|
8978 9477 | }
|
8979 9478 | })
|
8980 9479 | .build_unchecked();
|
8981 9480 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
8982 9481 | .await
|
8983 9482 | .expect("unable to make an HTTP request");
|
8984 9483 | ::pretty_assertions::assert_eq!(
|
8985 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9484 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
8986 9485 | http_response.status()
|
8987 9486 | );
|
8988 9487 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
8989 9488 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
8990 9489 | http_response.headers(),
|
8991 9490 | expected_headers,
|
8992 9491 | ));
|
8993 9492 | }
|
8994 9493 | }
|
8995 9494 |
|
8996 9495 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
8997 9496 | /// are rejected with a 400 SerializationException
|
8998 9497 | /// Test ID: RestJsonQueryTimestampDefaultRejectsDifferent8601Formats_case8
|
8999 9498 | #[::tokio::test]
|
9000 9499 | #[::tracing_test::traced_test]
|
9001 9500 | async fn rest_json_query_timestamp_default_rejects_different8601_formats_case8_malformed_request(
|
9002 9501 | ) {
|
9003 9502 | {
|
9004 9503 | #[allow(unused_mut)]
|
9005 - | let mut http_request = http::Request::builder()
|
9504 + | let mut http_request = ::http_1x::Request::builder()
|
9006 9505 | .uri("/MalformedTimestampQueryDefault")
|
9007 9506 | .method("POST")
|
9008 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9507 + | .body(::aws_smithy_http_server::body::boxed(
|
9508 + | ::http_body_util::Empty::new(),
|
9509 + | ))
|
9009 9510 | .unwrap();
|
9010 9511 | *http_request.uri_mut() = "/MalformedTimestampQueryDefault?timestamp=1996-12-19T16:39Z"
|
9011 9512 | .parse()
|
9012 9513 | .unwrap();
|
9013 9514 | #[allow(unused_mut)]
|
9014 9515 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9015 9516 | let config = crate::service::RestJsonConfig::builder().build();
|
9016 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9517 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9017 9518 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
9018 9519 | let sender = sender.clone();
|
9019 9520 | async move {
|
9020 9521 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
9021 9522 | sender.send(()).await.expect("receiver dropped early");
|
9022 9523 | result
|
9023 9524 | }
|
9024 9525 | })
|
9025 9526 | .build_unchecked();
|
9026 9527 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9027 9528 | .await
|
9028 9529 | .expect("unable to make an HTTP request");
|
9029 9530 | ::pretty_assertions::assert_eq!(
|
9030 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9531 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9031 9532 | http_response.status()
|
9032 9533 | );
|
9033 9534 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9034 9535 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9035 9536 | http_response.headers(),
|
9036 9537 | expected_headers,
|
9037 9538 | ));
|
9038 9539 | }
|
9039 9540 | }
|
9040 9541 |
|
9041 9542 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
9042 9543 | /// are rejected with a 400 SerializationException
|
9043 9544 | /// Test ID: RestJsonQueryTimestampDefaultRejectsDifferent8601Formats_case9
|
9044 9545 | #[::tokio::test]
|
9045 9546 | #[::tracing_test::traced_test]
|
9046 9547 | async fn rest_json_query_timestamp_default_rejects_different8601_formats_case9_malformed_request(
|
9047 9548 | ) {
|
9048 9549 | {
|
9049 9550 | #[allow(unused_mut)]
|
9050 - | let mut http_request = http::Request::builder()
|
9551 + | let mut http_request = ::http_1x::Request::builder()
|
9051 9552 | .uri("/MalformedTimestampQueryDefault")
|
9052 9553 | .method("POST")
|
9053 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9554 + | .body(::aws_smithy_http_server::body::boxed(
|
9555 + | ::http_body_util::Empty::new(),
|
9556 + | ))
|
9054 9557 | .unwrap();
|
9055 9558 | *http_request.uri_mut() = "/MalformedTimestampQueryDefault?timestamp=1996-12-19T16:39"
|
9056 9559 | .parse()
|
9057 9560 | .unwrap();
|
9058 9561 | #[allow(unused_mut)]
|
9059 9562 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9060 9563 | let config = crate::service::RestJsonConfig::builder().build();
|
9061 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9564 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9062 9565 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
9063 9566 | let sender = sender.clone();
|
9064 9567 | async move {
|
9065 9568 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
9066 9569 | sender.send(()).await.expect("receiver dropped early");
|
9067 9570 | result
|
9068 9571 | }
|
9069 9572 | })
|
9070 9573 | .build_unchecked();
|
9071 9574 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9072 9575 | .await
|
9073 9576 | .expect("unable to make an HTTP request");
|
9074 9577 | ::pretty_assertions::assert_eq!(
|
9075 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9578 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9076 9579 | http_response.status()
|
9077 9580 | );
|
9078 9581 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9079 9582 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9080 9583 | http_response.headers(),
|
9081 9584 | expected_headers,
|
9082 9585 | ));
|
9083 9586 | }
|
9084 9587 | }
|
9085 9588 |
|
9086 9589 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
9087 9590 | /// are rejected with a 400 SerializationException
|
9088 9591 | /// Test ID: RestJsonQueryTimestampDefaultRejectsDifferent8601Formats_case10
|
9089 9592 | #[::tokio::test]
|
9090 9593 | #[::tracing_test::traced_test]
|
9091 9594 | async fn rest_json_query_timestamp_default_rejects_different8601_formats_case10_malformed_request(
|
9092 9595 | ) {
|
9093 9596 | {
|
9094 9597 | #[allow(unused_mut)]
|
9095 - | let mut http_request = http::Request::builder()
|
9598 + | let mut http_request = ::http_1x::Request::builder()
|
9096 9599 | .uri("/MalformedTimestampQueryDefault")
|
9097 9600 | .method("POST")
|
9098 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9601 + | .body(::aws_smithy_http_server::body::boxed(
|
9602 + | ::http_body_util::Empty::new(),
|
9603 + | ))
|
9099 9604 | .unwrap();
|
9100 9605 | *http_request.uri_mut() = "/MalformedTimestampQueryDefault?timestamp=1996-12-19T1639"
|
9101 9606 | .parse()
|
9102 9607 | .unwrap();
|
9103 9608 | #[allow(unused_mut)]
|
9104 9609 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9105 9610 | let config = crate::service::RestJsonConfig::builder().build();
|
9106 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9611 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9107 9612 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
9108 9613 | let sender = sender.clone();
|
9109 9614 | async move {
|
9110 9615 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
9111 9616 | sender.send(()).await.expect("receiver dropped early");
|
9112 9617 | result
|
9113 9618 | }
|
9114 9619 | })
|
9115 9620 | .build_unchecked();
|
9116 9621 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9117 9622 | .await
|
9118 9623 | .expect("unable to make an HTTP request");
|
9119 9624 | ::pretty_assertions::assert_eq!(
|
9120 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9625 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9121 9626 | http_response.status()
|
9122 9627 | );
|
9123 9628 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9124 9629 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9125 9630 | http_response.headers(),
|
9126 9631 | expected_headers,
|
9127 9632 | ));
|
9128 9633 | }
|
9129 9634 | }
|
9130 9635 |
|
9131 9636 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
9132 9637 | /// are rejected with a 400 SerializationException
|
9133 9638 | /// Test ID: RestJsonQueryTimestampDefaultRejectsDifferent8601Formats_case11
|
9134 9639 | #[::tokio::test]
|
9135 9640 | #[::tracing_test::traced_test]
|
9136 9641 | async fn rest_json_query_timestamp_default_rejects_different8601_formats_case11_malformed_request(
|
9137 9642 | ) {
|
9138 9643 | {
|
9139 9644 | #[allow(unused_mut)]
|
9140 - | let mut http_request = http::Request::builder()
|
9645 + | let mut http_request = ::http_1x::Request::builder()
|
9141 9646 | .uri("/MalformedTimestampQueryDefault")
|
9142 9647 | .method("POST")
|
9143 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9648 + | .body(::aws_smithy_http_server::body::boxed(
|
9649 + | ::http_body_util::Empty::new(),
|
9650 + | ))
|
9144 9651 | .unwrap();
|
9145 9652 | *http_request.uri_mut() = "/MalformedTimestampQueryDefault?timestamp=1996-12-19T16Z"
|
9146 9653 | .parse()
|
9147 9654 | .unwrap();
|
9148 9655 | #[allow(unused_mut)]
|
9149 9656 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9150 9657 | let config = crate::service::RestJsonConfig::builder().build();
|
9151 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9658 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9152 9659 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
9153 9660 | let sender = sender.clone();
|
9154 9661 | async move {
|
9155 9662 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
9156 9663 | sender.send(()).await.expect("receiver dropped early");
|
9157 9664 | result
|
9158 9665 | }
|
9159 9666 | })
|
9160 9667 | .build_unchecked();
|
9161 9668 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9162 9669 | .await
|
9163 9670 | .expect("unable to make an HTTP request");
|
9164 9671 | ::pretty_assertions::assert_eq!(
|
9165 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9672 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9166 9673 | http_response.status()
|
9167 9674 | );
|
9168 9675 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9169 9676 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9170 9677 | http_response.headers(),
|
9171 9678 | expected_headers,
|
9172 9679 | ));
|
9173 9680 | }
|
9174 9681 | }
|
9175 9682 |
|
9176 9683 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
9177 9684 | /// are rejected with a 400 SerializationException
|
9178 9685 | /// Test ID: RestJsonQueryTimestampDefaultRejectsDifferent8601Formats_case12
|
9179 9686 | #[::tokio::test]
|
9180 9687 | #[::tracing_test::traced_test]
|
9181 9688 | async fn rest_json_query_timestamp_default_rejects_different8601_formats_case12_malformed_request(
|
9182 9689 | ) {
|
9183 9690 | {
|
9184 9691 | #[allow(unused_mut)]
|
9185 - | let mut http_request = http::Request::builder()
|
9692 + | let mut http_request = ::http_1x::Request::builder()
|
9186 9693 | .uri("/MalformedTimestampQueryDefault")
|
9187 9694 | .method("POST")
|
9188 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9695 + | .body(::aws_smithy_http_server::body::boxed(
|
9696 + | ::http_body_util::Empty::new(),
|
9697 + | ))
|
9189 9698 | .unwrap();
|
9190 9699 | *http_request.uri_mut() = "/MalformedTimestampQueryDefault?timestamp=1996-12-19T16"
|
9191 9700 | .parse()
|
9192 9701 | .unwrap();
|
9193 9702 | #[allow(unused_mut)]
|
9194 9703 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9195 9704 | let config = crate::service::RestJsonConfig::builder().build();
|
9196 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9705 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9197 9706 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
9198 9707 | let sender = sender.clone();
|
9199 9708 | async move {
|
9200 9709 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
9201 9710 | sender.send(()).await.expect("receiver dropped early");
|
9202 9711 | result
|
9203 9712 | }
|
9204 9713 | })
|
9205 9714 | .build_unchecked();
|
9206 9715 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9207 9716 | .await
|
9208 9717 | .expect("unable to make an HTTP request");
|
9209 9718 | ::pretty_assertions::assert_eq!(
|
9210 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9719 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9211 9720 | http_response.status()
|
9212 9721 | );
|
9213 9722 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9214 9723 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9215 9724 | http_response.headers(),
|
9216 9725 | expected_headers,
|
9217 9726 | ));
|
9218 9727 | }
|
9219 9728 | }
|
9220 9729 |
|
9221 9730 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
9222 9731 | /// are rejected with a 400 SerializationException
|
9223 9732 | /// Test ID: RestJsonQueryTimestampDefaultRejectsDifferent8601Formats_case13
|
9224 9733 | #[::tokio::test]
|
9225 9734 | #[::tracing_test::traced_test]
|
9226 9735 | async fn rest_json_query_timestamp_default_rejects_different8601_formats_case13_malformed_request(
|
9227 9736 | ) {
|
9228 9737 | {
|
9229 9738 | #[allow(unused_mut)]
|
9230 - | let mut http_request = http::Request::builder()
|
9739 + | let mut http_request = ::http_1x::Request::builder()
|
9231 9740 | .uri("/MalformedTimestampQueryDefault")
|
9232 9741 | .method("POST")
|
9233 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9742 + | .body(::aws_smithy_http_server::body::boxed(
|
9743 + | ::http_body_util::Empty::new(),
|
9744 + | ))
|
9234 9745 | .unwrap();
|
9235 9746 | *http_request.uri_mut() =
|
9236 9747 | "/MalformedTimestampQueryDefault?timestamp=1996-12-19%2016:39:57Z"
|
9237 9748 | .parse()
|
9238 9749 | .unwrap();
|
9239 9750 | #[allow(unused_mut)]
|
9240 9751 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9241 9752 | let config = crate::service::RestJsonConfig::builder().build();
|
9242 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9753 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9243 9754 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
9244 9755 | let sender = sender.clone();
|
9245 9756 | async move {
|
9246 9757 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
9247 9758 | sender.send(()).await.expect("receiver dropped early");
|
9248 9759 | result
|
9249 9760 | }
|
9250 9761 | })
|
9251 9762 | .build_unchecked();
|
9252 9763 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9253 9764 | .await
|
9254 9765 | .expect("unable to make an HTTP request");
|
9255 9766 | ::pretty_assertions::assert_eq!(
|
9256 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9767 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9257 9768 | http_response.status()
|
9258 9769 | );
|
9259 9770 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9260 9771 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9261 9772 | http_response.headers(),
|
9262 9773 | expected_headers,
|
9263 9774 | ));
|
9264 9775 | }
|
9265 9776 | }
|
9266 9777 |
|
9267 9778 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
9268 9779 | /// are rejected with a 400 SerializationException
|
9269 9780 | /// Test ID: RestJsonQueryTimestampDefaultRejectsDifferent8601Formats_case14
|
9270 9781 | #[::tokio::test]
|
9271 9782 | #[::tracing_test::traced_test]
|
9272 9783 | async fn rest_json_query_timestamp_default_rejects_different8601_formats_case14_malformed_request(
|
9273 9784 | ) {
|
9274 9785 | {
|
9275 9786 | #[allow(unused_mut)]
|
9276 - | let mut http_request = http::Request::builder()
|
9787 + | let mut http_request = ::http_1x::Request::builder()
|
9277 9788 | .uri("/MalformedTimestampQueryDefault")
|
9278 9789 | .method("POST")
|
9279 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9790 + | .body(::aws_smithy_http_server::body::boxed(
|
9791 + | ::http_body_util::Empty::new(),
|
9792 + | ))
|
9280 9793 | .unwrap();
|
9281 9794 | *http_request.uri_mut() =
|
9282 9795 | "/MalformedTimestampQueryDefault?timestamp=2011-12-03T10:15:30+01:00[Europe/Paris]"
|
9283 9796 | .parse()
|
9284 9797 | .unwrap();
|
9285 9798 | #[allow(unused_mut)]
|
9286 9799 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9287 9800 | let config = crate::service::RestJsonConfig::builder().build();
|
9288 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9801 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9289 9802 | .malformed_timestamp_query_default(move |input: crate::input::MalformedTimestampQueryDefaultInput| {
|
9290 9803 | let sender = sender.clone();
|
9291 9804 | async move {
|
9292 9805 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampQueryDefaultOutput, crate::error::MalformedTimestampQueryDefaultError> };
|
9293 9806 | sender.send(()).await.expect("receiver dropped early");
|
9294 9807 | result
|
9295 9808 | }
|
9296 9809 | })
|
9297 9810 | .build_unchecked();
|
9298 9811 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9299 9812 | .await
|
9300 9813 | .expect("unable to make an HTTP request");
|
9301 9814 | ::pretty_assertions::assert_eq!(
|
9302 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9815 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9303 9816 | http_response.status()
|
9304 9817 | );
|
9305 9818 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9306 9819 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9307 9820 | http_response.headers(),
|
9308 9821 | expected_headers,
|
9309 9822 | ));
|
9310 9823 | }
|
9311 9824 | }
|
9825 + |
|
9826 + | /* ProtocolTestGenerator.kt:98 */
|
9312 9827 | }
|
9313 9828 |
|
9829 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
9314 9830 | ::pin_project_lite::pin_project! {
|
9315 9831 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
9316 9832 | /// [`MalformedTimestampPathEpochInput`](crate::input::MalformedTimestampPathEpochInput) using modelled bindings.
|
9317 9833 | pub struct MalformedTimestampPathEpochInputFuture {
|
9318 9834 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedTimestampPathEpochInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
9319 9835 | }
|
9320 9836 | }
|
9321 9837 |
|
9322 9838 | impl std::future::Future for MalformedTimestampPathEpochInputFuture {
|
9323 9839 | type Output = Result<
|
9324 9840 | crate::input::MalformedTimestampPathEpochInput,
|
9325 9841 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
9326 9842 | >;
|
9327 9843 |
|
9328 9844 | fn poll(
|
9329 9845 | self: std::pin::Pin<&mut Self>,
|
9330 9846 | cx: &mut std::task::Context<'_>,
|
9331 9847 | ) -> std::task::Poll<Self::Output> {
|
9332 9848 | let this = self.project();
|
9333 9849 | this.inner.as_mut().poll(cx)
|
9334 9850 | }
|
9335 9851 | }
|
9336 9852 |
|
9337 9853 | impl<B>
|
9338 9854 | ::aws_smithy_http_server::request::FromRequest<
|
9339 9855 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
9340 9856 | B,
|
9341 9857 | > for crate::input::MalformedTimestampPathEpochInput
|
9342 9858 | where
|
9343 9859 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
9344 9860 | B: 'static,
|
9345 9861 |
|
9346 9862 | B::Data: Send,
|
9347 9863 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
9348 9864 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
9349 9865 | {
|
9350 9866 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
9351 9867 | type Future = MalformedTimestampPathEpochInputFuture;
|
9352 9868 |
|
9353 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
9869 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
9354 9870 | let fut = async move {
|
9355 9871 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
9356 9872 | request.headers(),
|
9357 9873 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
9358 9874 | ) {
|
9359 9875 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
9360 9876 | }
|
9361 9877 | crate::protocol_serde::shape_malformed_timestamp_path_epoch::de_malformed_timestamp_path_epoch_http_request(request)
|
9362 9878 | .await
|
9363 9879 | };
|
9364 9880 | use ::futures_util::future::TryFutureExt;
|
9365 9881 | let fut = fut.map_err(
|
9366 9882 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
9367 9883 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
9368 9884 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
9369 9885 | e,
|
9370 9886 | )
|
9371 9887 | },
|
9372 9888 | );
|
9373 9889 | MalformedTimestampPathEpochInputFuture {
|
9374 9890 | inner: Box::pin(fut),
|
9375 9891 | }
|
9376 9892 | }
|
9377 9893 | }
|
9894 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
9378 9895 | impl
|
9379 9896 | ::aws_smithy_http_server::response::IntoResponse<
|
9380 9897 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
9381 9898 | > for crate::output::MalformedTimestampPathEpochOutput
|
9382 9899 | {
|
9383 9900 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
9384 9901 | match crate::protocol_serde::shape_malformed_timestamp_path_epoch::ser_malformed_timestamp_path_epoch_http_response(self) {
|
9385 9902 | Ok(response) => response,
|
9386 9903 | Err(e) => {
|
9387 9904 | ::tracing::error!(error = %e, "failed to serialize response");
|
9388 9905 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
9389 9906 | }
|
9390 9907 | }
|
9391 9908 | }
|
9392 9909 | }
|
9910 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
9393 9911 | impl
|
9394 9912 | ::aws_smithy_http_server::response::IntoResponse<
|
9395 9913 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
9396 9914 | > for crate::error::MalformedTimestampPathEpochError
|
9397 9915 | {
|
9398 9916 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
9399 9917 | match crate::protocol_serde::shape_malformed_timestamp_path_epoch::ser_malformed_timestamp_path_epoch_http_error(&self) {
|
9400 9918 | Ok(mut response) => {
|
9401 9919 | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
9402 9920 | response
|
9403 9921 | },
|
9404 9922 | Err(e) => {
|
9405 9923 | ::tracing::error!(error = %e, "failed to serialize response");
|
9406 9924 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
9407 9925 | }
|
9408 9926 | }
|
9409 9927 | }
|
9410 9928 | }
|
9411 9929 |
|
9930 + | /* RustType.kt:534 */
|
9412 9931 | #[allow(unreachable_code, unused_variables)]
|
9932 + | /* RustType.kt:534 */
|
9413 9933 | #[cfg(test)]
|
9934 + | /* ProtocolTestGenerator.kt:98 */
|
9414 9935 | mod malformed_timestamp_path_epoch_test {
|
9415 9936 |
|
9416 9937 | /// When the format is epoch-seconds, RFC3339 timestamps are rejected with a
|
9417 9938 | /// 400 SerializationException
|
9418 9939 | /// Test ID: RestJsonPathTimestampEpochRejectsDateTime_case0
|
9419 9940 | #[::tokio::test]
|
9420 9941 | #[::tracing_test::traced_test]
|
9421 9942 | async fn rest_json_path_timestamp_epoch_rejects_date_time_case0_malformed_request() {
|
9422 9943 | {
|
9423 9944 | #[allow(unused_mut)]
|
9424 - | let mut http_request = http::Request::builder()
|
9945 + | let mut http_request = ::http_1x::Request::builder()
|
9425 9946 | .uri("/MalformedTimestampPathEpoch/1985-04-12T23%3A20%3A50.52Z")
|
9426 9947 | .method("POST")
|
9427 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9948 + | .body(::aws_smithy_http_server::body::boxed(
|
9949 + | ::http_body_util::Empty::new(),
|
9950 + | ))
|
9428 9951 | .unwrap();
|
9429 9952 | #[allow(unused_mut)]
|
9430 9953 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9431 9954 | let config = crate::service::RestJsonConfig::builder().build();
|
9432 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9955 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9433 9956 | .malformed_timestamp_path_epoch(move |input: crate::input::MalformedTimestampPathEpochInput| {
|
9434 9957 | let sender = sender.clone();
|
9435 9958 | async move {
|
9436 9959 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathEpochOutput, crate::error::MalformedTimestampPathEpochError> };
|
9437 9960 | sender.send(()).await.expect("receiver dropped early");
|
9438 9961 | result
|
9439 9962 | }
|
9440 9963 | })
|
9441 9964 | .build_unchecked();
|
9442 9965 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9443 9966 | .await
|
9444 9967 | .expect("unable to make an HTTP request");
|
9445 9968 | ::pretty_assertions::assert_eq!(
|
9446 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9969 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9447 9970 | http_response.status()
|
9448 9971 | );
|
9449 9972 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9450 9973 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9451 9974 | http_response.headers(),
|
9452 9975 | expected_headers,
|
9453 9976 | ));
|
9454 9977 | }
|
9455 9978 | }
|
9456 9979 |
|
9457 9980 | /// When the format is epoch-seconds, RFC3339 timestamps are rejected with a
|
9458 9981 | /// 400 SerializationException
|
9459 9982 | /// Test ID: RestJsonPathTimestampEpochRejectsDateTime_case1
|
9460 9983 | #[::tokio::test]
|
9461 9984 | #[::tracing_test::traced_test]
|
9462 9985 | async fn rest_json_path_timestamp_epoch_rejects_date_time_case1_malformed_request() {
|
9463 9986 | {
|
9464 9987 | #[allow(unused_mut)]
|
9465 - | let mut http_request = http::Request::builder()
|
9988 + | let mut http_request = ::http_1x::Request::builder()
|
9466 9989 | .uri("/MalformedTimestampPathEpoch/1985-04-12T23%3A20%3A50Z")
|
9467 9990 | .method("POST")
|
9468 - | .body(::aws_smithy_http_server::body::Body::empty())
|
9991 + | .body(::aws_smithy_http_server::body::boxed(
|
9992 + | ::http_body_util::Empty::new(),
|
9993 + | ))
|
9469 9994 | .unwrap();
|
9470 9995 | #[allow(unused_mut)]
|
9471 9996 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9472 9997 | let config = crate::service::RestJsonConfig::builder().build();
|
9473 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
9998 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9474 9999 | .malformed_timestamp_path_epoch(move |input: crate::input::MalformedTimestampPathEpochInput| {
|
9475 10000 | let sender = sender.clone();
|
9476 10001 | async move {
|
9477 10002 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathEpochOutput, crate::error::MalformedTimestampPathEpochError> };
|
9478 10003 | sender.send(()).await.expect("receiver dropped early");
|
9479 10004 | result
|
9480 10005 | }
|
9481 10006 | })
|
9482 10007 | .build_unchecked();
|
9483 10008 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9484 10009 | .await
|
9485 10010 | .expect("unable to make an HTTP request");
|
9486 10011 | ::pretty_assertions::assert_eq!(
|
9487 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10012 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9488 10013 | http_response.status()
|
9489 10014 | );
|
9490 10015 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9491 10016 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9492 10017 | http_response.headers(),
|
9493 10018 | expected_headers,
|
9494 10019 | ));
|
9495 10020 | }
|
9496 10021 | }
|
9497 10022 |
|
9498 10023 | /// When the format is epoch-seconds, RFC3339 timestamps are rejected with a
|
9499 10024 | /// 400 SerializationException
|
9500 10025 | /// Test ID: RestJsonPathTimestampEpochRejectsDateTime_case2
|
9501 10026 | #[::tokio::test]
|
9502 10027 | #[::tracing_test::traced_test]
|
9503 10028 | async fn rest_json_path_timestamp_epoch_rejects_date_time_case2_malformed_request() {
|
9504 10029 | {
|
9505 10030 | #[allow(unused_mut)]
|
9506 - | let mut http_request = http::Request::builder()
|
10031 + | let mut http_request = ::http_1x::Request::builder()
|
9507 10032 | .uri("/MalformedTimestampPathEpoch/1996-12-19T16%3A39%3A57-08%3A00")
|
9508 10033 | .method("POST")
|
9509 - | .body(::aws_smithy_http_server::body::Body::empty())
|
10034 + | .body(::aws_smithy_http_server::body::boxed(
|
10035 + | ::http_body_util::Empty::new(),
|
10036 + | ))
|
9510 10037 | .unwrap();
|
9511 10038 | #[allow(unused_mut)]
|
9512 10039 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9513 10040 | let config = crate::service::RestJsonConfig::builder().build();
|
9514 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10041 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9515 10042 | .malformed_timestamp_path_epoch(move |input: crate::input::MalformedTimestampPathEpochInput| {
|
9516 10043 | let sender = sender.clone();
|
9517 10044 | async move {
|
9518 10045 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathEpochOutput, crate::error::MalformedTimestampPathEpochError> };
|
9519 10046 | sender.send(()).await.expect("receiver dropped early");
|
9520 10047 | result
|
9521 10048 | }
|
9522 10049 | })
|
9523 10050 | .build_unchecked();
|
9524 10051 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9525 10052 | .await
|
9526 10053 | .expect("unable to make an HTTP request");
|
9527 10054 | ::pretty_assertions::assert_eq!(
|
9528 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10055 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9529 10056 | http_response.status()
|
9530 10057 | );
|
9531 10058 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9532 10059 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9533 10060 | http_response.headers(),
|
9534 10061 | expected_headers,
|
9535 10062 | ));
|
9536 10063 | }
|
9537 10064 | }
|
9538 10065 |
|
9539 10066 | /// When the format is epoch-seconds, IMF-fixdate timestamps are rejected with a
|
9540 10067 | /// 400 SerializationException
|
9541 10068 | /// Test ID: RestJsonPathTimestampEpochRejectsHttpDate_case0
|
9542 10069 | #[::tokio::test]
|
9543 10070 | #[::tracing_test::traced_test]
|
9544 10071 | async fn rest_json_path_timestamp_epoch_rejects_http_date_case0_malformed_request() {
|
9545 10072 | {
|
9546 10073 | #[allow(unused_mut)]
|
9547 - | let mut http_request = http::Request::builder()
|
10074 + | let mut http_request = ::http_1x::Request::builder()
|
9548 10075 | .uri("/MalformedTimestampPathEpoch/Tue%2C%2029%20Apr%202014%2018%3A30%3A38%20GMT")
|
9549 10076 | .method("POST")
|
9550 - | .body(::aws_smithy_http_server::body::Body::empty())
|
10077 + | .body(::aws_smithy_http_server::body::boxed(
|
10078 + | ::http_body_util::Empty::new(),
|
10079 + | ))
|
9551 10080 | .unwrap();
|
9552 10081 | #[allow(unused_mut)]
|
9553 10082 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9554 10083 | let config = crate::service::RestJsonConfig::builder().build();
|
9555 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10084 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9556 10085 | .malformed_timestamp_path_epoch(move |input: crate::input::MalformedTimestampPathEpochInput| {
|
9557 10086 | let sender = sender.clone();
|
9558 10087 | async move {
|
9559 10088 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathEpochOutput, crate::error::MalformedTimestampPathEpochError> };
|
9560 10089 | sender.send(()).await.expect("receiver dropped early");
|
9561 10090 | result
|
9562 10091 | }
|
9563 10092 | })
|
9564 10093 | .build_unchecked();
|
9565 10094 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9566 10095 | .await
|
9567 10096 | .expect("unable to make an HTTP request");
|
9568 10097 | ::pretty_assertions::assert_eq!(
|
9569 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10098 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9570 10099 | http_response.status()
|
9571 10100 | );
|
9572 10101 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9573 10102 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9574 10103 | http_response.headers(),
|
9575 10104 | expected_headers,
|
9576 10105 | ));
|
9577 10106 | }
|
9578 10107 | }
|
9579 10108 |
|
9580 10109 | /// When the format is epoch-seconds, IMF-fixdate timestamps are rejected with a
|
9581 10110 | /// 400 SerializationException
|
9582 10111 | /// Test ID: RestJsonPathTimestampEpochRejectsHttpDate_case1
|
9583 10112 | #[::tokio::test]
|
9584 10113 | #[::tracing_test::traced_test]
|
9585 10114 | async fn rest_json_path_timestamp_epoch_rejects_http_date_case1_malformed_request() {
|
9586 10115 | {
|
9587 10116 | #[allow(unused_mut)]
|
9588 - | let mut http_request = http::Request::builder()
|
10117 + | let mut http_request = ::http_1x::Request::builder()
|
9589 10118 | .uri("/MalformedTimestampPathEpoch/Sun%2C%2002%20Jan%202000%2020%3A34%3A56.000%20GMT")
|
9590 10119 | .method("POST")
|
9591 - | .body(::aws_smithy_http_server::body::Body::empty()).unwrap();
|
10120 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Empty::new())).unwrap();
|
9592 10121 | #[allow(unused_mut)]
|
9593 10122 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9594 10123 | let config = crate::service::RestJsonConfig::builder().build();
|
9595 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10124 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9596 10125 | .malformed_timestamp_path_epoch(move |input: crate::input::MalformedTimestampPathEpochInput| {
|
9597 10126 | let sender = sender.clone();
|
9598 10127 | async move {
|
9599 10128 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathEpochOutput, crate::error::MalformedTimestampPathEpochError> };
|
9600 10129 | sender.send(()).await.expect("receiver dropped early");
|
9601 10130 | result
|
9602 10131 | }
|
9603 10132 | })
|
9604 10133 | .build_unchecked();
|
9605 10134 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9606 10135 | .await
|
9607 10136 | .expect("unable to make an HTTP request");
|
9608 10137 | ::pretty_assertions::assert_eq!(
|
9609 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10138 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9610 10139 | http_response.status()
|
9611 10140 | );
|
9612 10141 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9613 10142 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9614 10143 | http_response.headers(),
|
9615 10144 | expected_headers,
|
9616 10145 | ));
|
9617 10146 | }
|
9618 10147 | }
|
9619 10148 |
|
9620 10149 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
9621 10150 | /// Test ID: RestJsonPathTimestampEpochRejectsMalformedValues_case0
|
9622 10151 | #[::tokio::test]
|
9623 10152 | #[::tracing_test::traced_test]
|
9624 10153 | async fn rest_json_path_timestamp_epoch_rejects_malformed_values_case0_malformed_request() {
|
9625 10154 | {
|
9626 10155 | #[allow(unused_mut)]
|
9627 - | let mut http_request = http::Request::builder()
|
10156 + | let mut http_request = ::http_1x::Request::builder()
|
9628 10157 | .uri("/MalformedTimestampPathEpoch/true")
|
9629 10158 | .method("POST")
|
9630 - | .body(::aws_smithy_http_server::body::Body::empty())
|
10159 + | .body(::aws_smithy_http_server::body::boxed(
|
10160 + | ::http_body_util::Empty::new(),
|
10161 + | ))
|
9631 10162 | .unwrap();
|
9632 10163 | #[allow(unused_mut)]
|
9633 10164 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9634 10165 | let config = crate::service::RestJsonConfig::builder().build();
|
9635 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10166 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9636 10167 | .malformed_timestamp_path_epoch(move |input: crate::input::MalformedTimestampPathEpochInput| {
|
9637 10168 | let sender = sender.clone();
|
9638 10169 | async move {
|
9639 10170 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathEpochOutput, crate::error::MalformedTimestampPathEpochError> };
|
9640 10171 | sender.send(()).await.expect("receiver dropped early");
|
9641 10172 | result
|
9642 10173 | }
|
9643 10174 | })
|
9644 10175 | .build_unchecked();
|
9645 10176 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9646 10177 | .await
|
9647 10178 | .expect("unable to make an HTTP request");
|
9648 10179 | ::pretty_assertions::assert_eq!(
|
9649 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10180 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9650 10181 | http_response.status()
|
9651 10182 | );
|
9652 10183 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9653 10184 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9654 10185 | http_response.headers(),
|
9655 10186 | expected_headers,
|
9656 10187 | ));
|
9657 10188 | }
|
9658 10189 | }
|
9659 10190 |
|
9660 10191 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
9661 10192 | /// Test ID: RestJsonPathTimestampEpochRejectsMalformedValues_case1
|
9662 10193 | #[::tokio::test]
|
9663 10194 | #[::tracing_test::traced_test]
|
9664 10195 | async fn rest_json_path_timestamp_epoch_rejects_malformed_values_case1_malformed_request() {
|
9665 10196 | {
|
9666 10197 | #[allow(unused_mut)]
|
9667 - | let mut http_request = http::Request::builder()
|
10198 + | let mut http_request = ::http_1x::Request::builder()
|
9668 10199 | .uri("/MalformedTimestampPathEpoch/1515531081ABC")
|
9669 10200 | .method("POST")
|
9670 - | .body(::aws_smithy_http_server::body::Body::empty())
|
10201 + | .body(::aws_smithy_http_server::body::boxed(
|
10202 + | ::http_body_util::Empty::new(),
|
10203 + | ))
|
9671 10204 | .unwrap();
|
9672 10205 | #[allow(unused_mut)]
|
9673 10206 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9674 10207 | let config = crate::service::RestJsonConfig::builder().build();
|
9675 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10208 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9676 10209 | .malformed_timestamp_path_epoch(move |input: crate::input::MalformedTimestampPathEpochInput| {
|
9677 10210 | let sender = sender.clone();
|
9678 10211 | async move {
|
9679 10212 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathEpochOutput, crate::error::MalformedTimestampPathEpochError> };
|
9680 10213 | sender.send(()).await.expect("receiver dropped early");
|
9681 10214 | result
|
9682 10215 | }
|
9683 10216 | })
|
9684 10217 | .build_unchecked();
|
9685 10218 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9686 10219 | .await
|
9687 10220 | .expect("unable to make an HTTP request");
|
9688 10221 | ::pretty_assertions::assert_eq!(
|
9689 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10222 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9690 10223 | http_response.status()
|
9691 10224 | );
|
9692 10225 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9693 10226 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9694 10227 | http_response.headers(),
|
9695 10228 | expected_headers,
|
9696 10229 | ));
|
9697 10230 | }
|
9698 10231 | }
|
9699 10232 |
|
9700 10233 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
9701 10234 | /// Test ID: RestJsonPathTimestampEpochRejectsMalformedValues_case2
|
9702 10235 | #[::tokio::test]
|
9703 10236 | #[::tracing_test::traced_test]
|
9704 10237 | async fn rest_json_path_timestamp_epoch_rejects_malformed_values_case2_malformed_request() {
|
9705 10238 | {
|
9706 10239 | #[allow(unused_mut)]
|
9707 - | let mut http_request = http::Request::builder()
|
10240 + | let mut http_request = ::http_1x::Request::builder()
|
9708 10241 | .uri("/MalformedTimestampPathEpoch/0x42")
|
9709 10242 | .method("POST")
|
9710 - | .body(::aws_smithy_http_server::body::Body::empty())
|
10243 + | .body(::aws_smithy_http_server::body::boxed(
|
10244 + | ::http_body_util::Empty::new(),
|
10245 + | ))
|
9711 10246 | .unwrap();
|
9712 10247 | #[allow(unused_mut)]
|
9713 10248 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9714 10249 | let config = crate::service::RestJsonConfig::builder().build();
|
9715 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10250 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9716 10251 | .malformed_timestamp_path_epoch(move |input: crate::input::MalformedTimestampPathEpochInput| {
|
9717 10252 | let sender = sender.clone();
|
9718 10253 | async move {
|
9719 10254 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathEpochOutput, crate::error::MalformedTimestampPathEpochError> };
|
9720 10255 | sender.send(()).await.expect("receiver dropped early");
|
9721 10256 | result
|
9722 10257 | }
|
9723 10258 | })
|
9724 10259 | .build_unchecked();
|
9725 10260 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9726 10261 | .await
|
9727 10262 | .expect("unable to make an HTTP request");
|
9728 10263 | ::pretty_assertions::assert_eq!(
|
9729 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10264 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9730 10265 | http_response.status()
|
9731 10266 | );
|
9732 10267 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9733 10268 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9734 10269 | http_response.headers(),
|
9735 10270 | expected_headers,
|
9736 10271 | ));
|
9737 10272 | }
|
9738 10273 | }
|
9739 10274 |
|
9740 10275 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
9741 10276 | /// Test ID: RestJsonPathTimestampEpochRejectsMalformedValues_case3
|
9742 10277 | #[::tokio::test]
|
9743 10278 | #[::tracing_test::traced_test]
|
9744 10279 | async fn rest_json_path_timestamp_epoch_rejects_malformed_values_case3_malformed_request() {
|
9745 10280 | {
|
9746 10281 | #[allow(unused_mut)]
|
9747 - | let mut http_request = http::Request::builder()
|
10282 + | let mut http_request = ::http_1x::Request::builder()
|
9748 10283 | .uri("/MalformedTimestampPathEpoch/1515531081.123.456")
|
9749 10284 | .method("POST")
|
9750 - | .body(::aws_smithy_http_server::body::Body::empty())
|
10285 + | .body(::aws_smithy_http_server::body::boxed(
|
10286 + | ::http_body_util::Empty::new(),
|
10287 + | ))
|
9751 10288 | .unwrap();
|
9752 10289 | #[allow(unused_mut)]
|
9753 10290 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9754 10291 | let config = crate::service::RestJsonConfig::builder().build();
|
9755 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10292 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9756 10293 | .malformed_timestamp_path_epoch(move |input: crate::input::MalformedTimestampPathEpochInput| {
|
9757 10294 | let sender = sender.clone();
|
9758 10295 | async move {
|
9759 10296 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathEpochOutput, crate::error::MalformedTimestampPathEpochError> };
|
9760 10297 | sender.send(()).await.expect("receiver dropped early");
|
9761 10298 | result
|
9762 10299 | }
|
9763 10300 | })
|
9764 10301 | .build_unchecked();
|
9765 10302 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9766 10303 | .await
|
9767 10304 | .expect("unable to make an HTTP request");
|
9768 10305 | ::pretty_assertions::assert_eq!(
|
9769 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10306 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9770 10307 | http_response.status()
|
9771 10308 | );
|
9772 10309 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9773 10310 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9774 10311 | http_response.headers(),
|
9775 10312 | expected_headers,
|
9776 10313 | ));
|
9777 10314 | }
|
9778 10315 | }
|
9779 10316 |
|
9780 10317 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
9781 10318 | /// Test ID: RestJsonPathTimestampEpochRejectsMalformedValues_case4
|
9782 10319 | #[::tokio::test]
|
9783 10320 | #[::tracing_test::traced_test]
|
9784 10321 | async fn rest_json_path_timestamp_epoch_rejects_malformed_values_case4_malformed_request() {
|
9785 10322 | {
|
9786 10323 | #[allow(unused_mut)]
|
9787 - | let mut http_request = http::Request::builder()
|
10324 + | let mut http_request = ::http_1x::Request::builder()
|
9788 10325 | .uri("/MalformedTimestampPathEpoch/Infinity")
|
9789 10326 | .method("POST")
|
9790 - | .body(::aws_smithy_http_server::body::Body::empty())
|
10327 + | .body(::aws_smithy_http_server::body::boxed(
|
10328 + | ::http_body_util::Empty::new(),
|
10329 + | ))
|
9791 10330 | .unwrap();
|
9792 10331 | #[allow(unused_mut)]
|
9793 10332 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9794 10333 | let config = crate::service::RestJsonConfig::builder().build();
|
9795 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10334 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9796 10335 | .malformed_timestamp_path_epoch(move |input: crate::input::MalformedTimestampPathEpochInput| {
|
9797 10336 | let sender = sender.clone();
|
9798 10337 | async move {
|
9799 10338 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathEpochOutput, crate::error::MalformedTimestampPathEpochError> };
|
9800 10339 | sender.send(()).await.expect("receiver dropped early");
|
9801 10340 | result
|
9802 10341 | }
|
9803 10342 | })
|
9804 10343 | .build_unchecked();
|
9805 10344 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9806 10345 | .await
|
9807 10346 | .expect("unable to make an HTTP request");
|
9808 10347 | ::pretty_assertions::assert_eq!(
|
9809 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10348 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9810 10349 | http_response.status()
|
9811 10350 | );
|
9812 10351 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9813 10352 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9814 10353 | http_response.headers(),
|
9815 10354 | expected_headers,
|
9816 10355 | ));
|
9817 10356 | }
|
9818 10357 | }
|
9819 10358 |
|
9820 10359 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
9821 10360 | /// Test ID: RestJsonPathTimestampEpochRejectsMalformedValues_case5
|
9822 10361 | #[::tokio::test]
|
9823 10362 | #[::tracing_test::traced_test]
|
9824 10363 | async fn rest_json_path_timestamp_epoch_rejects_malformed_values_case5_malformed_request() {
|
9825 10364 | {
|
9826 10365 | #[allow(unused_mut)]
|
9827 - | let mut http_request = http::Request::builder()
|
10366 + | let mut http_request = ::http_1x::Request::builder()
|
9828 10367 | .uri("/MalformedTimestampPathEpoch/-Infinity")
|
9829 10368 | .method("POST")
|
9830 - | .body(::aws_smithy_http_server::body::Body::empty())
|
10369 + | .body(::aws_smithy_http_server::body::boxed(
|
10370 + | ::http_body_util::Empty::new(),
|
10371 + | ))
|
9831 10372 | .unwrap();
|
9832 10373 | #[allow(unused_mut)]
|
9833 10374 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9834 10375 | let config = crate::service::RestJsonConfig::builder().build();
|
9835 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10376 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9836 10377 | .malformed_timestamp_path_epoch(move |input: crate::input::MalformedTimestampPathEpochInput| {
|
9837 10378 | let sender = sender.clone();
|
9838 10379 | async move {
|
9839 10380 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathEpochOutput, crate::error::MalformedTimestampPathEpochError> };
|
9840 10381 | sender.send(()).await.expect("receiver dropped early");
|
9841 10382 | result
|
9842 10383 | }
|
9843 10384 | })
|
9844 10385 | .build_unchecked();
|
9845 10386 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9846 10387 | .await
|
9847 10388 | .expect("unable to make an HTTP request");
|
9848 10389 | ::pretty_assertions::assert_eq!(
|
9849 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10390 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9850 10391 | http_response.status()
|
9851 10392 | );
|
9852 10393 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9853 10394 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9854 10395 | http_response.headers(),
|
9855 10396 | expected_headers,
|
9856 10397 | ));
|
9857 10398 | }
|
9858 10399 | }
|
9859 10400 |
|
9860 10401 | /// Invalid values for epoch seconds are rejected with a 400 SerializationException
|
9861 10402 | /// Test ID: RestJsonPathTimestampEpochRejectsMalformedValues_case6
|
9862 10403 | #[::tokio::test]
|
9863 10404 | #[::tracing_test::traced_test]
|
9864 10405 | async fn rest_json_path_timestamp_epoch_rejects_malformed_values_case6_malformed_request() {
|
9865 10406 | {
|
9866 10407 | #[allow(unused_mut)]
|
9867 - | let mut http_request = http::Request::builder()
|
10408 + | let mut http_request = ::http_1x::Request::builder()
|
9868 10409 | .uri("/MalformedTimestampPathEpoch/NaN")
|
9869 10410 | .method("POST")
|
9870 - | .body(::aws_smithy_http_server::body::Body::empty())
|
10411 + | .body(::aws_smithy_http_server::body::boxed(
|
10412 + | ::http_body_util::Empty::new(),
|
10413 + | ))
|
9871 10414 | .unwrap();
|
9872 10415 | #[allow(unused_mut)]
|
9873 10416 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
9874 10417 | let config = crate::service::RestJsonConfig::builder().build();
|
9875 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10418 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
9876 10419 | .malformed_timestamp_path_epoch(move |input: crate::input::MalformedTimestampPathEpochInput| {
|
9877 10420 | let sender = sender.clone();
|
9878 10421 | async move {
|
9879 10422 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathEpochOutput, crate::error::MalformedTimestampPathEpochError> };
|
9880 10423 | sender.send(()).await.expect("receiver dropped early");
|
9881 10424 | result
|
9882 10425 | }
|
9883 10426 | })
|
9884 10427 | .build_unchecked();
|
9885 10428 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
9886 10429 | .await
|
9887 10430 | .expect("unable to make an HTTP request");
|
9888 10431 | ::pretty_assertions::assert_eq!(
|
9889 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10432 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
9890 10433 | http_response.status()
|
9891 10434 | );
|
9892 10435 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
9893 10436 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
9894 10437 | http_response.headers(),
|
9895 10438 | expected_headers,
|
9896 10439 | ));
|
9897 10440 | }
|
9898 10441 | }
|
10442 + |
|
10443 + | /* ProtocolTestGenerator.kt:98 */
|
9899 10444 | }
|
9900 10445 |
|
10446 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
9901 10447 | ::pin_project_lite::pin_project! {
|
9902 10448 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
9903 10449 | /// [`MalformedTimestampPathHttpDateInput`](crate::input::MalformedTimestampPathHttpDateInput) using modelled bindings.
|
9904 10450 | pub struct MalformedTimestampPathHttpDateInputFuture {
|
9905 10451 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedTimestampPathHttpDateInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
9906 10452 | }
|
9907 10453 | }
|
9908 10454 |
|
9909 10455 | impl std::future::Future for MalformedTimestampPathHttpDateInputFuture {
|
9910 10456 | type Output = Result<
|
9911 10457 | crate::input::MalformedTimestampPathHttpDateInput,
|
9912 10458 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
9913 10459 | >;
|
9914 10460 |
|
9915 10461 | fn poll(
|
9916 10462 | self: std::pin::Pin<&mut Self>,
|
9917 10463 | cx: &mut std::task::Context<'_>,
|
9918 10464 | ) -> std::task::Poll<Self::Output> {
|
9919 10465 | let this = self.project();
|
9920 10466 | this.inner.as_mut().poll(cx)
|
9921 10467 | }
|
9922 10468 | }
|
9923 10469 |
|
9924 10470 | impl<B>
|
9925 10471 | ::aws_smithy_http_server::request::FromRequest<
|
9926 10472 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
9927 10473 | B,
|
9928 10474 | > for crate::input::MalformedTimestampPathHttpDateInput
|
9929 10475 | where
|
9930 10476 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
9931 10477 | B: 'static,
|
9932 10478 |
|
9933 10479 | B::Data: Send,
|
9934 10480 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
9935 10481 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
9936 10482 | {
|
9937 10483 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
9938 10484 | type Future = MalformedTimestampPathHttpDateInputFuture;
|
9939 10485 |
|
9940 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
10486 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
9941 10487 | let fut = async move {
|
9942 10488 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
9943 10489 | request.headers(),
|
9944 10490 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
9945 10491 | ) {
|
9946 10492 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
9947 10493 | }
|
9948 10494 | crate::protocol_serde::shape_malformed_timestamp_path_http_date::de_malformed_timestamp_path_http_date_http_request(request)
|
9949 10495 | .await
|
9950 10496 | };
|
9951 10497 | use ::futures_util::future::TryFutureExt;
|
9952 10498 | let fut = fut.map_err(
|
9953 10499 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
9954 10500 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
9955 10501 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
9956 10502 | e,
|
9957 10503 | )
|
9958 10504 | },
|
9959 10505 | );
|
9960 10506 | MalformedTimestampPathHttpDateInputFuture {
|
9961 10507 | inner: Box::pin(fut),
|
9962 10508 | }
|
9963 10509 | }
|
9964 10510 | }
|
10511 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
9965 10512 | impl
|
9966 10513 | ::aws_smithy_http_server::response::IntoResponse<
|
9967 10514 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
9968 10515 | > for crate::output::MalformedTimestampPathHttpDateOutput
|
9969 10516 | {
|
9970 10517 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
9971 10518 | match crate::protocol_serde::shape_malformed_timestamp_path_http_date::ser_malformed_timestamp_path_http_date_http_response(self) {
|
9972 10519 | Ok(response) => response,
|
9973 10520 | Err(e) => {
|
9974 10521 | ::tracing::error!(error = %e, "failed to serialize response");
|
9975 10522 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
9976 10523 | }
|
9977 10524 | }
|
9978 10525 | }
|
9979 10526 | }
|
10527 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
9980 10528 | impl
|
9981 10529 | ::aws_smithy_http_server::response::IntoResponse<
|
9982 10530 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
9983 10531 | > for crate::error::MalformedTimestampPathHttpDateError
|
9984 10532 | {
|
9985 10533 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
9986 10534 | match crate::protocol_serde::shape_malformed_timestamp_path_http_date::ser_malformed_timestamp_path_http_date_http_error(&self) {
|
9987 10535 | Ok(mut response) => {
|
9988 10536 | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
9989 10537 | response
|
9990 10538 | },
|
9991 10539 | Err(e) => {
|
9992 10540 | ::tracing::error!(error = %e, "failed to serialize response");
|
9993 10541 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
9994 10542 | }
|
9995 10543 | }
|
9996 10544 | }
|
9997 10545 | }
|
9998 10546 |
|
10547 + | /* RustType.kt:534 */
|
9999 10548 | #[allow(unreachable_code, unused_variables)]
|
10549 + | /* RustType.kt:534 */
|
10000 10550 | #[cfg(test)]
|
10551 + | /* ProtocolTestGenerator.kt:98 */
|
10001 10552 | mod malformed_timestamp_path_http_date_test {
|
10002 10553 |
|
10003 10554 | /// When the format is http-date, RFC3339 timestamps are rejected with a
|
10004 10555 | /// 400 SerializationException
|
10005 10556 | /// Test ID: RestJsonPathTimestampHttpDateRejectsDateTime_case0
|
10006 10557 | #[::tokio::test]
|
10007 10558 | #[::tracing_test::traced_test]
|
10008 10559 | async fn rest_json_path_timestamp_http_date_rejects_date_time_case0_malformed_request() {
|
10009 10560 | {
|
10010 10561 | #[allow(unused_mut)]
|
10011 - | let mut http_request = http::Request::builder()
|
10562 + | let mut http_request = ::http_1x::Request::builder()
|
10012 10563 | .uri("/MalformedTimestampPathHttpDate/1985-04-12T23%3A20%3A50.52Z")
|
10013 10564 | .method("POST")
|
10014 - | .body(::aws_smithy_http_server::body::Body::empty())
|
10565 + | .body(::aws_smithy_http_server::body::boxed(
|
10566 + | ::http_body_util::Empty::new(),
|
10567 + | ))
|
10015 10568 | .unwrap();
|
10016 10569 | #[allow(unused_mut)]
|
10017 10570 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10018 10571 | let config = crate::service::RestJsonConfig::builder().build();
|
10019 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10572 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10020 10573 | .malformed_timestamp_path_http_date(move |input: crate::input::MalformedTimestampPathHttpDateInput| {
|
10021 10574 | let sender = sender.clone();
|
10022 10575 | async move {
|
10023 10576 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathHttpDateOutput, crate::error::MalformedTimestampPathHttpDateError> };
|
10024 10577 | sender.send(()).await.expect("receiver dropped early");
|
10025 10578 | result
|
10026 10579 | }
|
10027 10580 | })
|
10028 10581 | .build_unchecked();
|
10029 10582 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10030 10583 | .await
|
10031 10584 | .expect("unable to make an HTTP request");
|
10032 10585 | ::pretty_assertions::assert_eq!(
|
10033 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10586 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10034 10587 | http_response.status()
|
10035 10588 | );
|
10036 10589 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10037 10590 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10038 10591 | http_response.headers(),
|
10039 10592 | expected_headers,
|
10040 10593 | ));
|
10041 10594 | }
|
10042 10595 | }
|
10043 10596 |
|
10044 10597 | /// When the format is http-date, RFC3339 timestamps are rejected with a
|
10045 10598 | /// 400 SerializationException
|
10046 10599 | /// Test ID: RestJsonPathTimestampHttpDateRejectsDateTime_case1
|
10047 10600 | #[::tokio::test]
|
10048 10601 | #[::tracing_test::traced_test]
|
10049 10602 | async fn rest_json_path_timestamp_http_date_rejects_date_time_case1_malformed_request() {
|
10050 10603 | {
|
10051 10604 | #[allow(unused_mut)]
|
10052 - | let mut http_request = http::Request::builder()
|
10605 + | let mut http_request = ::http_1x::Request::builder()
|
10053 10606 | .uri("/MalformedTimestampPathHttpDate/1985-04-12T23%3A20%3A50Z")
|
10054 10607 | .method("POST")
|
10055 - | .body(::aws_smithy_http_server::body::Body::empty())
|
10608 + | .body(::aws_smithy_http_server::body::boxed(
|
10609 + | ::http_body_util::Empty::new(),
|
10610 + | ))
|
10056 10611 | .unwrap();
|
10057 10612 | #[allow(unused_mut)]
|
10058 10613 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10059 10614 | let config = crate::service::RestJsonConfig::builder().build();
|
10060 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10615 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10061 10616 | .malformed_timestamp_path_http_date(move |input: crate::input::MalformedTimestampPathHttpDateInput| {
|
10062 10617 | let sender = sender.clone();
|
10063 10618 | async move {
|
10064 10619 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathHttpDateOutput, crate::error::MalformedTimestampPathHttpDateError> };
|
10065 10620 | sender.send(()).await.expect("receiver dropped early");
|
10066 10621 | result
|
10067 10622 | }
|
10068 10623 | })
|
10069 10624 | .build_unchecked();
|
10070 10625 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10071 10626 | .await
|
10072 10627 | .expect("unable to make an HTTP request");
|
10073 10628 | ::pretty_assertions::assert_eq!(
|
10074 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10629 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10075 10630 | http_response.status()
|
10076 10631 | );
|
10077 10632 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10078 10633 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10079 10634 | http_response.headers(),
|
10080 10635 | expected_headers,
|
10081 10636 | ));
|
10082 10637 | }
|
10083 10638 | }
|
10084 10639 |
|
10085 10640 | /// When the format is http-date, RFC3339 timestamps are rejected with a
|
10086 10641 | /// 400 SerializationException
|
10087 10642 | /// Test ID: RestJsonPathTimestampHttpDateRejectsDateTime_case2
|
10088 10643 | #[::tokio::test]
|
10089 10644 | #[::tracing_test::traced_test]
|
10090 10645 | async fn rest_json_path_timestamp_http_date_rejects_date_time_case2_malformed_request() {
|
10091 10646 | {
|
10092 10647 | #[allow(unused_mut)]
|
10093 - | let mut http_request = http::Request::builder()
|
10648 + | let mut http_request = ::http_1x::Request::builder()
|
10094 10649 | .uri("/MalformedTimestampPathHttpDate/1996-12-19T16%3A39%3A57-08%3A00")
|
10095 10650 | .method("POST")
|
10096 - | .body(::aws_smithy_http_server::body::Body::empty())
|
10651 + | .body(::aws_smithy_http_server::body::boxed(
|
10652 + | ::http_body_util::Empty::new(),
|
10653 + | ))
|
10097 10654 | .unwrap();
|
10098 10655 | #[allow(unused_mut)]
|
10099 10656 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10100 10657 | let config = crate::service::RestJsonConfig::builder().build();
|
10101 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10658 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10102 10659 | .malformed_timestamp_path_http_date(move |input: crate::input::MalformedTimestampPathHttpDateInput| {
|
10103 10660 | let sender = sender.clone();
|
10104 10661 | async move {
|
10105 10662 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathHttpDateOutput, crate::error::MalformedTimestampPathHttpDateError> };
|
10106 10663 | sender.send(()).await.expect("receiver dropped early");
|
10107 10664 | result
|
10108 10665 | }
|
10109 10666 | })
|
10110 10667 | .build_unchecked();
|
10111 10668 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10112 10669 | .await
|
10113 10670 | .expect("unable to make an HTTP request");
|
10114 10671 | ::pretty_assertions::assert_eq!(
|
10115 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10672 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10116 10673 | http_response.status()
|
10117 10674 | );
|
10118 10675 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10119 10676 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10120 10677 | http_response.headers(),
|
10121 10678 | expected_headers,
|
10122 10679 | ));
|
10123 10680 | }
|
10124 10681 | }
|
10125 10682 |
|
10126 10683 | /// When the format is http-date, epoch second timestamps are rejected with a
|
10127 10684 | /// 400 SerializationException
|
10128 10685 | /// Test ID: RestJsonPathTimestampHttpDateRejectsEpochSeconds_case0
|
10129 10686 | #[::tokio::test]
|
10130 10687 | #[::tracing_test::traced_test]
|
10131 10688 | async fn rest_json_path_timestamp_http_date_rejects_epoch_seconds_case0_malformed_request() {
|
10132 10689 | {
|
10133 10690 | #[allow(unused_mut)]
|
10134 - | let mut http_request = http::Request::builder()
|
10691 + | let mut http_request = ::http_1x::Request::builder()
|
10135 10692 | .uri("/MalformedTimestampPathHttpDate/1515531081.1234")
|
10136 10693 | .method("POST")
|
10137 - | .body(::aws_smithy_http_server::body::Body::empty())
|
10694 + | .body(::aws_smithy_http_server::body::boxed(
|
10695 + | ::http_body_util::Empty::new(),
|
10696 + | ))
|
10138 10697 | .unwrap();
|
10139 10698 | #[allow(unused_mut)]
|
10140 10699 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10141 10700 | let config = crate::service::RestJsonConfig::builder().build();
|
10142 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10701 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10143 10702 | .malformed_timestamp_path_http_date(move |input: crate::input::MalformedTimestampPathHttpDateInput| {
|
10144 10703 | let sender = sender.clone();
|
10145 10704 | async move {
|
10146 10705 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathHttpDateOutput, crate::error::MalformedTimestampPathHttpDateError> };
|
10147 10706 | sender.send(()).await.expect("receiver dropped early");
|
10148 10707 | result
|
10149 10708 | }
|
10150 10709 | })
|
10151 10710 | .build_unchecked();
|
10152 10711 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10153 10712 | .await
|
10154 10713 | .expect("unable to make an HTTP request");
|
10155 10714 | ::pretty_assertions::assert_eq!(
|
10156 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10715 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10157 10716 | http_response.status()
|
10158 10717 | );
|
10159 10718 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10160 10719 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10161 10720 | http_response.headers(),
|
10162 10721 | expected_headers,
|
10163 10722 | ));
|
10164 10723 | }
|
10165 10724 | }
|
10166 10725 |
|
10167 10726 | /// When the format is http-date, epoch second timestamps are rejected with a
|
10168 10727 | /// 400 SerializationException
|
10169 10728 | /// Test ID: RestJsonPathTimestampHttpDateRejectsEpochSeconds_case1
|
10170 10729 | #[::tokio::test]
|
10171 10730 | #[::tracing_test::traced_test]
|
10172 10731 | async fn rest_json_path_timestamp_http_date_rejects_epoch_seconds_case1_malformed_request() {
|
10173 10732 | {
|
10174 10733 | #[allow(unused_mut)]
|
10175 - | let mut http_request = http::Request::builder()
|
10734 + | let mut http_request = ::http_1x::Request::builder()
|
10176 10735 | .uri("/MalformedTimestampPathHttpDate/1515531081")
|
10177 10736 | .method("POST")
|
10178 - | .body(::aws_smithy_http_server::body::Body::empty())
|
10737 + | .body(::aws_smithy_http_server::body::boxed(
|
10738 + | ::http_body_util::Empty::new(),
|
10739 + | ))
|
10179 10740 | .unwrap();
|
10180 10741 | #[allow(unused_mut)]
|
10181 10742 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10182 10743 | let config = crate::service::RestJsonConfig::builder().build();
|
10183 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10744 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10184 10745 | .malformed_timestamp_path_http_date(move |input: crate::input::MalformedTimestampPathHttpDateInput| {
|
10185 10746 | let sender = sender.clone();
|
10186 10747 | async move {
|
10187 10748 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathHttpDateOutput, crate::error::MalformedTimestampPathHttpDateError> };
|
10188 10749 | sender.send(()).await.expect("receiver dropped early");
|
10189 10750 | result
|
10190 10751 | }
|
10191 10752 | })
|
10192 10753 | .build_unchecked();
|
10193 10754 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10194 10755 | .await
|
10195 10756 | .expect("unable to make an HTTP request");
|
10196 10757 | ::pretty_assertions::assert_eq!(
|
10197 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10758 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10198 10759 | http_response.status()
|
10199 10760 | );
|
10200 10761 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10201 10762 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10202 10763 | http_response.headers(),
|
10203 10764 | expected_headers,
|
10204 10765 | ));
|
10205 10766 | }
|
10206 10767 | }
|
10768 + |
|
10769 + | /* ProtocolTestGenerator.kt:98 */
|
10207 10770 | }
|
10208 10771 |
|
10772 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
10209 10773 | ::pin_project_lite::pin_project! {
|
10210 10774 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
10211 10775 | /// [`MalformedTimestampPathDefaultInput`](crate::input::MalformedTimestampPathDefaultInput) using modelled bindings.
|
10212 10776 | pub struct MalformedTimestampPathDefaultInputFuture {
|
10213 10777 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedTimestampPathDefaultInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
10214 10778 | }
|
10215 10779 | }
|
10216 10780 |
|
10217 10781 | impl std::future::Future for MalformedTimestampPathDefaultInputFuture {
|
10218 10782 | type Output = Result<
|
10219 10783 | crate::input::MalformedTimestampPathDefaultInput,
|
10220 10784 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
10221 10785 | >;
|
10222 10786 |
|
10223 10787 | fn poll(
|
10224 10788 | self: std::pin::Pin<&mut Self>,
|
10225 10789 | cx: &mut std::task::Context<'_>,
|
10226 10790 | ) -> std::task::Poll<Self::Output> {
|
10227 10791 | let this = self.project();
|
10228 10792 | this.inner.as_mut().poll(cx)
|
10229 10793 | }
|
10230 10794 | }
|
10231 10795 |
|
10232 10796 | impl<B>
|
10233 10797 | ::aws_smithy_http_server::request::FromRequest<
|
10234 10798 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
10235 10799 | B,
|
10236 10800 | > for crate::input::MalformedTimestampPathDefaultInput
|
10237 10801 | where
|
10238 10802 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
10239 10803 | B: 'static,
|
10240 10804 |
|
10241 10805 | B::Data: Send,
|
10242 10806 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
10243 10807 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
10244 10808 | {
|
10245 10809 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
10246 10810 | type Future = MalformedTimestampPathDefaultInputFuture;
|
10247 10811 |
|
10248 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
10812 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
10249 10813 | let fut = async move {
|
10250 10814 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
10251 10815 | request.headers(),
|
10252 10816 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
10253 10817 | ) {
|
10254 10818 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
10255 10819 | }
|
10256 10820 | crate::protocol_serde::shape_malformed_timestamp_path_default::de_malformed_timestamp_path_default_http_request(request)
|
10257 10821 | .await
|
10258 10822 | };
|
10259 10823 | use ::futures_util::future::TryFutureExt;
|
10260 10824 | let fut = fut.map_err(
|
10261 10825 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
10262 10826 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
10263 10827 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
10264 10828 | e,
|
10265 10829 | )
|
10266 10830 | },
|
10267 10831 | );
|
10268 10832 | MalformedTimestampPathDefaultInputFuture {
|
10269 10833 | inner: Box::pin(fut),
|
10270 10834 | }
|
10271 10835 | }
|
10272 10836 | }
|
10837 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
10273 10838 | impl
|
10274 10839 | ::aws_smithy_http_server::response::IntoResponse<
|
10275 10840 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
10276 10841 | > for crate::output::MalformedTimestampPathDefaultOutput
|
10277 10842 | {
|
10278 10843 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10279 10844 | match crate::protocol_serde::shape_malformed_timestamp_path_default::ser_malformed_timestamp_path_default_http_response(self) {
|
10280 10845 | Ok(response) => response,
|
10281 10846 | Err(e) => {
|
10282 10847 | ::tracing::error!(error = %e, "failed to serialize response");
|
10283 10848 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
10284 10849 | }
|
10285 10850 | }
|
10286 10851 | }
|
10287 10852 | }
|
10853 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
10288 10854 | impl
|
10289 10855 | ::aws_smithy_http_server::response::IntoResponse<
|
10290 10856 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
10291 10857 | > for crate::error::MalformedTimestampPathDefaultError
|
10292 10858 | {
|
10293 10859 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
10294 10860 | match crate::protocol_serde::shape_malformed_timestamp_path_default::ser_malformed_timestamp_path_default_http_error(&self) {
|
10295 10861 | Ok(mut response) => {
|
10296 10862 | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
10297 10863 | response
|
10298 10864 | },
|
10299 10865 | Err(e) => {
|
10300 10866 | ::tracing::error!(error = %e, "failed to serialize response");
|
10301 10867 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
10302 10868 | }
|
10303 10869 | }
|
10304 10870 | }
|
10305 10871 | }
|
10306 10872 |
|
10873 + | /* RustType.kt:534 */
|
10307 10874 | #[allow(unreachable_code, unused_variables)]
|
10875 + | /* RustType.kt:534 */
|
10308 10876 | #[cfg(test)]
|
10877 + | /* ProtocolTestGenerator.kt:98 */
|
10309 10878 | mod malformed_timestamp_path_default_test {
|
10310 10879 |
|
10311 10880 | /// By default, IMF-fixdate timestamps are rejected with a
|
10312 10881 | /// 400 SerializationException
|
10313 10882 | /// Test ID: RestJsonPathTimestampDefaultRejectsHttpDate_case0
|
10314 10883 | #[::tokio::test]
|
10315 10884 | #[::tracing_test::traced_test]
|
10316 10885 | async fn rest_json_path_timestamp_default_rejects_http_date_case0_malformed_request() {
|
10317 10886 | {
|
10318 10887 | #[allow(unused_mut)]
|
10319 - | let mut http_request = http::Request::builder()
|
10888 + | let mut http_request = ::http_1x::Request::builder()
|
10320 10889 | .uri("/MalformedTimestampPathDefault/Tue%2C%2029%20Apr%202014%2018%3A30%3A38%20GMT")
|
10321 10890 | .method("POST")
|
10322 - | .body(::aws_smithy_http_server::body::Body::empty())
|
10891 + | .body(::aws_smithy_http_server::body::boxed(
|
10892 + | ::http_body_util::Empty::new(),
|
10893 + | ))
|
10323 10894 | .unwrap();
|
10324 10895 | #[allow(unused_mut)]
|
10325 10896 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10326 10897 | let config = crate::service::RestJsonConfig::builder().build();
|
10327 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10898 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10328 10899 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10329 10900 | let sender = sender.clone();
|
10330 10901 | async move {
|
10331 10902 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10332 10903 | sender.send(()).await.expect("receiver dropped early");
|
10333 10904 | result
|
10334 10905 | }
|
10335 10906 | })
|
10336 10907 | .build_unchecked();
|
10337 10908 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10338 10909 | .await
|
10339 10910 | .expect("unable to make an HTTP request");
|
10340 10911 | ::pretty_assertions::assert_eq!(
|
10341 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10912 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10342 10913 | http_response.status()
|
10343 10914 | );
|
10344 10915 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10345 10916 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10346 10917 | http_response.headers(),
|
10347 10918 | expected_headers,
|
10348 10919 | ));
|
10349 10920 | }
|
10350 10921 | }
|
10351 10922 |
|
10352 10923 | /// By default, IMF-fixdate timestamps are rejected with a
|
10353 10924 | /// 400 SerializationException
|
10354 10925 | /// Test ID: RestJsonPathTimestampDefaultRejectsHttpDate_case1
|
10355 10926 | #[::tokio::test]
|
10356 10927 | #[::tracing_test::traced_test]
|
10357 10928 | async fn rest_json_path_timestamp_default_rejects_http_date_case1_malformed_request() {
|
10358 10929 | {
|
10359 10930 | #[allow(unused_mut)]
|
10360 - | let mut http_request = http::Request::builder()
|
10931 + | let mut http_request = ::http_1x::Request::builder()
|
10361 10932 | .uri("/MalformedTimestampPathDefault/Sun%2C%2002%20Jan%202000%2020%3A34%3A56.000%20GMT")
|
10362 10933 | .method("POST")
|
10363 - | .body(::aws_smithy_http_server::body::Body::empty()).unwrap();
|
10934 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Empty::new())).unwrap();
|
10364 10935 | #[allow(unused_mut)]
|
10365 10936 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10366 10937 | let config = crate::service::RestJsonConfig::builder().build();
|
10367 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10938 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10368 10939 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10369 10940 | let sender = sender.clone();
|
10370 10941 | async move {
|
10371 10942 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10372 10943 | sender.send(()).await.expect("receiver dropped early");
|
10373 10944 | result
|
10374 10945 | }
|
10375 10946 | })
|
10376 10947 | .build_unchecked();
|
10377 10948 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10378 10949 | .await
|
10379 10950 | .expect("unable to make an HTTP request");
|
10380 10951 | ::pretty_assertions::assert_eq!(
|
10381 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10952 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10382 10953 | http_response.status()
|
10383 10954 | );
|
10384 10955 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10385 10956 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10386 10957 | http_response.headers(),
|
10387 10958 | expected_headers,
|
10388 10959 | ));
|
10389 10960 | }
|
10390 10961 | }
|
10391 10962 |
|
10392 10963 | /// By default, epoch second timestamps are rejected with a
|
10393 10964 | /// 400 SerializationException
|
10394 10965 | /// Test ID: RestJsonPathTimestampDefaultRejectsEpochSeconds_case0
|
10395 10966 | #[::tokio::test]
|
10396 10967 | #[::tracing_test::traced_test]
|
10397 10968 | async fn rest_json_path_timestamp_default_rejects_epoch_seconds_case0_malformed_request() {
|
10398 10969 | {
|
10399 10970 | #[allow(unused_mut)]
|
10400 - | let mut http_request = http::Request::builder()
|
10971 + | let mut http_request = ::http_1x::Request::builder()
|
10401 10972 | .uri("/MalformedTimestampPathDefault/1515531081.1234")
|
10402 10973 | .method("POST")
|
10403 - | .body(::aws_smithy_http_server::body::Body::empty())
|
10974 + | .body(::aws_smithy_http_server::body::boxed(
|
10975 + | ::http_body_util::Empty::new(),
|
10976 + | ))
|
10404 10977 | .unwrap();
|
10405 10978 | #[allow(unused_mut)]
|
10406 10979 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10407 10980 | let config = crate::service::RestJsonConfig::builder().build();
|
10408 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
10981 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10409 10982 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10410 10983 | let sender = sender.clone();
|
10411 10984 | async move {
|
10412 10985 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10413 10986 | sender.send(()).await.expect("receiver dropped early");
|
10414 10987 | result
|
10415 10988 | }
|
10416 10989 | })
|
10417 10990 | .build_unchecked();
|
10418 10991 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10419 10992 | .await
|
10420 10993 | .expect("unable to make an HTTP request");
|
10421 10994 | ::pretty_assertions::assert_eq!(
|
10422 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10995 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10423 10996 | http_response.status()
|
10424 10997 | );
|
10425 10998 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10426 10999 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10427 11000 | http_response.headers(),
|
10428 11001 | expected_headers,
|
10429 11002 | ));
|
10430 11003 | }
|
10431 11004 | }
|
10432 11005 |
|
10433 11006 | /// By default, epoch second timestamps are rejected with a
|
10434 11007 | /// 400 SerializationException
|
10435 11008 | /// Test ID: RestJsonPathTimestampDefaultRejectsEpochSeconds_case1
|
10436 11009 | #[::tokio::test]
|
10437 11010 | #[::tracing_test::traced_test]
|
10438 11011 | async fn rest_json_path_timestamp_default_rejects_epoch_seconds_case1_malformed_request() {
|
10439 11012 | {
|
10440 11013 | #[allow(unused_mut)]
|
10441 - | let mut http_request = http::Request::builder()
|
11014 + | let mut http_request = ::http_1x::Request::builder()
|
10442 11015 | .uri("/MalformedTimestampPathDefault/1515531081")
|
10443 11016 | .method("POST")
|
10444 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11017 + | .body(::aws_smithy_http_server::body::boxed(
|
11018 + | ::http_body_util::Empty::new(),
|
11019 + | ))
|
10445 11020 | .unwrap();
|
10446 11021 | #[allow(unused_mut)]
|
10447 11022 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10448 11023 | let config = crate::service::RestJsonConfig::builder().build();
|
10449 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11024 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10450 11025 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10451 11026 | let sender = sender.clone();
|
10452 11027 | async move {
|
10453 11028 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10454 11029 | sender.send(()).await.expect("receiver dropped early");
|
10455 11030 | result
|
10456 11031 | }
|
10457 11032 | })
|
10458 11033 | .build_unchecked();
|
10459 11034 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10460 11035 | .await
|
10461 11036 | .expect("unable to make an HTTP request");
|
10462 11037 | ::pretty_assertions::assert_eq!(
|
10463 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11038 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10464 11039 | http_response.status()
|
10465 11040 | );
|
10466 11041 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10467 11042 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10468 11043 | http_response.headers(),
|
10469 11044 | expected_headers,
|
10470 11045 | ));
|
10471 11046 | }
|
10472 11047 | }
|
10473 11048 |
|
10474 11049 | /// UTC offsets must be rejected with a
|
10475 11050 | /// 400 SerializationException
|
10476 11051 | /// Test ID: RestJsonPathTimestampDefaultRejectsUTCOffsets
|
10477 11052 | #[::tokio::test]
|
10478 11053 | #[::tracing_test::traced_test]
|
10479 11054 | async fn rest_json_path_timestamp_default_rejects_utc_offsets_malformed_request() {
|
10480 11055 | {
|
10481 11056 | #[allow(unused_mut)]
|
10482 - | let mut http_request = http::Request::builder()
|
11057 + | let mut http_request = ::http_1x::Request::builder()
|
10483 11058 | .uri("/MalformedTimestampPathDefault/1996-12-19T16%3A39%3A57-08%3A00")
|
10484 11059 | .method("POST")
|
10485 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11060 + | .body(::aws_smithy_http_server::body::boxed(
|
11061 + | ::http_body_util::Empty::new(),
|
11062 + | ))
|
10486 11063 | .unwrap();
|
10487 11064 | #[allow(unused_mut)]
|
10488 11065 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10489 11066 | let config = crate::service::RestJsonConfig::builder().build();
|
10490 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11067 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10491 11068 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10492 11069 | let sender = sender.clone();
|
10493 11070 | async move {
|
10494 11071 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10495 11072 | sender.send(()).await.expect("receiver dropped early");
|
10496 11073 | result
|
10497 11074 | }
|
10498 11075 | })
|
10499 11076 | .build_unchecked();
|
10500 11077 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10501 11078 | .await
|
10502 11079 | .expect("unable to make an HTTP request");
|
10503 11080 | ::pretty_assertions::assert_eq!(
|
10504 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11081 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10505 11082 | http_response.status()
|
10506 11083 | );
|
10507 11084 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10508 11085 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10509 11086 | http_response.headers(),
|
10510 11087 | expected_headers,
|
10511 11088 | ));
|
10512 11089 | }
|
10513 11090 | }
|
10514 11091 |
|
10515 11092 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
10516 11093 | /// are rejected with a 400 SerializationException
|
10517 11094 | /// Test ID: RestJsonPathTimestampDefaultRejectsDifferent8601Formats_case0
|
10518 11095 | #[::tokio::test]
|
10519 11096 | #[::tracing_test::traced_test]
|
10520 11097 | async fn rest_json_path_timestamp_default_rejects_different8601_formats_case0_malformed_request(
|
10521 11098 | ) {
|
10522 11099 | {
|
10523 11100 | #[allow(unused_mut)]
|
10524 - | let mut http_request = http::Request::builder()
|
11101 + | let mut http_request = ::http_1x::Request::builder()
|
10525 11102 | .uri("/MalformedTimestampPathDefault/1996-12-19T16%3A39%3A57%2B00")
|
10526 11103 | .method("POST")
|
10527 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11104 + | .body(::aws_smithy_http_server::body::boxed(
|
11105 + | ::http_body_util::Empty::new(),
|
11106 + | ))
|
10528 11107 | .unwrap();
|
10529 11108 | #[allow(unused_mut)]
|
10530 11109 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10531 11110 | let config = crate::service::RestJsonConfig::builder().build();
|
10532 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11111 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10533 11112 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10534 11113 | let sender = sender.clone();
|
10535 11114 | async move {
|
10536 11115 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10537 11116 | sender.send(()).await.expect("receiver dropped early");
|
10538 11117 | result
|
10539 11118 | }
|
10540 11119 | })
|
10541 11120 | .build_unchecked();
|
10542 11121 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10543 11122 | .await
|
10544 11123 | .expect("unable to make an HTTP request");
|
10545 11124 | ::pretty_assertions::assert_eq!(
|
10546 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11125 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10547 11126 | http_response.status()
|
10548 11127 | );
|
10549 11128 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10550 11129 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10551 11130 | http_response.headers(),
|
10552 11131 | expected_headers,
|
10553 11132 | ));
|
10554 11133 | }
|
10555 11134 | }
|
10556 11135 |
|
10557 11136 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
10558 11137 | /// are rejected with a 400 SerializationException
|
10559 11138 | /// Test ID: RestJsonPathTimestampDefaultRejectsDifferent8601Formats_case1
|
10560 11139 | #[::tokio::test]
|
10561 11140 | #[::tracing_test::traced_test]
|
10562 11141 | async fn rest_json_path_timestamp_default_rejects_different8601_formats_case1_malformed_request(
|
10563 11142 | ) {
|
10564 11143 | {
|
10565 11144 | #[allow(unused_mut)]
|
10566 - | let mut http_request = http::Request::builder()
|
11145 + | let mut http_request = ::http_1x::Request::builder()
|
10567 11146 | .uri("/MalformedTimestampPathDefault/1996-12-19T16%3A39%3A57%2B00Z")
|
10568 11147 | .method("POST")
|
10569 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11148 + | .body(::aws_smithy_http_server::body::boxed(
|
11149 + | ::http_body_util::Empty::new(),
|
11150 + | ))
|
10570 11151 | .unwrap();
|
10571 11152 | #[allow(unused_mut)]
|
10572 11153 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10573 11154 | let config = crate::service::RestJsonConfig::builder().build();
|
10574 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11155 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10575 11156 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10576 11157 | let sender = sender.clone();
|
10577 11158 | async move {
|
10578 11159 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10579 11160 | sender.send(()).await.expect("receiver dropped early");
|
10580 11161 | result
|
10581 11162 | }
|
10582 11163 | })
|
10583 11164 | .build_unchecked();
|
10584 11165 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10585 11166 | .await
|
10586 11167 | .expect("unable to make an HTTP request");
|
10587 11168 | ::pretty_assertions::assert_eq!(
|
10588 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11169 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10589 11170 | http_response.status()
|
10590 11171 | );
|
10591 11172 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10592 11173 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10593 11174 | http_response.headers(),
|
10594 11175 | expected_headers,
|
10595 11176 | ));
|
10596 11177 | }
|
10597 11178 | }
|
10598 11179 |
|
10599 11180 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
10600 11181 | /// are rejected with a 400 SerializationException
|
10601 11182 | /// Test ID: RestJsonPathTimestampDefaultRejectsDifferent8601Formats_case2
|
10602 11183 | #[::tokio::test]
|
10603 11184 | #[::tracing_test::traced_test]
|
10604 11185 | async fn rest_json_path_timestamp_default_rejects_different8601_formats_case2_malformed_request(
|
10605 11186 | ) {
|
10606 11187 | {
|
10607 11188 | #[allow(unused_mut)]
|
10608 - | let mut http_request = http::Request::builder()
|
11189 + | let mut http_request = ::http_1x::Request::builder()
|
10609 11190 | .uri("/MalformedTimestampPathDefault/1996-12-19T16%3A39%3A57")
|
10610 11191 | .method("POST")
|
10611 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11192 + | .body(::aws_smithy_http_server::body::boxed(
|
11193 + | ::http_body_util::Empty::new(),
|
11194 + | ))
|
10612 11195 | .unwrap();
|
10613 11196 | #[allow(unused_mut)]
|
10614 11197 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10615 11198 | let config = crate::service::RestJsonConfig::builder().build();
|
10616 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11199 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10617 11200 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10618 11201 | let sender = sender.clone();
|
10619 11202 | async move {
|
10620 11203 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10621 11204 | sender.send(()).await.expect("receiver dropped early");
|
10622 11205 | result
|
10623 11206 | }
|
10624 11207 | })
|
10625 11208 | .build_unchecked();
|
10626 11209 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10627 11210 | .await
|
10628 11211 | .expect("unable to make an HTTP request");
|
10629 11212 | ::pretty_assertions::assert_eq!(
|
10630 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11213 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10631 11214 | http_response.status()
|
10632 11215 | );
|
10633 11216 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10634 11217 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10635 11218 | http_response.headers(),
|
10636 11219 | expected_headers,
|
10637 11220 | ));
|
10638 11221 | }
|
10639 11222 | }
|
10640 11223 |
|
10641 11224 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
10642 11225 | /// are rejected with a 400 SerializationException
|
10643 11226 | /// Test ID: RestJsonPathTimestampDefaultRejectsDifferent8601Formats_case3
|
10644 11227 | #[::tokio::test]
|
10645 11228 | #[::tracing_test::traced_test]
|
10646 11229 | async fn rest_json_path_timestamp_default_rejects_different8601_formats_case3_malformed_request(
|
10647 11230 | ) {
|
10648 11231 | {
|
10649 11232 | #[allow(unused_mut)]
|
10650 - | let mut http_request = http::Request::builder()
|
11233 + | let mut http_request = ::http_1x::Request::builder()
|
10651 11234 | .uri("/MalformedTimestampPathDefault/1996-12-19T163957")
|
10652 11235 | .method("POST")
|
10653 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11236 + | .body(::aws_smithy_http_server::body::boxed(
|
11237 + | ::http_body_util::Empty::new(),
|
11238 + | ))
|
10654 11239 | .unwrap();
|
10655 11240 | #[allow(unused_mut)]
|
10656 11241 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10657 11242 | let config = crate::service::RestJsonConfig::builder().build();
|
10658 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11243 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10659 11244 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10660 11245 | let sender = sender.clone();
|
10661 11246 | async move {
|
10662 11247 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10663 11248 | sender.send(()).await.expect("receiver dropped early");
|
10664 11249 | result
|
10665 11250 | }
|
10666 11251 | })
|
10667 11252 | .build_unchecked();
|
10668 11253 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10669 11254 | .await
|
10670 11255 | .expect("unable to make an HTTP request");
|
10671 11256 | ::pretty_assertions::assert_eq!(
|
10672 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11257 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10673 11258 | http_response.status()
|
10674 11259 | );
|
10675 11260 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10676 11261 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10677 11262 | http_response.headers(),
|
10678 11263 | expected_headers,
|
10679 11264 | ));
|
10680 11265 | }
|
10681 11266 | }
|
10682 11267 |
|
10683 11268 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
10684 11269 | /// are rejected with a 400 SerializationException
|
10685 11270 | /// Test ID: RestJsonPathTimestampDefaultRejectsDifferent8601Formats_case4
|
10686 11271 | #[::tokio::test]
|
10687 11272 | #[::tracing_test::traced_test]
|
10688 11273 | async fn rest_json_path_timestamp_default_rejects_different8601_formats_case4_malformed_request(
|
10689 11274 | ) {
|
10690 11275 | {
|
10691 11276 | #[allow(unused_mut)]
|
10692 - | let mut http_request = http::Request::builder()
|
11277 + | let mut http_request = ::http_1x::Request::builder()
|
10693 11278 | .uri("/MalformedTimestampPathDefault/19961219T163957Z")
|
10694 11279 | .method("POST")
|
10695 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11280 + | .body(::aws_smithy_http_server::body::boxed(
|
11281 + | ::http_body_util::Empty::new(),
|
11282 + | ))
|
10696 11283 | .unwrap();
|
10697 11284 | #[allow(unused_mut)]
|
10698 11285 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10699 11286 | let config = crate::service::RestJsonConfig::builder().build();
|
10700 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11287 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10701 11288 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10702 11289 | let sender = sender.clone();
|
10703 11290 | async move {
|
10704 11291 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10705 11292 | sender.send(()).await.expect("receiver dropped early");
|
10706 11293 | result
|
10707 11294 | }
|
10708 11295 | })
|
10709 11296 | .build_unchecked();
|
10710 11297 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10711 11298 | .await
|
10712 11299 | .expect("unable to make an HTTP request");
|
10713 11300 | ::pretty_assertions::assert_eq!(
|
10714 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11301 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10715 11302 | http_response.status()
|
10716 11303 | );
|
10717 11304 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10718 11305 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10719 11306 | http_response.headers(),
|
10720 11307 | expected_headers,
|
10721 11308 | ));
|
10722 11309 | }
|
10723 11310 | }
|
10724 11311 |
|
10725 11312 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
10726 11313 | /// are rejected with a 400 SerializationException
|
10727 11314 | /// Test ID: RestJsonPathTimestampDefaultRejectsDifferent8601Formats_case5
|
10728 11315 | #[::tokio::test]
|
10729 11316 | #[::tracing_test::traced_test]
|
10730 11317 | async fn rest_json_path_timestamp_default_rejects_different8601_formats_case5_malformed_request(
|
10731 11318 | ) {
|
10732 11319 | {
|
10733 11320 | #[allow(unused_mut)]
|
10734 - | let mut http_request = http::Request::builder()
|
11321 + | let mut http_request = ::http_1x::Request::builder()
|
10735 11322 | .uri("/MalformedTimestampPathDefault/19961219T163957")
|
10736 11323 | .method("POST")
|
10737 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11324 + | .body(::aws_smithy_http_server::body::boxed(
|
11325 + | ::http_body_util::Empty::new(),
|
11326 + | ))
|
10738 11327 | .unwrap();
|
10739 11328 | #[allow(unused_mut)]
|
10740 11329 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10741 11330 | let config = crate::service::RestJsonConfig::builder().build();
|
10742 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11331 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10743 11332 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10744 11333 | let sender = sender.clone();
|
10745 11334 | async move {
|
10746 11335 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10747 11336 | sender.send(()).await.expect("receiver dropped early");
|
10748 11337 | result
|
10749 11338 | }
|
10750 11339 | })
|
10751 11340 | .build_unchecked();
|
10752 11341 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10753 11342 | .await
|
10754 11343 | .expect("unable to make an HTTP request");
|
10755 11344 | ::pretty_assertions::assert_eq!(
|
10756 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11345 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10757 11346 | http_response.status()
|
10758 11347 | );
|
10759 11348 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10760 11349 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10761 11350 | http_response.headers(),
|
10762 11351 | expected_headers,
|
10763 11352 | ));
|
10764 11353 | }
|
10765 11354 | }
|
10766 11355 |
|
10767 11356 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
10768 11357 | /// are rejected with a 400 SerializationException
|
10769 11358 | /// Test ID: RestJsonPathTimestampDefaultRejectsDifferent8601Formats_case6
|
10770 11359 | #[::tokio::test]
|
10771 11360 | #[::tracing_test::traced_test]
|
10772 11361 | async fn rest_json_path_timestamp_default_rejects_different8601_formats_case6_malformed_request(
|
10773 11362 | ) {
|
10774 11363 | {
|
10775 11364 | #[allow(unused_mut)]
|
10776 - | let mut http_request = http::Request::builder()
|
11365 + | let mut http_request = ::http_1x::Request::builder()
|
10777 11366 | .uri("/MalformedTimestampPathDefault/19961219T16%3A39%3A57Z")
|
10778 11367 | .method("POST")
|
10779 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11368 + | .body(::aws_smithy_http_server::body::boxed(
|
11369 + | ::http_body_util::Empty::new(),
|
11370 + | ))
|
10780 11371 | .unwrap();
|
10781 11372 | #[allow(unused_mut)]
|
10782 11373 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10783 11374 | let config = crate::service::RestJsonConfig::builder().build();
|
10784 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11375 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10785 11376 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10786 11377 | let sender = sender.clone();
|
10787 11378 | async move {
|
10788 11379 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10789 11380 | sender.send(()).await.expect("receiver dropped early");
|
10790 11381 | result
|
10791 11382 | }
|
10792 11383 | })
|
10793 11384 | .build_unchecked();
|
10794 11385 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10795 11386 | .await
|
10796 11387 | .expect("unable to make an HTTP request");
|
10797 11388 | ::pretty_assertions::assert_eq!(
|
10798 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11389 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10799 11390 | http_response.status()
|
10800 11391 | );
|
10801 11392 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10802 11393 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10803 11394 | http_response.headers(),
|
10804 11395 | expected_headers,
|
10805 11396 | ));
|
10806 11397 | }
|
10807 11398 | }
|
10808 11399 |
|
10809 11400 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
10810 11401 | /// are rejected with a 400 SerializationException
|
10811 11402 | /// Test ID: RestJsonPathTimestampDefaultRejectsDifferent8601Formats_case7
|
10812 11403 | #[::tokio::test]
|
10813 11404 | #[::tracing_test::traced_test]
|
10814 11405 | async fn rest_json_path_timestamp_default_rejects_different8601_formats_case7_malformed_request(
|
10815 11406 | ) {
|
10816 11407 | {
|
10817 11408 | #[allow(unused_mut)]
|
10818 - | let mut http_request = http::Request::builder()
|
11409 + | let mut http_request = ::http_1x::Request::builder()
|
10819 11410 | .uri("/MalformedTimestampPathDefault/19961219T16%3A39%3A57")
|
10820 11411 | .method("POST")
|
10821 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11412 + | .body(::aws_smithy_http_server::body::boxed(
|
11413 + | ::http_body_util::Empty::new(),
|
11414 + | ))
|
10822 11415 | .unwrap();
|
10823 11416 | #[allow(unused_mut)]
|
10824 11417 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10825 11418 | let config = crate::service::RestJsonConfig::builder().build();
|
10826 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11419 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10827 11420 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10828 11421 | let sender = sender.clone();
|
10829 11422 | async move {
|
10830 11423 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10831 11424 | sender.send(()).await.expect("receiver dropped early");
|
10832 11425 | result
|
10833 11426 | }
|
10834 11427 | })
|
10835 11428 | .build_unchecked();
|
10836 11429 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10837 11430 | .await
|
10838 11431 | .expect("unable to make an HTTP request");
|
10839 11432 | ::pretty_assertions::assert_eq!(
|
10840 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11433 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10841 11434 | http_response.status()
|
10842 11435 | );
|
10843 11436 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10844 11437 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10845 11438 | http_response.headers(),
|
10846 11439 | expected_headers,
|
10847 11440 | ));
|
10848 11441 | }
|
10849 11442 | }
|
10850 11443 |
|
10851 11444 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
10852 11445 | /// are rejected with a 400 SerializationException
|
10853 11446 | /// Test ID: RestJsonPathTimestampDefaultRejectsDifferent8601Formats_case8
|
10854 11447 | #[::tokio::test]
|
10855 11448 | #[::tracing_test::traced_test]
|
10856 11449 | async fn rest_json_path_timestamp_default_rejects_different8601_formats_case8_malformed_request(
|
10857 11450 | ) {
|
10858 11451 | {
|
10859 11452 | #[allow(unused_mut)]
|
10860 - | let mut http_request = http::Request::builder()
|
11453 + | let mut http_request = ::http_1x::Request::builder()
|
10861 11454 | .uri("/MalformedTimestampPathDefault/1996-12-19T16%3A39Z")
|
10862 11455 | .method("POST")
|
10863 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11456 + | .body(::aws_smithy_http_server::body::boxed(
|
11457 + | ::http_body_util::Empty::new(),
|
11458 + | ))
|
10864 11459 | .unwrap();
|
10865 11460 | #[allow(unused_mut)]
|
10866 11461 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10867 11462 | let config = crate::service::RestJsonConfig::builder().build();
|
10868 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11463 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10869 11464 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10870 11465 | let sender = sender.clone();
|
10871 11466 | async move {
|
10872 11467 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10873 11468 | sender.send(()).await.expect("receiver dropped early");
|
10874 11469 | result
|
10875 11470 | }
|
10876 11471 | })
|
10877 11472 | .build_unchecked();
|
10878 11473 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10879 11474 | .await
|
10880 11475 | .expect("unable to make an HTTP request");
|
10881 11476 | ::pretty_assertions::assert_eq!(
|
10882 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11477 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10883 11478 | http_response.status()
|
10884 11479 | );
|
10885 11480 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10886 11481 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10887 11482 | http_response.headers(),
|
10888 11483 | expected_headers,
|
10889 11484 | ));
|
10890 11485 | }
|
10891 11486 | }
|
10892 11487 |
|
10893 11488 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
10894 11489 | /// are rejected with a 400 SerializationException
|
10895 11490 | /// Test ID: RestJsonPathTimestampDefaultRejectsDifferent8601Formats_case9
|
10896 11491 | #[::tokio::test]
|
10897 11492 | #[::tracing_test::traced_test]
|
10898 11493 | async fn rest_json_path_timestamp_default_rejects_different8601_formats_case9_malformed_request(
|
10899 11494 | ) {
|
10900 11495 | {
|
10901 11496 | #[allow(unused_mut)]
|
10902 - | let mut http_request = http::Request::builder()
|
11497 + | let mut http_request = ::http_1x::Request::builder()
|
10903 11498 | .uri("/MalformedTimestampPathDefault/1996-12-19T16%3A39")
|
10904 11499 | .method("POST")
|
10905 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11500 + | .body(::aws_smithy_http_server::body::boxed(
|
11501 + | ::http_body_util::Empty::new(),
|
11502 + | ))
|
10906 11503 | .unwrap();
|
10907 11504 | #[allow(unused_mut)]
|
10908 11505 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10909 11506 | let config = crate::service::RestJsonConfig::builder().build();
|
10910 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11507 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10911 11508 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10912 11509 | let sender = sender.clone();
|
10913 11510 | async move {
|
10914 11511 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10915 11512 | sender.send(()).await.expect("receiver dropped early");
|
10916 11513 | result
|
10917 11514 | }
|
10918 11515 | })
|
10919 11516 | .build_unchecked();
|
10920 11517 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10921 11518 | .await
|
10922 11519 | .expect("unable to make an HTTP request");
|
10923 11520 | ::pretty_assertions::assert_eq!(
|
10924 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11521 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10925 11522 | http_response.status()
|
10926 11523 | );
|
10927 11524 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10928 11525 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10929 11526 | http_response.headers(),
|
10930 11527 | expected_headers,
|
10931 11528 | ));
|
10932 11529 | }
|
10933 11530 | }
|
10934 11531 |
|
10935 11532 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
10936 11533 | /// are rejected with a 400 SerializationException
|
10937 11534 | /// Test ID: RestJsonPathTimestampDefaultRejectsDifferent8601Formats_case10
|
10938 11535 | #[::tokio::test]
|
10939 11536 | #[::tracing_test::traced_test]
|
10940 11537 | async fn rest_json_path_timestamp_default_rejects_different8601_formats_case10_malformed_request(
|
10941 11538 | ) {
|
10942 11539 | {
|
10943 11540 | #[allow(unused_mut)]
|
10944 - | let mut http_request = http::Request::builder()
|
11541 + | let mut http_request = ::http_1x::Request::builder()
|
10945 11542 | .uri("/MalformedTimestampPathDefault/1996-12-19T1639")
|
10946 11543 | .method("POST")
|
10947 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11544 + | .body(::aws_smithy_http_server::body::boxed(
|
11545 + | ::http_body_util::Empty::new(),
|
11546 + | ))
|
10948 11547 | .unwrap();
|
10949 11548 | #[allow(unused_mut)]
|
10950 11549 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10951 11550 | let config = crate::service::RestJsonConfig::builder().build();
|
10952 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11551 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10953 11552 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10954 11553 | let sender = sender.clone();
|
10955 11554 | async move {
|
10956 11555 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10957 11556 | sender.send(()).await.expect("receiver dropped early");
|
10958 11557 | result
|
10959 11558 | }
|
10960 11559 | })
|
10961 11560 | .build_unchecked();
|
10962 11561 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
10963 11562 | .await
|
10964 11563 | .expect("unable to make an HTTP request");
|
10965 11564 | ::pretty_assertions::assert_eq!(
|
10966 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11565 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
10967 11566 | http_response.status()
|
10968 11567 | );
|
10969 11568 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
10970 11569 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10971 11570 | http_response.headers(),
|
10972 11571 | expected_headers,
|
10973 11572 | ));
|
10974 11573 | }
|
10975 11574 | }
|
10976 11575 |
|
10977 11576 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
10978 11577 | /// are rejected with a 400 SerializationException
|
10979 11578 | /// Test ID: RestJsonPathTimestampDefaultRejectsDifferent8601Formats_case11
|
10980 11579 | #[::tokio::test]
|
10981 11580 | #[::tracing_test::traced_test]
|
10982 11581 | async fn rest_json_path_timestamp_default_rejects_different8601_formats_case11_malformed_request(
|
10983 11582 | ) {
|
10984 11583 | {
|
10985 11584 | #[allow(unused_mut)]
|
10986 - | let mut http_request = http::Request::builder()
|
11585 + | let mut http_request = ::http_1x::Request::builder()
|
10987 11586 | .uri("/MalformedTimestampPathDefault/1996-12-19T16Z")
|
10988 11587 | .method("POST")
|
10989 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11588 + | .body(::aws_smithy_http_server::body::boxed(
|
11589 + | ::http_body_util::Empty::new(),
|
11590 + | ))
|
10990 11591 | .unwrap();
|
10991 11592 | #[allow(unused_mut)]
|
10992 11593 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
10993 11594 | let config = crate::service::RestJsonConfig::builder().build();
|
10994 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11595 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
10995 11596 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
10996 11597 | let sender = sender.clone();
|
10997 11598 | async move {
|
10998 11599 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
10999 11600 | sender.send(()).await.expect("receiver dropped early");
|
11000 11601 | result
|
11001 11602 | }
|
11002 11603 | })
|
11003 11604 | .build_unchecked();
|
11004 11605 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11005 11606 | .await
|
11006 11607 | .expect("unable to make an HTTP request");
|
11007 11608 | ::pretty_assertions::assert_eq!(
|
11008 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11609 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11009 11610 | http_response.status()
|
11010 11611 | );
|
11011 11612 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11012 11613 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11013 11614 | http_response.headers(),
|
11014 11615 | expected_headers,
|
11015 11616 | ));
|
11016 11617 | }
|
11017 11618 | }
|
11018 11619 |
|
11019 11620 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
11020 11621 | /// are rejected with a 400 SerializationException
|
11021 11622 | /// Test ID: RestJsonPathTimestampDefaultRejectsDifferent8601Formats_case12
|
11022 11623 | #[::tokio::test]
|
11023 11624 | #[::tracing_test::traced_test]
|
11024 11625 | async fn rest_json_path_timestamp_default_rejects_different8601_formats_case12_malformed_request(
|
11025 11626 | ) {
|
11026 11627 | {
|
11027 11628 | #[allow(unused_mut)]
|
11028 - | let mut http_request = http::Request::builder()
|
11629 + | let mut http_request = ::http_1x::Request::builder()
|
11029 11630 | .uri("/MalformedTimestampPathDefault/1996-12-19T16")
|
11030 11631 | .method("POST")
|
11031 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11632 + | .body(::aws_smithy_http_server::body::boxed(
|
11633 + | ::http_body_util::Empty::new(),
|
11634 + | ))
|
11032 11635 | .unwrap();
|
11033 11636 | #[allow(unused_mut)]
|
11034 11637 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11035 11638 | let config = crate::service::RestJsonConfig::builder().build();
|
11036 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11639 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11037 11640 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
11038 11641 | let sender = sender.clone();
|
11039 11642 | async move {
|
11040 11643 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
11041 11644 | sender.send(()).await.expect("receiver dropped early");
|
11042 11645 | result
|
11043 11646 | }
|
11044 11647 | })
|
11045 11648 | .build_unchecked();
|
11046 11649 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11047 11650 | .await
|
11048 11651 | .expect("unable to make an HTTP request");
|
11049 11652 | ::pretty_assertions::assert_eq!(
|
11050 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11653 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11051 11654 | http_response.status()
|
11052 11655 | );
|
11053 11656 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11054 11657 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11055 11658 | http_response.headers(),
|
11056 11659 | expected_headers,
|
11057 11660 | ));
|
11058 11661 | }
|
11059 11662 | }
|
11060 11663 |
|
11061 11664 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
11062 11665 | /// are rejected with a 400 SerializationException
|
11063 11666 | /// Test ID: RestJsonPathTimestampDefaultRejectsDifferent8601Formats_case13
|
11064 11667 | #[::tokio::test]
|
11065 11668 | #[::tracing_test::traced_test]
|
11066 11669 | async fn rest_json_path_timestamp_default_rejects_different8601_formats_case13_malformed_request(
|
11067 11670 | ) {
|
11068 11671 | {
|
11069 11672 | #[allow(unused_mut)]
|
11070 - | let mut http_request = http::Request::builder()
|
11673 + | let mut http_request = ::http_1x::Request::builder()
|
11071 11674 | .uri("/MalformedTimestampPathDefault/1996-12-19%2016%3A39%3A57Z")
|
11072 11675 | .method("POST")
|
11073 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11676 + | .body(::aws_smithy_http_server::body::boxed(
|
11677 + | ::http_body_util::Empty::new(),
|
11678 + | ))
|
11074 11679 | .unwrap();
|
11075 11680 | #[allow(unused_mut)]
|
11076 11681 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11077 11682 | let config = crate::service::RestJsonConfig::builder().build();
|
11078 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11683 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11079 11684 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
11080 11685 | let sender = sender.clone();
|
11081 11686 | async move {
|
11082 11687 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
11083 11688 | sender.send(()).await.expect("receiver dropped early");
|
11084 11689 | result
|
11085 11690 | }
|
11086 11691 | })
|
11087 11692 | .build_unchecked();
|
11088 11693 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11089 11694 | .await
|
11090 11695 | .expect("unable to make an HTTP request");
|
11091 11696 | ::pretty_assertions::assert_eq!(
|
11092 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11697 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11093 11698 | http_response.status()
|
11094 11699 | );
|
11095 11700 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11096 11701 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11097 11702 | http_response.headers(),
|
11098 11703 | expected_headers,
|
11099 11704 | ));
|
11100 11705 | }
|
11101 11706 | }
|
11102 11707 |
|
11103 11708 | /// By default, maybe-valid ISO-8601 date-times not conforming to RFC 3339
|
11104 11709 | /// are rejected with a 400 SerializationException
|
11105 11710 | /// Test ID: RestJsonPathTimestampDefaultRejectsDifferent8601Formats_case14
|
11106 11711 | #[::tokio::test]
|
11107 11712 | #[::tracing_test::traced_test]
|
11108 11713 | async fn rest_json_path_timestamp_default_rejects_different8601_formats_case14_malformed_request(
|
11109 11714 | ) {
|
11110 11715 | {
|
11111 11716 | #[allow(unused_mut)]
|
11112 - | let mut http_request = http::Request::builder()
|
11717 + | let mut http_request = ::http_1x::Request::builder()
|
11113 11718 | .uri("/MalformedTimestampPathDefault/2011-12-03T10%3A15%3A30%2B01%3A00%5BEurope%2FParis%5D")
|
11114 11719 | .method("POST")
|
11115 - | .body(::aws_smithy_http_server::body::Body::empty()).unwrap();
|
11720 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Empty::new())).unwrap();
|
11116 11721 | #[allow(unused_mut)]
|
11117 11722 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11118 11723 | let config = crate::service::RestJsonConfig::builder().build();
|
11119 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11724 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11120 11725 | .malformed_timestamp_path_default(move |input: crate::input::MalformedTimestampPathDefaultInput| {
|
11121 11726 | let sender = sender.clone();
|
11122 11727 | async move {
|
11123 11728 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedTimestampPathDefaultOutput, crate::error::MalformedTimestampPathDefaultError> };
|
11124 11729 | sender.send(()).await.expect("receiver dropped early");
|
11125 11730 | result
|
11126 11731 | }
|
11127 11732 | })
|
11128 11733 | .build_unchecked();
|
11129 11734 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11130 11735 | .await
|
11131 11736 | .expect("unable to make an HTTP request");
|
11132 11737 | ::pretty_assertions::assert_eq!(
|
11133 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11738 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11134 11739 | http_response.status()
|
11135 11740 | );
|
11136 11741 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11137 11742 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11138 11743 | http_response.headers(),
|
11139 11744 | expected_headers,
|
11140 11745 | ));
|
11141 11746 | }
|
11142 11747 | }
|
11748 + |
|
11749 + | /* ProtocolTestGenerator.kt:98 */
|
11143 11750 | }
|
11144 11751 |
|
11752 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
11145 11753 | ::pin_project_lite::pin_project! {
|
11146 11754 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
11147 11755 | /// [`MalformedStringInput`](crate::input::MalformedStringInput) using modelled bindings.
|
11148 11756 | pub struct MalformedStringInputFuture {
|
11149 11757 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedStringInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
11150 11758 | }
|
11151 11759 | }
|
11152 11760 |
|
11153 11761 | impl std::future::Future for MalformedStringInputFuture {
|
11154 11762 | type Output = Result<
|
11155 11763 | crate::input::MalformedStringInput,
|
11156 11764 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
11157 11765 | >;
|
11158 11766 |
|
11159 11767 | fn poll(
|
11160 11768 | self: std::pin::Pin<&mut Self>,
|
11161 11769 | cx: &mut std::task::Context<'_>,
|
11162 11770 | ) -> std::task::Poll<Self::Output> {
|
11163 11771 | let this = self.project();
|
11164 11772 | this.inner.as_mut().poll(cx)
|
11165 11773 | }
|
11166 11774 | }
|
11167 11775 |
|
11168 11776 | impl<B>
|
11169 11777 | ::aws_smithy_http_server::request::FromRequest<
|
11170 11778 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
11171 11779 | B,
|
11172 11780 | > for crate::input::MalformedStringInput
|
11173 11781 | where
|
11174 11782 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
11175 11783 | B: 'static,
|
11176 11784 |
|
11177 11785 | B::Data: Send,
|
11178 11786 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
11179 11787 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
11180 11788 | {
|
11181 11789 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
11182 11790 | type Future = MalformedStringInputFuture;
|
11183 11791 |
|
11184 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
11792 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
11185 11793 | let fut = async move {
|
11186 11794 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
11187 11795 | request.headers(),
|
11188 11796 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
11189 11797 | ) {
|
11190 11798 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
11191 11799 | }
|
11192 11800 | crate::protocol_serde::shape_malformed_string::de_malformed_string_http_request(request)
|
11193 11801 | .await
|
11194 11802 | };
|
11195 11803 | use ::futures_util::future::TryFutureExt;
|
11196 11804 | let fut = fut.map_err(
|
11197 11805 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
11198 11806 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
11199 11807 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
11200 11808 | e,
|
11201 11809 | )
|
11202 11810 | },
|
11203 11811 | );
|
11204 11812 | MalformedStringInputFuture {
|
11205 11813 | inner: Box::pin(fut),
|
11206 11814 | }
|
11207 11815 | }
|
11208 11816 | }
|
11817 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
11209 11818 | impl
|
11210 11819 | ::aws_smithy_http_server::response::IntoResponse<
|
11211 11820 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
11212 11821 | > for crate::output::MalformedStringOutput
|
11213 11822 | {
|
11214 11823 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
11215 11824 | match crate::protocol_serde::shape_malformed_string::ser_malformed_string_http_response(
|
11216 11825 | self,
|
11217 11826 | ) {
|
11218 11827 | Ok(response) => response,
|
11219 11828 | Err(e) => {
|
11220 11829 | ::tracing::error!(error = %e, "failed to serialize response");
|
11221 11830 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
11222 11831 | }
|
11223 11832 | }
|
11224 11833 | }
|
11225 11834 | }
|
11226 11835 |
|
11836 + | /* RustType.kt:534 */
|
11227 11837 | #[allow(unreachable_code, unused_variables)]
|
11838 + | /* RustType.kt:534 */
|
11228 11839 | #[cfg(test)]
|
11840 + | /* ProtocolTestGenerator.kt:98 */
|
11229 11841 | mod malformed_string_test {
|
11230 11842 |
|
11231 11843 | /// When string with the mediaType trait is bound to a header, its value
|
11232 11844 | /// must be base64 encoded. The server should reject values that aren't
|
11233 11845 | /// valid base64 out of hand.
|
11234 11846 | /// Test ID: RestJsonHeaderMalformedStringInvalidBase64MediaType_case0
|
11235 11847 | #[::tokio::test]
|
11236 11848 | #[::tracing_test::traced_test]
|
11237 11849 | async fn rest_json_header_malformed_string_invalid_base64_media_type_case0_malformed_request() {
|
11238 11850 | {
|
11239 11851 | #[allow(unused_mut)]
|
11240 - | let mut http_request = http::Request::builder()
|
11852 + | let mut http_request = ::http_1x::Request::builder()
|
11241 11853 | .uri("/MalformedString")
|
11242 11854 | .method("POST")
|
11243 11855 | .header("content-type", "application/json")
|
11244 11856 | .header("amz-media-typed-header", "xyz")
|
11245 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11857 + | .body(::aws_smithy_http_server::body::boxed(
|
11858 + | ::http_body_util::Empty::new(),
|
11859 + | ))
|
11246 11860 | .unwrap();
|
11247 11861 | #[allow(unused_mut)]
|
11248 11862 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11249 11863 | let config = crate::service::RestJsonConfig::builder().build();
|
11250 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11864 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11251 11865 | .malformed_string(move |input: crate::input::MalformedStringInput| {
|
11252 11866 | let sender = sender.clone();
|
11253 11867 | async move {
|
11254 11868 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedStringOutput };
|
11255 11869 | sender.send(()).await.expect("receiver dropped early");
|
11256 11870 | result
|
11257 11871 | }
|
11258 11872 | })
|
11259 11873 | .build_unchecked();
|
11260 11874 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11261 11875 | .await
|
11262 11876 | .expect("unable to make an HTTP request");
|
11263 11877 | ::pretty_assertions::assert_eq!(
|
11264 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11878 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11265 11879 | http_response.status()
|
11266 11880 | );
|
11267 11881 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11268 11882 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11269 11883 | http_response.headers(),
|
11270 11884 | expected_headers,
|
11271 11885 | ));
|
11272 11886 | }
|
11273 11887 | }
|
11274 11888 |
|
11275 11889 | /// When string with the mediaType trait is bound to a header, its value
|
11276 11890 | /// must be base64 encoded. The server should reject values that aren't
|
11277 11891 | /// valid base64 out of hand.
|
11278 11892 | /// Test ID: RestJsonHeaderMalformedStringInvalidBase64MediaType_case1
|
11279 11893 | #[::tokio::test]
|
11280 11894 | #[::tracing_test::traced_test]
|
11281 11895 | async fn rest_json_header_malformed_string_invalid_base64_media_type_case1_malformed_request() {
|
11282 11896 | {
|
11283 11897 | #[allow(unused_mut)]
|
11284 - | let mut http_request = http::Request::builder()
|
11898 + | let mut http_request = ::http_1x::Request::builder()
|
11285 11899 | .uri("/MalformedString")
|
11286 11900 | .method("POST")
|
11287 11901 | .header("content-type", "application/json")
|
11288 11902 | .header("amz-media-typed-header", "YmxvYg=")
|
11289 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11903 + | .body(::aws_smithy_http_server::body::boxed(
|
11904 + | ::http_body_util::Empty::new(),
|
11905 + | ))
|
11290 11906 | .unwrap();
|
11291 11907 | #[allow(unused_mut)]
|
11292 11908 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11293 11909 | let config = crate::service::RestJsonConfig::builder().build();
|
11294 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11910 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11295 11911 | .malformed_string(move |input: crate::input::MalformedStringInput| {
|
11296 11912 | let sender = sender.clone();
|
11297 11913 | async move {
|
11298 11914 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedStringOutput };
|
11299 11915 | sender.send(()).await.expect("receiver dropped early");
|
11300 11916 | result
|
11301 11917 | }
|
11302 11918 | })
|
11303 11919 | .build_unchecked();
|
11304 11920 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11305 11921 | .await
|
11306 11922 | .expect("unable to make an HTTP request");
|
11307 11923 | ::pretty_assertions::assert_eq!(
|
11308 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11924 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11309 11925 | http_response.status()
|
11310 11926 | );
|
11311 11927 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11312 11928 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11313 11929 | http_response.headers(),
|
11314 11930 | expected_headers,
|
11315 11931 | ));
|
11316 11932 | }
|
11317 11933 | }
|
11318 11934 |
|
11319 11935 | /// When string with the mediaType trait is bound to a header, its value
|
11320 11936 | /// must be base64 encoded. The server should reject values that aren't
|
11321 11937 | /// valid base64 out of hand.
|
11322 11938 | /// Test ID: RestJsonHeaderMalformedStringInvalidBase64MediaType_case2
|
11323 11939 | #[::tokio::test]
|
11324 11940 | #[::tracing_test::traced_test]
|
11325 11941 | async fn rest_json_header_malformed_string_invalid_base64_media_type_case2_malformed_request() {
|
11326 11942 | {
|
11327 11943 | #[allow(unused_mut)]
|
11328 - | let mut http_request = http::Request::builder()
|
11944 + | let mut http_request = ::http_1x::Request::builder()
|
11329 11945 | .uri("/MalformedString")
|
11330 11946 | .method("POST")
|
11331 11947 | .header("content-type", "application/json")
|
11332 11948 | .header("amz-media-typed-header", "[][]")
|
11333 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11949 + | .body(::aws_smithy_http_server::body::boxed(
|
11950 + | ::http_body_util::Empty::new(),
|
11951 + | ))
|
11334 11952 | .unwrap();
|
11335 11953 | #[allow(unused_mut)]
|
11336 11954 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11337 11955 | let config = crate::service::RestJsonConfig::builder().build();
|
11338 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
11956 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11339 11957 | .malformed_string(move |input: crate::input::MalformedStringInput| {
|
11340 11958 | let sender = sender.clone();
|
11341 11959 | async move {
|
11342 11960 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedStringOutput };
|
11343 11961 | sender.send(()).await.expect("receiver dropped early");
|
11344 11962 | result
|
11345 11963 | }
|
11346 11964 | })
|
11347 11965 | .build_unchecked();
|
11348 11966 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11349 11967 | .await
|
11350 11968 | .expect("unable to make an HTTP request");
|
11351 11969 | ::pretty_assertions::assert_eq!(
|
11352 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11970 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11353 11971 | http_response.status()
|
11354 11972 | );
|
11355 11973 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11356 11974 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11357 11975 | http_response.headers(),
|
11358 11976 | expected_headers,
|
11359 11977 | ));
|
11360 11978 | }
|
11361 11979 | }
|
11362 11980 |
|
11363 11981 | /// When string with the mediaType trait is bound to a header, its value
|
11364 11982 | /// must be base64 encoded. The server should reject values that aren't
|
11365 11983 | /// valid base64 out of hand.
|
11366 11984 | /// Test ID: RestJsonHeaderMalformedStringInvalidBase64MediaType_case3
|
11367 11985 | #[::tokio::test]
|
11368 11986 | #[::tracing_test::traced_test]
|
11369 11987 | async fn rest_json_header_malformed_string_invalid_base64_media_type_case3_malformed_request() {
|
11370 11988 | {
|
11371 11989 | #[allow(unused_mut)]
|
11372 - | let mut http_request = http::Request::builder()
|
11990 + | let mut http_request = ::http_1x::Request::builder()
|
11373 11991 | .uri("/MalformedString")
|
11374 11992 | .method("POST")
|
11375 11993 | .header("content-type", "application/json")
|
11376 11994 | .header("amz-media-typed-header", "-_==")
|
11377 - | .body(::aws_smithy_http_server::body::Body::empty())
|
11995 + | .body(::aws_smithy_http_server::body::boxed(
|
11996 + | ::http_body_util::Empty::new(),
|
11997 + | ))
|
11378 11998 | .unwrap();
|
11379 11999 | #[allow(unused_mut)]
|
11380 12000 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11381 12001 | let config = crate::service::RestJsonConfig::builder().build();
|
11382 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12002 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11383 12003 | .malformed_string(move |input: crate::input::MalformedStringInput| {
|
11384 12004 | let sender = sender.clone();
|
11385 12005 | async move {
|
11386 12006 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedStringOutput };
|
11387 12007 | sender.send(()).await.expect("receiver dropped early");
|
11388 12008 | result
|
11389 12009 | }
|
11390 12010 | })
|
11391 12011 | .build_unchecked();
|
11392 12012 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11393 12013 | .await
|
11394 12014 | .expect("unable to make an HTTP request");
|
11395 12015 | ::pretty_assertions::assert_eq!(
|
11396 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12016 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11397 12017 | http_response.status()
|
11398 12018 | );
|
11399 12019 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11400 12020 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11401 12021 | http_response.headers(),
|
11402 12022 | expected_headers,
|
11403 12023 | ));
|
11404 12024 | }
|
11405 12025 | }
|
12026 + |
|
12027 + | /* ProtocolTestGenerator.kt:98 */
|
11406 12028 | }
|
11407 12029 |
|
12030 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
11408 12031 | ::pin_project_lite::pin_project! {
|
11409 12032 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
11410 12033 | /// [`MalformedDoubleInput`](crate::input::MalformedDoubleInput) using modelled bindings.
|
11411 12034 | pub struct MalformedDoubleInputFuture {
|
11412 12035 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedDoubleInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
11413 12036 | }
|
11414 12037 | }
|
11415 12038 |
|
11416 12039 | impl std::future::Future for MalformedDoubleInputFuture {
|
11417 12040 | type Output = Result<
|
11418 12041 | crate::input::MalformedDoubleInput,
|
11419 12042 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
11420 12043 | >;
|
11421 12044 |
|
11422 12045 | fn poll(
|
11423 12046 | self: std::pin::Pin<&mut Self>,
|
11424 12047 | cx: &mut std::task::Context<'_>,
|
11425 12048 | ) -> std::task::Poll<Self::Output> {
|
11426 12049 | let this = self.project();
|
11427 12050 | this.inner.as_mut().poll(cx)
|
11428 12051 | }
|
11429 12052 | }
|
11430 12053 |
|
11431 12054 | impl<B>
|
11432 12055 | ::aws_smithy_http_server::request::FromRequest<
|
11433 12056 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
11434 12057 | B,
|
11435 12058 | > for crate::input::MalformedDoubleInput
|
11436 12059 | where
|
11437 12060 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
11438 12061 | B: 'static,
|
11439 12062 |
|
11440 12063 | B::Data: Send,
|
11441 12064 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
11442 12065 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
11443 12066 | {
|
11444 12067 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
11445 12068 | type Future = MalformedDoubleInputFuture;
|
11446 12069 |
|
11447 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
12070 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
11448 12071 | let fut = async move {
|
11449 12072 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
11450 12073 | request.headers(),
|
11451 12074 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
11452 12075 | ) {
|
11453 12076 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
11454 12077 | }
|
11455 12078 | crate::protocol_serde::shape_malformed_double::de_malformed_double_http_request(request)
|
11456 12079 | .await
|
11457 12080 | };
|
11458 12081 | use ::futures_util::future::TryFutureExt;
|
11459 12082 | let fut = fut.map_err(
|
11460 12083 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
11461 12084 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
11462 12085 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
11463 12086 | e,
|
11464 12087 | )
|
11465 12088 | },
|
11466 12089 | );
|
11467 12090 | MalformedDoubleInputFuture {
|
11468 12091 | inner: Box::pin(fut),
|
11469 12092 | }
|
11470 12093 | }
|
11471 12094 | }
|
12095 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
11472 12096 | impl
|
11473 12097 | ::aws_smithy_http_server::response::IntoResponse<
|
11474 12098 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
11475 12099 | > for crate::output::MalformedDoubleOutput
|
11476 12100 | {
|
11477 12101 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
11478 12102 | match crate::protocol_serde::shape_malformed_double::ser_malformed_double_http_response(
|
11479 12103 | self,
|
11480 12104 | ) {
|
11481 12105 | Ok(response) => response,
|
11482 12106 | Err(e) => {
|
11483 12107 | ::tracing::error!(error = %e, "failed to serialize response");
|
11484 12108 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
11485 12109 | }
|
11486 12110 | }
|
11487 12111 | }
|
11488 12112 | }
|
12113 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
11489 12114 | impl
|
11490 12115 | ::aws_smithy_http_server::response::IntoResponse<
|
11491 12116 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
11492 12117 | > for crate::error::MalformedDoubleError
|
11493 12118 | {
|
11494 12119 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
11495 12120 | match crate::protocol_serde::shape_malformed_double::ser_malformed_double_http_error(&self)
|
11496 12121 | {
|
11497 12122 | Ok(mut response) => {
|
11498 12123 | response.extensions_mut().insert(
|
11499 12124 | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
11500 12125 | );
|
11501 12126 | response
|
11502 12127 | }
|
11503 12128 | Err(e) => {
|
11504 12129 | ::tracing::error!(error = %e, "failed to serialize response");
|
11505 12130 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
11506 12131 | }
|
11507 12132 | }
|
11508 12133 | }
|
11509 12134 | }
|
11510 12135 |
|
12136 + | /* RustType.kt:534 */
|
11511 12137 | #[allow(unreachable_code, unused_variables)]
|
12138 + | /* RustType.kt:534 */
|
11512 12139 | #[cfg(test)]
|
12140 + | /* ProtocolTestGenerator.kt:98 */
|
11513 12141 | mod malformed_double_test {
|
11514 12142 |
|
11515 12143 | /// Malformed values in the body should be rejected
|
11516 12144 | /// Test ID: RestJsonBodyDoubleMalformedValueRejected_case0
|
11517 12145 | #[::tokio::test]
|
11518 12146 | #[::tracing_test::traced_test]
|
11519 12147 | async fn rest_json_body_double_malformed_value_rejected_case0_malformed_request() {
|
11520 12148 | {
|
11521 12149 | #[allow(unused_mut)]
|
11522 - | let mut http_request = http::Request::builder()
|
12150 + | let mut http_request = ::http_1x::Request::builder()
|
11523 12151 | .uri("/MalformedDouble/1")
|
11524 12152 | .method("POST")
|
11525 12153 | .header("content-type", "application/json")
|
11526 - | .body(::aws_smithy_http_server::body::Body::from(
|
11527 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
11528 - | "{ \"doubleInBody\" : \"123\" }".as_bytes(),
|
11529 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12154 + | .body(::aws_smithy_http_server::body::boxed(
|
12155 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
12156 + | &::aws_smithy_protocol_test::decode_body_data(
|
12157 + | "{ \"doubleInBody\" : \"123\" }".as_bytes(),
|
12158 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12159 + | ),
|
11530 12160 | )),
|
11531 12161 | ))
|
11532 12162 | .unwrap();
|
11533 12163 | #[allow(unused_mut)]
|
11534 12164 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11535 12165 | let config = crate::service::RestJsonConfig::builder().build();
|
11536 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12166 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11537 12167 | .malformed_double(move |input: crate::input::MalformedDoubleInput| {
|
11538 12168 | let sender = sender.clone();
|
11539 12169 | async move {
|
11540 12170 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedDoubleOutput, crate::error::MalformedDoubleError> };
|
11541 12171 | sender.send(()).await.expect("receiver dropped early");
|
11542 12172 | result
|
11543 12173 | }
|
11544 12174 | })
|
11545 12175 | .build_unchecked();
|
11546 12176 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11547 12177 | .await
|
11548 12178 | .expect("unable to make an HTTP request");
|
11549 12179 | ::pretty_assertions::assert_eq!(
|
11550 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12180 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11551 12181 | http_response.status()
|
11552 12182 | );
|
11553 12183 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11554 12184 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11555 12185 | http_response.headers(),
|
11556 12186 | expected_headers,
|
11557 12187 | ));
|
11558 12188 | }
|
11559 12189 | }
|
11560 12190 |
|
11561 12191 | /// Malformed values in the body should be rejected
|
11562 12192 | /// Test ID: RestJsonBodyDoubleMalformedValueRejected_case1
|
11563 12193 | #[::tokio::test]
|
11564 12194 | #[::tracing_test::traced_test]
|
11565 12195 | async fn rest_json_body_double_malformed_value_rejected_case1_malformed_request() {
|
11566 12196 | {
|
11567 12197 | #[allow(unused_mut)]
|
11568 - | let mut http_request = http::Request::builder()
|
12198 + | let mut http_request = ::http_1x::Request::builder()
|
11569 12199 | .uri("/MalformedDouble/1")
|
11570 12200 | .method("POST")
|
11571 12201 | .header("content-type", "application/json")
|
11572 - | .body(::aws_smithy_http_server::body::Body::from(
|
11573 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
11574 - | "{ \"doubleInBody\" : true }".as_bytes(),
|
11575 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12202 + | .body(::aws_smithy_http_server::body::boxed(
|
12203 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
12204 + | &::aws_smithy_protocol_test::decode_body_data(
|
12205 + | "{ \"doubleInBody\" : true }".as_bytes(),
|
12206 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12207 + | ),
|
11576 12208 | )),
|
11577 12209 | ))
|
11578 12210 | .unwrap();
|
11579 12211 | #[allow(unused_mut)]
|
11580 12212 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11581 12213 | let config = crate::service::RestJsonConfig::builder().build();
|
11582 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12214 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11583 12215 | .malformed_double(move |input: crate::input::MalformedDoubleInput| {
|
11584 12216 | let sender = sender.clone();
|
11585 12217 | async move {
|
11586 12218 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedDoubleOutput, crate::error::MalformedDoubleError> };
|
11587 12219 | sender.send(()).await.expect("receiver dropped early");
|
11588 12220 | result
|
11589 12221 | }
|
11590 12222 | })
|
11591 12223 | .build_unchecked();
|
11592 12224 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11593 12225 | .await
|
11594 12226 | .expect("unable to make an HTTP request");
|
11595 12227 | ::pretty_assertions::assert_eq!(
|
11596 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12228 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11597 12229 | http_response.status()
|
11598 12230 | );
|
11599 12231 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11600 12232 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11601 12233 | http_response.headers(),
|
11602 12234 | expected_headers,
|
11603 12235 | ));
|
11604 12236 | }
|
11605 12237 | }
|
11606 12238 |
|
11607 12239 | /// Malformed values in the body should be rejected
|
11608 12240 | /// Test ID: RestJsonBodyDoubleMalformedValueRejected_case2
|
11609 12241 | #[::tokio::test]
|
11610 12242 | #[::tracing_test::traced_test]
|
11611 12243 | async fn rest_json_body_double_malformed_value_rejected_case2_malformed_request() {
|
11612 12244 | {
|
11613 12245 | #[allow(unused_mut)]
|
11614 - | let mut http_request = http::Request::builder()
|
12246 + | let mut http_request = ::http_1x::Request::builder()
|
11615 12247 | .uri("/MalformedDouble/1")
|
11616 12248 | .method("POST")
|
11617 12249 | .header("content-type", "application/json")
|
11618 - | .body(::aws_smithy_http_server::body::Body::from(
|
11619 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
11620 - | "{ \"doubleInBody\" : 2ABC }".as_bytes(),
|
11621 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12250 + | .body(::aws_smithy_http_server::body::boxed(
|
12251 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
12252 + | &::aws_smithy_protocol_test::decode_body_data(
|
12253 + | "{ \"doubleInBody\" : 2ABC }".as_bytes(),
|
12254 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12255 + | ),
|
11622 12256 | )),
|
11623 12257 | ))
|
11624 12258 | .unwrap();
|
11625 12259 | #[allow(unused_mut)]
|
11626 12260 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11627 12261 | let config = crate::service::RestJsonConfig::builder().build();
|
11628 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12262 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11629 12263 | .malformed_double(move |input: crate::input::MalformedDoubleInput| {
|
11630 12264 | let sender = sender.clone();
|
11631 12265 | async move {
|
11632 12266 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedDoubleOutput, crate::error::MalformedDoubleError> };
|
11633 12267 | sender.send(()).await.expect("receiver dropped early");
|
11634 12268 | result
|
11635 12269 | }
|
11636 12270 | })
|
11637 12271 | .build_unchecked();
|
11638 12272 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11639 12273 | .await
|
11640 12274 | .expect("unable to make an HTTP request");
|
11641 12275 | ::pretty_assertions::assert_eq!(
|
11642 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12276 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11643 12277 | http_response.status()
|
11644 12278 | );
|
11645 12279 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11646 12280 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11647 12281 | http_response.headers(),
|
11648 12282 | expected_headers,
|
11649 12283 | ));
|
11650 12284 | }
|
11651 12285 | }
|
11652 12286 |
|
11653 12287 | /// Malformed values in the body should be rejected
|
11654 12288 | /// Test ID: RestJsonBodyDoubleMalformedValueRejected_case3
|
11655 12289 | #[::tokio::test]
|
11656 12290 | #[::tracing_test::traced_test]
|
11657 12291 | async fn rest_json_body_double_malformed_value_rejected_case3_malformed_request() {
|
11658 12292 | {
|
11659 12293 | #[allow(unused_mut)]
|
11660 - | let mut http_request = http::Request::builder()
|
12294 + | let mut http_request = ::http_1x::Request::builder()
|
11661 12295 | .uri("/MalformedDouble/1")
|
11662 12296 | .method("POST")
|
11663 12297 | .header("content-type", "application/json")
|
11664 - | .body(::aws_smithy_http_server::body::Body::from(
|
11665 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
11666 - | "{ \"doubleInBody\" : 0x42 }".as_bytes(),
|
11667 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12298 + | .body(::aws_smithy_http_server::body::boxed(
|
12299 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
12300 + | &::aws_smithy_protocol_test::decode_body_data(
|
12301 + | "{ \"doubleInBody\" : 0x42 }".as_bytes(),
|
12302 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12303 + | ),
|
11668 12304 | )),
|
11669 12305 | ))
|
11670 12306 | .unwrap();
|
11671 12307 | #[allow(unused_mut)]
|
11672 12308 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11673 12309 | let config = crate::service::RestJsonConfig::builder().build();
|
11674 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12310 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11675 12311 | .malformed_double(move |input: crate::input::MalformedDoubleInput| {
|
11676 12312 | let sender = sender.clone();
|
11677 12313 | async move {
|
11678 12314 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedDoubleOutput, crate::error::MalformedDoubleError> };
|
11679 12315 | sender.send(()).await.expect("receiver dropped early");
|
11680 12316 | result
|
11681 12317 | }
|
11682 12318 | })
|
11683 12319 | .build_unchecked();
|
11684 12320 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11685 12321 | .await
|
11686 12322 | .expect("unable to make an HTTP request");
|
11687 12323 | ::pretty_assertions::assert_eq!(
|
11688 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12324 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11689 12325 | http_response.status()
|
11690 12326 | );
|
11691 12327 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11692 12328 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11693 12329 | http_response.headers(),
|
11694 12330 | expected_headers,
|
11695 12331 | ));
|
11696 12332 | }
|
11697 12333 | }
|
11698 12334 |
|
11699 12335 | /// Malformed values in the body should be rejected
|
11700 12336 | /// Test ID: RestJsonBodyDoubleMalformedValueRejected_case4
|
11701 12337 | #[::tokio::test]
|
11702 12338 | #[::tracing_test::traced_test]
|
11703 12339 | async fn rest_json_body_double_malformed_value_rejected_case4_malformed_request() {
|
11704 12340 | {
|
11705 12341 | #[allow(unused_mut)]
|
11706 - | let mut http_request = http::Request::builder()
|
12342 + | let mut http_request = ::http_1x::Request::builder()
|
11707 12343 | .uri("/MalformedDouble/1")
|
11708 12344 | .method("POST")
|
11709 12345 | .header("content-type", "application/json")
|
11710 - | .body(::aws_smithy_http_server::body::Body::from(
|
11711 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
11712 - | "{ \"doubleInBody\" : Infinity }".as_bytes(),
|
11713 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12346 + | .body(::aws_smithy_http_server::body::boxed(
|
12347 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
12348 + | &::aws_smithy_protocol_test::decode_body_data(
|
12349 + | "{ \"doubleInBody\" : Infinity }".as_bytes(),
|
12350 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12351 + | ),
|
11714 12352 | )),
|
11715 12353 | ))
|
11716 12354 | .unwrap();
|
11717 12355 | #[allow(unused_mut)]
|
11718 12356 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11719 12357 | let config = crate::service::RestJsonConfig::builder().build();
|
11720 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12358 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11721 12359 | .malformed_double(move |input: crate::input::MalformedDoubleInput| {
|
11722 12360 | let sender = sender.clone();
|
11723 12361 | async move {
|
11724 12362 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedDoubleOutput, crate::error::MalformedDoubleError> };
|
11725 12363 | sender.send(()).await.expect("receiver dropped early");
|
11726 12364 | result
|
11727 12365 | }
|
11728 12366 | })
|
11729 12367 | .build_unchecked();
|
11730 12368 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11731 12369 | .await
|
11732 12370 | .expect("unable to make an HTTP request");
|
11733 12371 | ::pretty_assertions::assert_eq!(
|
11734 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12372 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11735 12373 | http_response.status()
|
11736 12374 | );
|
11737 12375 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11738 12376 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11739 12377 | http_response.headers(),
|
11740 12378 | expected_headers,
|
11741 12379 | ));
|
11742 12380 | }
|
11743 12381 | }
|
11744 12382 |
|
11745 12383 | /// Malformed values in the body should be rejected
|
11746 12384 | /// Test ID: RestJsonBodyDoubleMalformedValueRejected_case5
|
11747 12385 | #[::tokio::test]
|
11748 12386 | #[::tracing_test::traced_test]
|
11749 12387 | async fn rest_json_body_double_malformed_value_rejected_case5_malformed_request() {
|
11750 12388 | {
|
11751 12389 | #[allow(unused_mut)]
|
11752 - | let mut http_request = http::Request::builder()
|
12390 + | let mut http_request = ::http_1x::Request::builder()
|
11753 12391 | .uri("/MalformedDouble/1")
|
11754 12392 | .method("POST")
|
11755 12393 | .header("content-type", "application/json")
|
11756 - | .body(::aws_smithy_http_server::body::Body::from(
|
11757 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
11758 - | "{ \"doubleInBody\" : -Infinity }".as_bytes(),
|
11759 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12394 + | .body(::aws_smithy_http_server::body::boxed(
|
12395 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
12396 + | &::aws_smithy_protocol_test::decode_body_data(
|
12397 + | "{ \"doubleInBody\" : -Infinity }".as_bytes(),
|
12398 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12399 + | ),
|
11760 12400 | )),
|
11761 12401 | ))
|
11762 12402 | .unwrap();
|
11763 12403 | #[allow(unused_mut)]
|
11764 12404 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11765 12405 | let config = crate::service::RestJsonConfig::builder().build();
|
11766 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12406 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11767 12407 | .malformed_double(move |input: crate::input::MalformedDoubleInput| {
|
11768 12408 | let sender = sender.clone();
|
11769 12409 | async move {
|
11770 12410 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedDoubleOutput, crate::error::MalformedDoubleError> };
|
11771 12411 | sender.send(()).await.expect("receiver dropped early");
|
11772 12412 | result
|
11773 12413 | }
|
11774 12414 | })
|
11775 12415 | .build_unchecked();
|
11776 12416 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11777 12417 | .await
|
11778 12418 | .expect("unable to make an HTTP request");
|
11779 12419 | ::pretty_assertions::assert_eq!(
|
11780 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12420 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11781 12421 | http_response.status()
|
11782 12422 | );
|
11783 12423 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11784 12424 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11785 12425 | http_response.headers(),
|
11786 12426 | expected_headers,
|
11787 12427 | ));
|
11788 12428 | }
|
11789 12429 | }
|
11790 12430 |
|
11791 12431 | /// Malformed values in the body should be rejected
|
11792 12432 | /// Test ID: RestJsonBodyDoubleMalformedValueRejected_case6
|
11793 12433 | #[::tokio::test]
|
11794 12434 | #[::tracing_test::traced_test]
|
11795 12435 | async fn rest_json_body_double_malformed_value_rejected_case6_malformed_request() {
|
11796 12436 | {
|
11797 12437 | #[allow(unused_mut)]
|
11798 - | let mut http_request = http::Request::builder()
|
12438 + | let mut http_request = ::http_1x::Request::builder()
|
11799 12439 | .uri("/MalformedDouble/1")
|
11800 12440 | .method("POST")
|
11801 12441 | .header("content-type", "application/json")
|
11802 - | .body(::aws_smithy_http_server::body::Body::from(
|
11803 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
11804 - | "{ \"doubleInBody\" : NaN }".as_bytes(),
|
11805 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12442 + | .body(::aws_smithy_http_server::body::boxed(
|
12443 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
12444 + | &::aws_smithy_protocol_test::decode_body_data(
|
12445 + | "{ \"doubleInBody\" : NaN }".as_bytes(),
|
12446 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12447 + | ),
|
11806 12448 | )),
|
11807 12449 | ))
|
11808 12450 | .unwrap();
|
11809 12451 | #[allow(unused_mut)]
|
11810 12452 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11811 12453 | let config = crate::service::RestJsonConfig::builder().build();
|
11812 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12454 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11813 12455 | .malformed_double(move |input: crate::input::MalformedDoubleInput| {
|
11814 12456 | let sender = sender.clone();
|
11815 12457 | async move {
|
11816 12458 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedDoubleOutput, crate::error::MalformedDoubleError> };
|
11817 12459 | sender.send(()).await.expect("receiver dropped early");
|
11818 12460 | result
|
11819 12461 | }
|
11820 12462 | })
|
11821 12463 | .build_unchecked();
|
11822 12464 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11823 12465 | .await
|
11824 12466 | .expect("unable to make an HTTP request");
|
11825 12467 | ::pretty_assertions::assert_eq!(
|
11826 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12468 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11827 12469 | http_response.status()
|
11828 12470 | );
|
11829 12471 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11830 12472 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11831 12473 | http_response.headers(),
|
11832 12474 | expected_headers,
|
11833 12475 | ));
|
11834 12476 | }
|
11835 12477 | }
|
11836 12478 |
|
11837 12479 | /// Malformed values in the path should be rejected
|
11838 12480 | /// Test ID: RestJsonPathDoubleMalformedValueRejected_case0
|
11839 12481 | #[::tokio::test]
|
11840 12482 | #[::tracing_test::traced_test]
|
11841 12483 | async fn rest_json_path_double_malformed_value_rejected_case0_malformed_request() {
|
11842 12484 | {
|
11843 12485 | #[allow(unused_mut)]
|
11844 - | let mut http_request = http::Request::builder()
|
12486 + | let mut http_request = ::http_1x::Request::builder()
|
11845 12487 | .uri("/MalformedDouble/true")
|
11846 12488 | .method("POST")
|
11847 - | .body(::aws_smithy_http_server::body::Body::empty())
|
12489 + | .body(::aws_smithy_http_server::body::boxed(
|
12490 + | ::http_body_util::Empty::new(),
|
12491 + | ))
|
11848 12492 | .unwrap();
|
11849 12493 | #[allow(unused_mut)]
|
11850 12494 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11851 12495 | let config = crate::service::RestJsonConfig::builder().build();
|
11852 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12496 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11853 12497 | .malformed_double(move |input: crate::input::MalformedDoubleInput| {
|
11854 12498 | let sender = sender.clone();
|
11855 12499 | async move {
|
11856 12500 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedDoubleOutput, crate::error::MalformedDoubleError> };
|
11857 12501 | sender.send(()).await.expect("receiver dropped early");
|
11858 12502 | result
|
11859 12503 | }
|
11860 12504 | })
|
11861 12505 | .build_unchecked();
|
11862 12506 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11863 12507 | .await
|
11864 12508 | .expect("unable to make an HTTP request");
|
11865 12509 | ::pretty_assertions::assert_eq!(
|
11866 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12510 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11867 12511 | http_response.status()
|
11868 12512 | );
|
11869 12513 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11870 12514 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11871 12515 | http_response.headers(),
|
11872 12516 | expected_headers,
|
11873 12517 | ));
|
11874 12518 | }
|
11875 12519 | }
|
11876 12520 |
|
11877 12521 | /// Malformed values in the path should be rejected
|
11878 12522 | /// Test ID: RestJsonPathDoubleMalformedValueRejected_case1
|
11879 12523 | #[::tokio::test]
|
11880 12524 | #[::tracing_test::traced_test]
|
11881 12525 | async fn rest_json_path_double_malformed_value_rejected_case1_malformed_request() {
|
11882 12526 | {
|
11883 12527 | #[allow(unused_mut)]
|
11884 - | let mut http_request = http::Request::builder()
|
12528 + | let mut http_request = ::http_1x::Request::builder()
|
11885 12529 | .uri("/MalformedDouble/2ABC")
|
11886 12530 | .method("POST")
|
11887 - | .body(::aws_smithy_http_server::body::Body::empty())
|
12531 + | .body(::aws_smithy_http_server::body::boxed(
|
12532 + | ::http_body_util::Empty::new(),
|
12533 + | ))
|
11888 12534 | .unwrap();
|
11889 12535 | #[allow(unused_mut)]
|
11890 12536 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11891 12537 | let config = crate::service::RestJsonConfig::builder().build();
|
11892 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12538 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11893 12539 | .malformed_double(move |input: crate::input::MalformedDoubleInput| {
|
11894 12540 | let sender = sender.clone();
|
11895 12541 | async move {
|
11896 12542 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedDoubleOutput, crate::error::MalformedDoubleError> };
|
11897 12543 | sender.send(()).await.expect("receiver dropped early");
|
11898 12544 | result
|
11899 12545 | }
|
11900 12546 | })
|
11901 12547 | .build_unchecked();
|
11902 12548 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11903 12549 | .await
|
11904 12550 | .expect("unable to make an HTTP request");
|
11905 12551 | ::pretty_assertions::assert_eq!(
|
11906 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12552 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11907 12553 | http_response.status()
|
11908 12554 | );
|
11909 12555 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11910 12556 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11911 12557 | http_response.headers(),
|
11912 12558 | expected_headers,
|
11913 12559 | ));
|
11914 12560 | }
|
11915 12561 | }
|
11916 12562 |
|
11917 12563 | /// Malformed values in the path should be rejected
|
11918 12564 | /// Test ID: RestJsonPathDoubleMalformedValueRejected_case2
|
11919 12565 | #[::tokio::test]
|
11920 12566 | #[::tracing_test::traced_test]
|
11921 12567 | async fn rest_json_path_double_malformed_value_rejected_case2_malformed_request() {
|
11922 12568 | {
|
11923 12569 | #[allow(unused_mut)]
|
11924 - | let mut http_request = http::Request::builder()
|
12570 + | let mut http_request = ::http_1x::Request::builder()
|
11925 12571 | .uri("/MalformedDouble/0x42")
|
11926 12572 | .method("POST")
|
11927 - | .body(::aws_smithy_http_server::body::Body::empty())
|
12573 + | .body(::aws_smithy_http_server::body::boxed(
|
12574 + | ::http_body_util::Empty::new(),
|
12575 + | ))
|
11928 12576 | .unwrap();
|
11929 12577 | #[allow(unused_mut)]
|
11930 12578 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11931 12579 | let config = crate::service::RestJsonConfig::builder().build();
|
11932 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12580 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11933 12581 | .malformed_double(move |input: crate::input::MalformedDoubleInput| {
|
11934 12582 | let sender = sender.clone();
|
11935 12583 | async move {
|
11936 12584 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedDoubleOutput, crate::error::MalformedDoubleError> };
|
11937 12585 | sender.send(()).await.expect("receiver dropped early");
|
11938 12586 | result
|
11939 12587 | }
|
11940 12588 | })
|
11941 12589 | .build_unchecked();
|
11942 12590 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11943 12591 | .await
|
11944 12592 | .expect("unable to make an HTTP request");
|
11945 12593 | ::pretty_assertions::assert_eq!(
|
11946 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12594 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11947 12595 | http_response.status()
|
11948 12596 | );
|
11949 12597 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11950 12598 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11951 12599 | http_response.headers(),
|
11952 12600 | expected_headers,
|
11953 12601 | ));
|
11954 12602 | }
|
11955 12603 | }
|
11956 12604 |
|
11957 12605 | /// Malformed values in query parameters should be rejected
|
11958 12606 | /// Test ID: RestJsonQueryDoubleMalformedValueRejected_case0
|
11959 12607 | #[::tokio::test]
|
11960 12608 | #[::tracing_test::traced_test]
|
11961 12609 | async fn rest_json_query_double_malformed_value_rejected_case0_malformed_request() {
|
11962 12610 | {
|
11963 12611 | #[allow(unused_mut)]
|
11964 - | let mut http_request = http::Request::builder()
|
12612 + | let mut http_request = ::http_1x::Request::builder()
|
11965 12613 | .uri("/MalformedDouble/1")
|
11966 12614 | .method("POST")
|
11967 - | .body(::aws_smithy_http_server::body::Body::empty())
|
12615 + | .body(::aws_smithy_http_server::body::boxed(
|
12616 + | ::http_body_util::Empty::new(),
|
12617 + | ))
|
11968 12618 | .unwrap();
|
11969 12619 | *http_request.uri_mut() = "/MalformedDouble/1?doubleInQuery=true".parse().unwrap();
|
11970 12620 | #[allow(unused_mut)]
|
11971 12621 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
11972 12622 | let config = crate::service::RestJsonConfig::builder().build();
|
11973 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12623 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
11974 12624 | .malformed_double(move |input: crate::input::MalformedDoubleInput| {
|
11975 12625 | let sender = sender.clone();
|
11976 12626 | async move {
|
11977 12627 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedDoubleOutput, crate::error::MalformedDoubleError> };
|
11978 12628 | sender.send(()).await.expect("receiver dropped early");
|
11979 12629 | result
|
11980 12630 | }
|
11981 12631 | })
|
11982 12632 | .build_unchecked();
|
11983 12633 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
11984 12634 | .await
|
11985 12635 | .expect("unable to make an HTTP request");
|
11986 12636 | ::pretty_assertions::assert_eq!(
|
11987 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12637 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
11988 12638 | http_response.status()
|
11989 12639 | );
|
11990 12640 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
11991 12641 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11992 12642 | http_response.headers(),
|
11993 12643 | expected_headers,
|
11994 12644 | ));
|
11995 12645 | }
|
11996 12646 | }
|
11997 12647 |
|
11998 12648 | /// Malformed values in query parameters should be rejected
|
11999 12649 | /// Test ID: RestJsonQueryDoubleMalformedValueRejected_case1
|
12000 12650 | #[::tokio::test]
|
12001 12651 | #[::tracing_test::traced_test]
|
12002 12652 | async fn rest_json_query_double_malformed_value_rejected_case1_malformed_request() {
|
12003 12653 | {
|
12004 12654 | #[allow(unused_mut)]
|
12005 - | let mut http_request = http::Request::builder()
|
12655 + | let mut http_request = ::http_1x::Request::builder()
|
12006 12656 | .uri("/MalformedDouble/1")
|
12007 12657 | .method("POST")
|
12008 - | .body(::aws_smithy_http_server::body::Body::empty())
|
12658 + | .body(::aws_smithy_http_server::body::boxed(
|
12659 + | ::http_body_util::Empty::new(),
|
12660 + | ))
|
12009 12661 | .unwrap();
|
12010 12662 | *http_request.uri_mut() = "/MalformedDouble/1?doubleInQuery=2ABC".parse().unwrap();
|
12011 12663 | #[allow(unused_mut)]
|
12012 12664 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12013 12665 | let config = crate::service::RestJsonConfig::builder().build();
|
12014 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12666 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12015 12667 | .malformed_double(move |input: crate::input::MalformedDoubleInput| {
|
12016 12668 | let sender = sender.clone();
|
12017 12669 | async move {
|
12018 12670 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedDoubleOutput, crate::error::MalformedDoubleError> };
|
12019 12671 | sender.send(()).await.expect("receiver dropped early");
|
12020 12672 | result
|
12021 12673 | }
|
12022 12674 | })
|
12023 12675 | .build_unchecked();
|
12024 12676 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12025 12677 | .await
|
12026 12678 | .expect("unable to make an HTTP request");
|
12027 12679 | ::pretty_assertions::assert_eq!(
|
12028 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12680 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12029 12681 | http_response.status()
|
12030 12682 | );
|
12031 12683 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12032 12684 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12033 12685 | http_response.headers(),
|
12034 12686 | expected_headers,
|
12035 12687 | ));
|
12036 12688 | }
|
12037 12689 | }
|
12038 12690 |
|
12039 12691 | /// Malformed values in query parameters should be rejected
|
12040 12692 | /// Test ID: RestJsonQueryDoubleMalformedValueRejected_case2
|
12041 12693 | #[::tokio::test]
|
12042 12694 | #[::tracing_test::traced_test]
|
12043 12695 | async fn rest_json_query_double_malformed_value_rejected_case2_malformed_request() {
|
12044 12696 | {
|
12045 12697 | #[allow(unused_mut)]
|
12046 - | let mut http_request = http::Request::builder()
|
12698 + | let mut http_request = ::http_1x::Request::builder()
|
12047 12699 | .uri("/MalformedDouble/1")
|
12048 12700 | .method("POST")
|
12049 - | .body(::aws_smithy_http_server::body::Body::empty())
|
12701 + | .body(::aws_smithy_http_server::body::boxed(
|
12702 + | ::http_body_util::Empty::new(),
|
12703 + | ))
|
12050 12704 | .unwrap();
|
12051 12705 | *http_request.uri_mut() = "/MalformedDouble/1?doubleInQuery=0x42".parse().unwrap();
|
12052 12706 | #[allow(unused_mut)]
|
12053 12707 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12054 12708 | let config = crate::service::RestJsonConfig::builder().build();
|
12055 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12709 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12056 12710 | .malformed_double(move |input: crate::input::MalformedDoubleInput| {
|
12057 12711 | let sender = sender.clone();
|
12058 12712 | async move {
|
12059 12713 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedDoubleOutput, crate::error::MalformedDoubleError> };
|
12060 12714 | sender.send(()).await.expect("receiver dropped early");
|
12061 12715 | result
|
12062 12716 | }
|
12063 12717 | })
|
12064 12718 | .build_unchecked();
|
12065 12719 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12066 12720 | .await
|
12067 12721 | .expect("unable to make an HTTP request");
|
12068 12722 | ::pretty_assertions::assert_eq!(
|
12069 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12723 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12070 12724 | http_response.status()
|
12071 12725 | );
|
12072 12726 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12073 12727 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12074 12728 | http_response.headers(),
|
12075 12729 | expected_headers,
|
12076 12730 | ));
|
12077 12731 | }
|
12078 12732 | }
|
12079 12733 |
|
12080 12734 | /// Malformed values in headers should be rejected
|
12081 12735 | /// Test ID: RestJsonHeaderDoubleMalformedValueRejected_case0
|
12082 12736 | #[::tokio::test]
|
12083 12737 | #[::tracing_test::traced_test]
|
12084 12738 | async fn rest_json_header_double_malformed_value_rejected_case0_malformed_request() {
|
12085 12739 | {
|
12086 12740 | #[allow(unused_mut)]
|
12087 - | let mut http_request = http::Request::builder()
|
12741 + | let mut http_request = ::http_1x::Request::builder()
|
12088 12742 | .uri("/MalformedDouble/1")
|
12089 12743 | .method("POST")
|
12090 12744 | .header("doubleInHeader", "true")
|
12091 - | .body(::aws_smithy_http_server::body::Body::empty())
|
12745 + | .body(::aws_smithy_http_server::body::boxed(
|
12746 + | ::http_body_util::Empty::new(),
|
12747 + | ))
|
12092 12748 | .unwrap();
|
12093 12749 | #[allow(unused_mut)]
|
12094 12750 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12095 12751 | let config = crate::service::RestJsonConfig::builder().build();
|
12096 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12752 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12097 12753 | .malformed_double(move |input: crate::input::MalformedDoubleInput| {
|
12098 12754 | let sender = sender.clone();
|
12099 12755 | async move {
|
12100 12756 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedDoubleOutput, crate::error::MalformedDoubleError> };
|
12101 12757 | sender.send(()).await.expect("receiver dropped early");
|
12102 12758 | result
|
12103 12759 | }
|
12104 12760 | })
|
12105 12761 | .build_unchecked();
|
12106 12762 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12107 12763 | .await
|
12108 12764 | .expect("unable to make an HTTP request");
|
12109 12765 | ::pretty_assertions::assert_eq!(
|
12110 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12766 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12111 12767 | http_response.status()
|
12112 12768 | );
|
12113 12769 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12114 12770 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12115 12771 | http_response.headers(),
|
12116 12772 | expected_headers,
|
12117 12773 | ));
|
12118 12774 | }
|
12119 12775 | }
|
12120 12776 |
|
12121 12777 | /// Malformed values in headers should be rejected
|
12122 12778 | /// Test ID: RestJsonHeaderDoubleMalformedValueRejected_case1
|
12123 12779 | #[::tokio::test]
|
12124 12780 | #[::tracing_test::traced_test]
|
12125 12781 | async fn rest_json_header_double_malformed_value_rejected_case1_malformed_request() {
|
12126 12782 | {
|
12127 12783 | #[allow(unused_mut)]
|
12128 - | let mut http_request = http::Request::builder()
|
12784 + | let mut http_request = ::http_1x::Request::builder()
|
12129 12785 | .uri("/MalformedDouble/1")
|
12130 12786 | .method("POST")
|
12131 12787 | .header("doubleInHeader", "2ABC")
|
12132 - | .body(::aws_smithy_http_server::body::Body::empty())
|
12788 + | .body(::aws_smithy_http_server::body::boxed(
|
12789 + | ::http_body_util::Empty::new(),
|
12790 + | ))
|
12133 12791 | .unwrap();
|
12134 12792 | #[allow(unused_mut)]
|
12135 12793 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12136 12794 | let config = crate::service::RestJsonConfig::builder().build();
|
12137 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12795 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12138 12796 | .malformed_double(move |input: crate::input::MalformedDoubleInput| {
|
12139 12797 | let sender = sender.clone();
|
12140 12798 | async move {
|
12141 12799 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedDoubleOutput, crate::error::MalformedDoubleError> };
|
12142 12800 | sender.send(()).await.expect("receiver dropped early");
|
12143 12801 | result
|
12144 12802 | }
|
12145 12803 | })
|
12146 12804 | .build_unchecked();
|
12147 12805 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12148 12806 | .await
|
12149 12807 | .expect("unable to make an HTTP request");
|
12150 12808 | ::pretty_assertions::assert_eq!(
|
12151 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12809 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12152 12810 | http_response.status()
|
12153 12811 | );
|
12154 12812 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12155 12813 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12156 12814 | http_response.headers(),
|
12157 12815 | expected_headers,
|
12158 12816 | ));
|
12159 12817 | }
|
12160 12818 | }
|
12161 12819 |
|
12162 12820 | /// Malformed values in headers should be rejected
|
12163 12821 | /// Test ID: RestJsonHeaderDoubleMalformedValueRejected_case2
|
12164 12822 | #[::tokio::test]
|
12165 12823 | #[::tracing_test::traced_test]
|
12166 12824 | async fn rest_json_header_double_malformed_value_rejected_case2_malformed_request() {
|
12167 12825 | {
|
12168 12826 | #[allow(unused_mut)]
|
12169 - | let mut http_request = http::Request::builder()
|
12827 + | let mut http_request = ::http_1x::Request::builder()
|
12170 12828 | .uri("/MalformedDouble/1")
|
12171 12829 | .method("POST")
|
12172 12830 | .header("doubleInHeader", "0x42")
|
12173 - | .body(::aws_smithy_http_server::body::Body::empty())
|
12831 + | .body(::aws_smithy_http_server::body::boxed(
|
12832 + | ::http_body_util::Empty::new(),
|
12833 + | ))
|
12174 12834 | .unwrap();
|
12175 12835 | #[allow(unused_mut)]
|
12176 12836 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12177 12837 | let config = crate::service::RestJsonConfig::builder().build();
|
12178 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
12838 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12179 12839 | .malformed_double(move |input: crate::input::MalformedDoubleInput| {
|
12180 12840 | let sender = sender.clone();
|
12181 12841 | async move {
|
12182 12842 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedDoubleOutput, crate::error::MalformedDoubleError> };
|
12183 12843 | sender.send(()).await.expect("receiver dropped early");
|
12184 12844 | result
|
12185 12845 | }
|
12186 12846 | })
|
12187 12847 | .build_unchecked();
|
12188 12848 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12189 12849 | .await
|
12190 12850 | .expect("unable to make an HTTP request");
|
12191 12851 | ::pretty_assertions::assert_eq!(
|
12192 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12852 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12193 12853 | http_response.status()
|
12194 12854 | );
|
12195 12855 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12196 12856 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12197 12857 | http_response.headers(),
|
12198 12858 | expected_headers,
|
12199 12859 | ));
|
12200 12860 | }
|
12201 12861 | }
|
12862 + |
|
12863 + | /* ProtocolTestGenerator.kt:98 */
|
12202 12864 | }
|
12203 12865 |
|
12866 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
12204 12867 | ::pin_project_lite::pin_project! {
|
12205 12868 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
12206 12869 | /// [`MalformedFloatInput`](crate::input::MalformedFloatInput) using modelled bindings.
|
12207 12870 | pub struct MalformedFloatInputFuture {
|
12208 12871 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedFloatInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
12209 12872 | }
|
12210 12873 | }
|
12211 12874 |
|
12212 12875 | impl std::future::Future for MalformedFloatInputFuture {
|
12213 12876 | type Output = Result<
|
12214 12877 | crate::input::MalformedFloatInput,
|
12215 12878 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
12216 12879 | >;
|
12217 12880 |
|
12218 12881 | fn poll(
|
12219 12882 | self: std::pin::Pin<&mut Self>,
|
12220 12883 | cx: &mut std::task::Context<'_>,
|
12221 12884 | ) -> std::task::Poll<Self::Output> {
|
12222 12885 | let this = self.project();
|
12223 12886 | this.inner.as_mut().poll(cx)
|
12224 12887 | }
|
12225 12888 | }
|
12226 12889 |
|
12227 12890 | impl<B>
|
12228 12891 | ::aws_smithy_http_server::request::FromRequest<
|
12229 12892 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
12230 12893 | B,
|
12231 12894 | > for crate::input::MalformedFloatInput
|
12232 12895 | where
|
12233 12896 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
12234 12897 | B: 'static,
|
12235 12898 |
|
12236 12899 | B::Data: Send,
|
12237 12900 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
12238 12901 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
12239 12902 | {
|
12240 12903 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
12241 12904 | type Future = MalformedFloatInputFuture;
|
12242 12905 |
|
12243 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
12906 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
12244 12907 | let fut = async move {
|
12245 12908 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
12246 12909 | request.headers(),
|
12247 12910 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
12248 12911 | ) {
|
12249 12912 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
12250 12913 | }
|
12251 12914 | crate::protocol_serde::shape_malformed_float::de_malformed_float_http_request(request)
|
12252 12915 | .await
|
12253 12916 | };
|
12254 12917 | use ::futures_util::future::TryFutureExt;
|
12255 12918 | let fut = fut.map_err(
|
12256 12919 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
12257 12920 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
12258 12921 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
12259 12922 | e,
|
12260 12923 | )
|
12261 12924 | },
|
12262 12925 | );
|
12263 12926 | MalformedFloatInputFuture {
|
12264 12927 | inner: Box::pin(fut),
|
12265 12928 | }
|
12266 12929 | }
|
12267 12930 | }
|
12931 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
12268 12932 | impl
|
12269 12933 | ::aws_smithy_http_server::response::IntoResponse<
|
12270 12934 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
12271 12935 | > for crate::output::MalformedFloatOutput
|
12272 12936 | {
|
12273 12937 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
12274 12938 | match crate::protocol_serde::shape_malformed_float::ser_malformed_float_http_response(self)
|
12275 12939 | {
|
12276 12940 | Ok(response) => response,
|
12277 12941 | Err(e) => {
|
12278 12942 | ::tracing::error!(error = %e, "failed to serialize response");
|
12279 12943 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
12280 12944 | }
|
12281 12945 | }
|
12282 12946 | }
|
12283 12947 | }
|
12948 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
12284 12949 | impl
|
12285 12950 | ::aws_smithy_http_server::response::IntoResponse<
|
12286 12951 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
12287 12952 | > for crate::error::MalformedFloatError
|
12288 12953 | {
|
12289 12954 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
12290 12955 | match crate::protocol_serde::shape_malformed_float::ser_malformed_float_http_error(&self) {
|
12291 12956 | Ok(mut response) => {
|
12292 12957 | response.extensions_mut().insert(
|
12293 12958 | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
12294 12959 | );
|
12295 12960 | response
|
12296 12961 | }
|
12297 12962 | Err(e) => {
|
12298 12963 | ::tracing::error!(error = %e, "failed to serialize response");
|
12299 12964 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
12300 12965 | }
|
12301 12966 | }
|
12302 12967 | }
|
12303 12968 | }
|
12304 12969 |
|
12970 + | /* RustType.kt:534 */
|
12305 12971 | #[allow(unreachable_code, unused_variables)]
|
12972 + | /* RustType.kt:534 */
|
12306 12973 | #[cfg(test)]
|
12974 + | /* ProtocolTestGenerator.kt:98 */
|
12307 12975 | mod malformed_float_test {
|
12308 12976 |
|
12309 12977 | /// Malformed values in the body should be rejected
|
12310 12978 | /// Test ID: RestJsonBodyFloatMalformedValueRejected_case0
|
12311 12979 | #[::tokio::test]
|
12312 12980 | #[::tracing_test::traced_test]
|
12313 12981 | async fn rest_json_body_float_malformed_value_rejected_case0_malformed_request() {
|
12314 12982 | {
|
12315 12983 | #[allow(unused_mut)]
|
12316 - | let mut http_request = http::Request::builder()
|
12984 + | let mut http_request = ::http_1x::Request::builder()
|
12317 12985 | .uri("/MalformedFloat/1")
|
12318 12986 | .method("POST")
|
12319 12987 | .header("content-type", "application/json")
|
12320 - | .body(::aws_smithy_http_server::body::Body::from(
|
12321 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
12322 - | "{ \"floatInBody\" : \"123\" }".as_bytes(),
|
12323 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12988 + | .body(::aws_smithy_http_server::body::boxed(
|
12989 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
12990 + | &::aws_smithy_protocol_test::decode_body_data(
|
12991 + | "{ \"floatInBody\" : \"123\" }".as_bytes(),
|
12992 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12993 + | ),
|
12324 12994 | )),
|
12325 12995 | ))
|
12326 12996 | .unwrap();
|
12327 12997 | #[allow(unused_mut)]
|
12328 12998 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12329 12999 | let config = crate::service::RestJsonConfig::builder().build();
|
12330 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13000 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12331 13001 | .malformed_float(move |input: crate::input::MalformedFloatInput| {
|
12332 13002 | let sender = sender.clone();
|
12333 13003 | async move {
|
12334 13004 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedFloatOutput, crate::error::MalformedFloatError> };
|
12335 13005 | sender.send(()).await.expect("receiver dropped early");
|
12336 13006 | result
|
12337 13007 | }
|
12338 13008 | })
|
12339 13009 | .build_unchecked();
|
12340 13010 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12341 13011 | .await
|
12342 13012 | .expect("unable to make an HTTP request");
|
12343 13013 | ::pretty_assertions::assert_eq!(
|
12344 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13014 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12345 13015 | http_response.status()
|
12346 13016 | );
|
12347 13017 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12348 13018 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12349 13019 | http_response.headers(),
|
12350 13020 | expected_headers,
|
12351 13021 | ));
|
12352 13022 | }
|
12353 13023 | }
|
12354 13024 |
|
12355 13025 | /// Malformed values in the body should be rejected
|
12356 13026 | /// Test ID: RestJsonBodyFloatMalformedValueRejected_case1
|
12357 13027 | #[::tokio::test]
|
12358 13028 | #[::tracing_test::traced_test]
|
12359 13029 | async fn rest_json_body_float_malformed_value_rejected_case1_malformed_request() {
|
12360 13030 | {
|
12361 13031 | #[allow(unused_mut)]
|
12362 - | let mut http_request = http::Request::builder()
|
13032 + | let mut http_request = ::http_1x::Request::builder()
|
12363 13033 | .uri("/MalformedFloat/1")
|
12364 13034 | .method("POST")
|
12365 13035 | .header("content-type", "application/json")
|
12366 - | .body(::aws_smithy_http_server::body::Body::from(
|
12367 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
12368 - | "{ \"floatInBody\" : true }".as_bytes(),
|
12369 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13036 + | .body(::aws_smithy_http_server::body::boxed(
|
13037 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
13038 + | &::aws_smithy_protocol_test::decode_body_data(
|
13039 + | "{ \"floatInBody\" : true }".as_bytes(),
|
13040 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13041 + | ),
|
12370 13042 | )),
|
12371 13043 | ))
|
12372 13044 | .unwrap();
|
12373 13045 | #[allow(unused_mut)]
|
12374 13046 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12375 13047 | let config = crate::service::RestJsonConfig::builder().build();
|
12376 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13048 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12377 13049 | .malformed_float(move |input: crate::input::MalformedFloatInput| {
|
12378 13050 | let sender = sender.clone();
|
12379 13051 | async move {
|
12380 13052 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedFloatOutput, crate::error::MalformedFloatError> };
|
12381 13053 | sender.send(()).await.expect("receiver dropped early");
|
12382 13054 | result
|
12383 13055 | }
|
12384 13056 | })
|
12385 13057 | .build_unchecked();
|
12386 13058 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12387 13059 | .await
|
12388 13060 | .expect("unable to make an HTTP request");
|
12389 13061 | ::pretty_assertions::assert_eq!(
|
12390 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13062 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12391 13063 | http_response.status()
|
12392 13064 | );
|
12393 13065 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12394 13066 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12395 13067 | http_response.headers(),
|
12396 13068 | expected_headers,
|
12397 13069 | ));
|
12398 13070 | }
|
12399 13071 | }
|
12400 13072 |
|
12401 13073 | /// Malformed values in the body should be rejected
|
12402 13074 | /// Test ID: RestJsonBodyFloatMalformedValueRejected_case2
|
12403 13075 | #[::tokio::test]
|
12404 13076 | #[::tracing_test::traced_test]
|
12405 13077 | async fn rest_json_body_float_malformed_value_rejected_case2_malformed_request() {
|
12406 13078 | {
|
12407 13079 | #[allow(unused_mut)]
|
12408 - | let mut http_request = http::Request::builder()
|
13080 + | let mut http_request = ::http_1x::Request::builder()
|
12409 13081 | .uri("/MalformedFloat/1")
|
12410 13082 | .method("POST")
|
12411 13083 | .header("content-type", "application/json")
|
12412 - | .body(::aws_smithy_http_server::body::Body::from(
|
12413 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
12414 - | "{ \"floatInBody\" : 2ABC }".as_bytes(),
|
12415 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13084 + | .body(::aws_smithy_http_server::body::boxed(
|
13085 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
13086 + | &::aws_smithy_protocol_test::decode_body_data(
|
13087 + | "{ \"floatInBody\" : 2ABC }".as_bytes(),
|
13088 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13089 + | ),
|
12416 13090 | )),
|
12417 13091 | ))
|
12418 13092 | .unwrap();
|
12419 13093 | #[allow(unused_mut)]
|
12420 13094 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12421 13095 | let config = crate::service::RestJsonConfig::builder().build();
|
12422 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13096 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12423 13097 | .malformed_float(move |input: crate::input::MalformedFloatInput| {
|
12424 13098 | let sender = sender.clone();
|
12425 13099 | async move {
|
12426 13100 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedFloatOutput, crate::error::MalformedFloatError> };
|
12427 13101 | sender.send(()).await.expect("receiver dropped early");
|
12428 13102 | result
|
12429 13103 | }
|
12430 13104 | })
|
12431 13105 | .build_unchecked();
|
12432 13106 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12433 13107 | .await
|
12434 13108 | .expect("unable to make an HTTP request");
|
12435 13109 | ::pretty_assertions::assert_eq!(
|
12436 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13110 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12437 13111 | http_response.status()
|
12438 13112 | );
|
12439 13113 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12440 13114 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12441 13115 | http_response.headers(),
|
12442 13116 | expected_headers,
|
12443 13117 | ));
|
12444 13118 | }
|
12445 13119 | }
|
12446 13120 |
|
12447 13121 | /// Malformed values in the body should be rejected
|
12448 13122 | /// Test ID: RestJsonBodyFloatMalformedValueRejected_case3
|
12449 13123 | #[::tokio::test]
|
12450 13124 | #[::tracing_test::traced_test]
|
12451 13125 | async fn rest_json_body_float_malformed_value_rejected_case3_malformed_request() {
|
12452 13126 | {
|
12453 13127 | #[allow(unused_mut)]
|
12454 - | let mut http_request = http::Request::builder()
|
13128 + | let mut http_request = ::http_1x::Request::builder()
|
12455 13129 | .uri("/MalformedFloat/1")
|
12456 13130 | .method("POST")
|
12457 13131 | .header("content-type", "application/json")
|
12458 - | .body(::aws_smithy_http_server::body::Body::from(
|
12459 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
12460 - | "{ \"floatInBody\" : 0x42 }".as_bytes(),
|
12461 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13132 + | .body(::aws_smithy_http_server::body::boxed(
|
13133 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
13134 + | &::aws_smithy_protocol_test::decode_body_data(
|
13135 + | "{ \"floatInBody\" : 0x42 }".as_bytes(),
|
13136 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13137 + | ),
|
12462 13138 | )),
|
12463 13139 | ))
|
12464 13140 | .unwrap();
|
12465 13141 | #[allow(unused_mut)]
|
12466 13142 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12467 13143 | let config = crate::service::RestJsonConfig::builder().build();
|
12468 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13144 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12469 13145 | .malformed_float(move |input: crate::input::MalformedFloatInput| {
|
12470 13146 | let sender = sender.clone();
|
12471 13147 | async move {
|
12472 13148 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedFloatOutput, crate::error::MalformedFloatError> };
|
12473 13149 | sender.send(()).await.expect("receiver dropped early");
|
12474 13150 | result
|
12475 13151 | }
|
12476 13152 | })
|
12477 13153 | .build_unchecked();
|
12478 13154 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12479 13155 | .await
|
12480 13156 | .expect("unable to make an HTTP request");
|
12481 13157 | ::pretty_assertions::assert_eq!(
|
12482 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13158 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12483 13159 | http_response.status()
|
12484 13160 | );
|
12485 13161 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12486 13162 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12487 13163 | http_response.headers(),
|
12488 13164 | expected_headers,
|
12489 13165 | ));
|
12490 13166 | }
|
12491 13167 | }
|
12492 13168 |
|
12493 13169 | /// Malformed values in the body should be rejected
|
12494 13170 | /// Test ID: RestJsonBodyFloatMalformedValueRejected_case4
|
12495 13171 | #[::tokio::test]
|
12496 13172 | #[::tracing_test::traced_test]
|
12497 13173 | async fn rest_json_body_float_malformed_value_rejected_case4_malformed_request() {
|
12498 13174 | {
|
12499 13175 | #[allow(unused_mut)]
|
12500 - | let mut http_request = http::Request::builder()
|
13176 + | let mut http_request = ::http_1x::Request::builder()
|
12501 13177 | .uri("/MalformedFloat/1")
|
12502 13178 | .method("POST")
|
12503 13179 | .header("content-type", "application/json")
|
12504 - | .body(::aws_smithy_http_server::body::Body::from(
|
12505 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
12506 - | "{ \"floatInBody\" : Infinity }".as_bytes(),
|
12507 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13180 + | .body(::aws_smithy_http_server::body::boxed(
|
13181 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
13182 + | &::aws_smithy_protocol_test::decode_body_data(
|
13183 + | "{ \"floatInBody\" : Infinity }".as_bytes(),
|
13184 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13185 + | ),
|
12508 13186 | )),
|
12509 13187 | ))
|
12510 13188 | .unwrap();
|
12511 13189 | #[allow(unused_mut)]
|
12512 13190 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12513 13191 | let config = crate::service::RestJsonConfig::builder().build();
|
12514 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13192 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12515 13193 | .malformed_float(move |input: crate::input::MalformedFloatInput| {
|
12516 13194 | let sender = sender.clone();
|
12517 13195 | async move {
|
12518 13196 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedFloatOutput, crate::error::MalformedFloatError> };
|
12519 13197 | sender.send(()).await.expect("receiver dropped early");
|
12520 13198 | result
|
12521 13199 | }
|
12522 13200 | })
|
12523 13201 | .build_unchecked();
|
12524 13202 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12525 13203 | .await
|
12526 13204 | .expect("unable to make an HTTP request");
|
12527 13205 | ::pretty_assertions::assert_eq!(
|
12528 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13206 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12529 13207 | http_response.status()
|
12530 13208 | );
|
12531 13209 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12532 13210 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12533 13211 | http_response.headers(),
|
12534 13212 | expected_headers,
|
12535 13213 | ));
|
12536 13214 | }
|
12537 13215 | }
|
12538 13216 |
|
12539 13217 | /// Malformed values in the body should be rejected
|
12540 13218 | /// Test ID: RestJsonBodyFloatMalformedValueRejected_case5
|
12541 13219 | #[::tokio::test]
|
12542 13220 | #[::tracing_test::traced_test]
|
12543 13221 | async fn rest_json_body_float_malformed_value_rejected_case5_malformed_request() {
|
12544 13222 | {
|
12545 13223 | #[allow(unused_mut)]
|
12546 - | let mut http_request = http::Request::builder()
|
13224 + | let mut http_request = ::http_1x::Request::builder()
|
12547 13225 | .uri("/MalformedFloat/1")
|
12548 13226 | .method("POST")
|
12549 13227 | .header("content-type", "application/json")
|
12550 - | .body(::aws_smithy_http_server::body::Body::from(
|
12551 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
12552 - | "{ \"floatInBody\" : -Infinity }".as_bytes(),
|
12553 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13228 + | .body(::aws_smithy_http_server::body::boxed(
|
13229 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
13230 + | &::aws_smithy_protocol_test::decode_body_data(
|
13231 + | "{ \"floatInBody\" : -Infinity }".as_bytes(),
|
13232 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13233 + | ),
|
12554 13234 | )),
|
12555 13235 | ))
|
12556 13236 | .unwrap();
|
12557 13237 | #[allow(unused_mut)]
|
12558 13238 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12559 13239 | let config = crate::service::RestJsonConfig::builder().build();
|
12560 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13240 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12561 13241 | .malformed_float(move |input: crate::input::MalformedFloatInput| {
|
12562 13242 | let sender = sender.clone();
|
12563 13243 | async move {
|
12564 13244 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedFloatOutput, crate::error::MalformedFloatError> };
|
12565 13245 | sender.send(()).await.expect("receiver dropped early");
|
12566 13246 | result
|
12567 13247 | }
|
12568 13248 | })
|
12569 13249 | .build_unchecked();
|
12570 13250 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12571 13251 | .await
|
12572 13252 | .expect("unable to make an HTTP request");
|
12573 13253 | ::pretty_assertions::assert_eq!(
|
12574 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13254 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12575 13255 | http_response.status()
|
12576 13256 | );
|
12577 13257 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12578 13258 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12579 13259 | http_response.headers(),
|
12580 13260 | expected_headers,
|
12581 13261 | ));
|
12582 13262 | }
|
12583 13263 | }
|
12584 13264 |
|
12585 13265 | /// Malformed values in the body should be rejected
|
12586 13266 | /// Test ID: RestJsonBodyFloatMalformedValueRejected_case6
|
12587 13267 | #[::tokio::test]
|
12588 13268 | #[::tracing_test::traced_test]
|
12589 13269 | async fn rest_json_body_float_malformed_value_rejected_case6_malformed_request() {
|
12590 13270 | {
|
12591 13271 | #[allow(unused_mut)]
|
12592 - | let mut http_request = http::Request::builder()
|
13272 + | let mut http_request = ::http_1x::Request::builder()
|
12593 13273 | .uri("/MalformedFloat/1")
|
12594 13274 | .method("POST")
|
12595 13275 | .header("content-type", "application/json")
|
12596 - | .body(::aws_smithy_http_server::body::Body::from(
|
12597 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
12598 - | "{ \"floatInBody\" : NaN }".as_bytes(),
|
12599 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13276 + | .body(::aws_smithy_http_server::body::boxed(
|
13277 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
13278 + | &::aws_smithy_protocol_test::decode_body_data(
|
13279 + | "{ \"floatInBody\" : NaN }".as_bytes(),
|
13280 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13281 + | ),
|
12600 13282 | )),
|
12601 13283 | ))
|
12602 13284 | .unwrap();
|
12603 13285 | #[allow(unused_mut)]
|
12604 13286 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12605 13287 | let config = crate::service::RestJsonConfig::builder().build();
|
12606 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13288 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12607 13289 | .malformed_float(move |input: crate::input::MalformedFloatInput| {
|
12608 13290 | let sender = sender.clone();
|
12609 13291 | async move {
|
12610 13292 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedFloatOutput, crate::error::MalformedFloatError> };
|
12611 13293 | sender.send(()).await.expect("receiver dropped early");
|
12612 13294 | result
|
12613 13295 | }
|
12614 13296 | })
|
12615 13297 | .build_unchecked();
|
12616 13298 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12617 13299 | .await
|
12618 13300 | .expect("unable to make an HTTP request");
|
12619 13301 | ::pretty_assertions::assert_eq!(
|
12620 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13302 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12621 13303 | http_response.status()
|
12622 13304 | );
|
12623 13305 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12624 13306 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12625 13307 | http_response.headers(),
|
12626 13308 | expected_headers,
|
12627 13309 | ));
|
12628 13310 | }
|
12629 13311 | }
|
12630 13312 |
|
12631 13313 | /// Malformed values in the path should be rejected
|
12632 13314 | /// Test ID: RestJsonPathFloatMalformedValueRejected_case0
|
12633 13315 | #[::tokio::test]
|
12634 13316 | #[::tracing_test::traced_test]
|
12635 13317 | async fn rest_json_path_float_malformed_value_rejected_case0_malformed_request() {
|
12636 13318 | {
|
12637 13319 | #[allow(unused_mut)]
|
12638 - | let mut http_request = http::Request::builder()
|
13320 + | let mut http_request = ::http_1x::Request::builder()
|
12639 13321 | .uri("/MalformedFloat/true")
|
12640 13322 | .method("POST")
|
12641 - | .body(::aws_smithy_http_server::body::Body::empty())
|
13323 + | .body(::aws_smithy_http_server::body::boxed(
|
13324 + | ::http_body_util::Empty::new(),
|
13325 + | ))
|
12642 13326 | .unwrap();
|
12643 13327 | #[allow(unused_mut)]
|
12644 13328 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12645 13329 | let config = crate::service::RestJsonConfig::builder().build();
|
12646 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13330 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12647 13331 | .malformed_float(move |input: crate::input::MalformedFloatInput| {
|
12648 13332 | let sender = sender.clone();
|
12649 13333 | async move {
|
12650 13334 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedFloatOutput, crate::error::MalformedFloatError> };
|
12651 13335 | sender.send(()).await.expect("receiver dropped early");
|
12652 13336 | result
|
12653 13337 | }
|
12654 13338 | })
|
12655 13339 | .build_unchecked();
|
12656 13340 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12657 13341 | .await
|
12658 13342 | .expect("unable to make an HTTP request");
|
12659 13343 | ::pretty_assertions::assert_eq!(
|
12660 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13344 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12661 13345 | http_response.status()
|
12662 13346 | );
|
12663 13347 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12664 13348 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12665 13349 | http_response.headers(),
|
12666 13350 | expected_headers,
|
12667 13351 | ));
|
12668 13352 | }
|
12669 13353 | }
|
12670 13354 |
|
12671 13355 | /// Malformed values in the path should be rejected
|
12672 13356 | /// Test ID: RestJsonPathFloatMalformedValueRejected_case1
|
12673 13357 | #[::tokio::test]
|
12674 13358 | #[::tracing_test::traced_test]
|
12675 13359 | async fn rest_json_path_float_malformed_value_rejected_case1_malformed_request() {
|
12676 13360 | {
|
12677 13361 | #[allow(unused_mut)]
|
12678 - | let mut http_request = http::Request::builder()
|
13362 + | let mut http_request = ::http_1x::Request::builder()
|
12679 13363 | .uri("/MalformedFloat/2ABC")
|
12680 13364 | .method("POST")
|
12681 - | .body(::aws_smithy_http_server::body::Body::empty())
|
13365 + | .body(::aws_smithy_http_server::body::boxed(
|
13366 + | ::http_body_util::Empty::new(),
|
13367 + | ))
|
12682 13368 | .unwrap();
|
12683 13369 | #[allow(unused_mut)]
|
12684 13370 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12685 13371 | let config = crate::service::RestJsonConfig::builder().build();
|
12686 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13372 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12687 13373 | .malformed_float(move |input: crate::input::MalformedFloatInput| {
|
12688 13374 | let sender = sender.clone();
|
12689 13375 | async move {
|
12690 13376 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedFloatOutput, crate::error::MalformedFloatError> };
|
12691 13377 | sender.send(()).await.expect("receiver dropped early");
|
12692 13378 | result
|
12693 13379 | }
|
12694 13380 | })
|
12695 13381 | .build_unchecked();
|
12696 13382 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12697 13383 | .await
|
12698 13384 | .expect("unable to make an HTTP request");
|
12699 13385 | ::pretty_assertions::assert_eq!(
|
12700 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13386 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12701 13387 | http_response.status()
|
12702 13388 | );
|
12703 13389 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12704 13390 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12705 13391 | http_response.headers(),
|
12706 13392 | expected_headers,
|
12707 13393 | ));
|
12708 13394 | }
|
12709 13395 | }
|
12710 13396 |
|
12711 13397 | /// Malformed values in the path should be rejected
|
12712 13398 | /// Test ID: RestJsonPathFloatMalformedValueRejected_case2
|
12713 13399 | #[::tokio::test]
|
12714 13400 | #[::tracing_test::traced_test]
|
12715 13401 | async fn rest_json_path_float_malformed_value_rejected_case2_malformed_request() {
|
12716 13402 | {
|
12717 13403 | #[allow(unused_mut)]
|
12718 - | let mut http_request = http::Request::builder()
|
13404 + | let mut http_request = ::http_1x::Request::builder()
|
12719 13405 | .uri("/MalformedFloat/0x42")
|
12720 13406 | .method("POST")
|
12721 - | .body(::aws_smithy_http_server::body::Body::empty())
|
13407 + | .body(::aws_smithy_http_server::body::boxed(
|
13408 + | ::http_body_util::Empty::new(),
|
13409 + | ))
|
12722 13410 | .unwrap();
|
12723 13411 | #[allow(unused_mut)]
|
12724 13412 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12725 13413 | let config = crate::service::RestJsonConfig::builder().build();
|
12726 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13414 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12727 13415 | .malformed_float(move |input: crate::input::MalformedFloatInput| {
|
12728 13416 | let sender = sender.clone();
|
12729 13417 | async move {
|
12730 13418 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedFloatOutput, crate::error::MalformedFloatError> };
|
12731 13419 | sender.send(()).await.expect("receiver dropped early");
|
12732 13420 | result
|
12733 13421 | }
|
12734 13422 | })
|
12735 13423 | .build_unchecked();
|
12736 13424 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12737 13425 | .await
|
12738 13426 | .expect("unable to make an HTTP request");
|
12739 13427 | ::pretty_assertions::assert_eq!(
|
12740 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13428 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12741 13429 | http_response.status()
|
12742 13430 | );
|
12743 13431 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12744 13432 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12745 13433 | http_response.headers(),
|
12746 13434 | expected_headers,
|
12747 13435 | ));
|
12748 13436 | }
|
12749 13437 | }
|
12750 13438 |
|
12751 13439 | /// Malformed values in query parameters should be rejected
|
12752 13440 | /// Test ID: RestJsonQueryFloatMalformedValueRejected_case0
|
12753 13441 | #[::tokio::test]
|
12754 13442 | #[::tracing_test::traced_test]
|
12755 13443 | async fn rest_json_query_float_malformed_value_rejected_case0_malformed_request() {
|
12756 13444 | {
|
12757 13445 | #[allow(unused_mut)]
|
12758 - | let mut http_request = http::Request::builder()
|
13446 + | let mut http_request = ::http_1x::Request::builder()
|
12759 13447 | .uri("/MalformedFloat/1")
|
12760 13448 | .method("POST")
|
12761 - | .body(::aws_smithy_http_server::body::Body::empty())
|
13449 + | .body(::aws_smithy_http_server::body::boxed(
|
13450 + | ::http_body_util::Empty::new(),
|
13451 + | ))
|
12762 13452 | .unwrap();
|
12763 13453 | *http_request.uri_mut() = "/MalformedFloat/1?floatInQuery=true".parse().unwrap();
|
12764 13454 | #[allow(unused_mut)]
|
12765 13455 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12766 13456 | let config = crate::service::RestJsonConfig::builder().build();
|
12767 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13457 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12768 13458 | .malformed_float(move |input: crate::input::MalformedFloatInput| {
|
12769 13459 | let sender = sender.clone();
|
12770 13460 | async move {
|
12771 13461 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedFloatOutput, crate::error::MalformedFloatError> };
|
12772 13462 | sender.send(()).await.expect("receiver dropped early");
|
12773 13463 | result
|
12774 13464 | }
|
12775 13465 | })
|
12776 13466 | .build_unchecked();
|
12777 13467 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12778 13468 | .await
|
12779 13469 | .expect("unable to make an HTTP request");
|
12780 13470 | ::pretty_assertions::assert_eq!(
|
12781 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13471 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12782 13472 | http_response.status()
|
12783 13473 | );
|
12784 13474 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12785 13475 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12786 13476 | http_response.headers(),
|
12787 13477 | expected_headers,
|
12788 13478 | ));
|
12789 13479 | }
|
12790 13480 | }
|
12791 13481 |
|
12792 13482 | /// Malformed values in query parameters should be rejected
|
12793 13483 | /// Test ID: RestJsonQueryFloatMalformedValueRejected_case1
|
12794 13484 | #[::tokio::test]
|
12795 13485 | #[::tracing_test::traced_test]
|
12796 13486 | async fn rest_json_query_float_malformed_value_rejected_case1_malformed_request() {
|
12797 13487 | {
|
12798 13488 | #[allow(unused_mut)]
|
12799 - | let mut http_request = http::Request::builder()
|
13489 + | let mut http_request = ::http_1x::Request::builder()
|
12800 13490 | .uri("/MalformedFloat/1")
|
12801 13491 | .method("POST")
|
12802 - | .body(::aws_smithy_http_server::body::Body::empty())
|
13492 + | .body(::aws_smithy_http_server::body::boxed(
|
13493 + | ::http_body_util::Empty::new(),
|
13494 + | ))
|
12803 13495 | .unwrap();
|
12804 13496 | *http_request.uri_mut() = "/MalformedFloat/1?floatInQuery=2ABC".parse().unwrap();
|
12805 13497 | #[allow(unused_mut)]
|
12806 13498 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12807 13499 | let config = crate::service::RestJsonConfig::builder().build();
|
12808 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13500 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12809 13501 | .malformed_float(move |input: crate::input::MalformedFloatInput| {
|
12810 13502 | let sender = sender.clone();
|
12811 13503 | async move {
|
12812 13504 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedFloatOutput, crate::error::MalformedFloatError> };
|
12813 13505 | sender.send(()).await.expect("receiver dropped early");
|
12814 13506 | result
|
12815 13507 | }
|
12816 13508 | })
|
12817 13509 | .build_unchecked();
|
12818 13510 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12819 13511 | .await
|
12820 13512 | .expect("unable to make an HTTP request");
|
12821 13513 | ::pretty_assertions::assert_eq!(
|
12822 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13514 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12823 13515 | http_response.status()
|
12824 13516 | );
|
12825 13517 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12826 13518 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12827 13519 | http_response.headers(),
|
12828 13520 | expected_headers,
|
12829 13521 | ));
|
12830 13522 | }
|
12831 13523 | }
|
12832 13524 |
|
12833 13525 | /// Malformed values in query parameters should be rejected
|
12834 13526 | /// Test ID: RestJsonQueryFloatMalformedValueRejected_case2
|
12835 13527 | #[::tokio::test]
|
12836 13528 | #[::tracing_test::traced_test]
|
12837 13529 | async fn rest_json_query_float_malformed_value_rejected_case2_malformed_request() {
|
12838 13530 | {
|
12839 13531 | #[allow(unused_mut)]
|
12840 - | let mut http_request = http::Request::builder()
|
13532 + | let mut http_request = ::http_1x::Request::builder()
|
12841 13533 | .uri("/MalformedFloat/1")
|
12842 13534 | .method("POST")
|
12843 - | .body(::aws_smithy_http_server::body::Body::empty())
|
13535 + | .body(::aws_smithy_http_server::body::boxed(
|
13536 + | ::http_body_util::Empty::new(),
|
13537 + | ))
|
12844 13538 | .unwrap();
|
12845 13539 | *http_request.uri_mut() = "/MalformedFloat/1?floatInQuery=0x42".parse().unwrap();
|
12846 13540 | #[allow(unused_mut)]
|
12847 13541 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12848 13542 | let config = crate::service::RestJsonConfig::builder().build();
|
12849 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13543 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12850 13544 | .malformed_float(move |input: crate::input::MalformedFloatInput| {
|
12851 13545 | let sender = sender.clone();
|
12852 13546 | async move {
|
12853 13547 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedFloatOutput, crate::error::MalformedFloatError> };
|
12854 13548 | sender.send(()).await.expect("receiver dropped early");
|
12855 13549 | result
|
12856 13550 | }
|
12857 13551 | })
|
12858 13552 | .build_unchecked();
|
12859 13553 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12860 13554 | .await
|
12861 13555 | .expect("unable to make an HTTP request");
|
12862 13556 | ::pretty_assertions::assert_eq!(
|
12863 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13557 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12864 13558 | http_response.status()
|
12865 13559 | );
|
12866 13560 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12867 13561 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12868 13562 | http_response.headers(),
|
12869 13563 | expected_headers,
|
12870 13564 | ));
|
12871 13565 | }
|
12872 13566 | }
|
12873 13567 |
|
12874 13568 | /// Malformed values in headers should be rejected
|
12875 13569 | /// Test ID: RestJsonHeaderFloatMalformedValueRejected_case0
|
12876 13570 | #[::tokio::test]
|
12877 13571 | #[::tracing_test::traced_test]
|
12878 13572 | async fn rest_json_header_float_malformed_value_rejected_case0_malformed_request() {
|
12879 13573 | {
|
12880 13574 | #[allow(unused_mut)]
|
12881 - | let mut http_request = http::Request::builder()
|
13575 + | let mut http_request = ::http_1x::Request::builder()
|
12882 13576 | .uri("/MalformedFloat/1")
|
12883 13577 | .method("POST")
|
12884 13578 | .header("floatInHeader", "true")
|
12885 - | .body(::aws_smithy_http_server::body::Body::empty())
|
13579 + | .body(::aws_smithy_http_server::body::boxed(
|
13580 + | ::http_body_util::Empty::new(),
|
13581 + | ))
|
12886 13582 | .unwrap();
|
12887 13583 | #[allow(unused_mut)]
|
12888 13584 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12889 13585 | let config = crate::service::RestJsonConfig::builder().build();
|
12890 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13586 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12891 13587 | .malformed_float(move |input: crate::input::MalformedFloatInput| {
|
12892 13588 | let sender = sender.clone();
|
12893 13589 | async move {
|
12894 13590 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedFloatOutput, crate::error::MalformedFloatError> };
|
12895 13591 | sender.send(()).await.expect("receiver dropped early");
|
12896 13592 | result
|
12897 13593 | }
|
12898 13594 | })
|
12899 13595 | .build_unchecked();
|
12900 13596 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12901 13597 | .await
|
12902 13598 | .expect("unable to make an HTTP request");
|
12903 13599 | ::pretty_assertions::assert_eq!(
|
12904 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13600 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12905 13601 | http_response.status()
|
12906 13602 | );
|
12907 13603 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12908 13604 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12909 13605 | http_response.headers(),
|
12910 13606 | expected_headers,
|
12911 13607 | ));
|
12912 13608 | }
|
12913 13609 | }
|
12914 13610 |
|
12915 13611 | /// Malformed values in headers should be rejected
|
12916 13612 | /// Test ID: RestJsonHeaderFloatMalformedValueRejected_case1
|
12917 13613 | #[::tokio::test]
|
12918 13614 | #[::tracing_test::traced_test]
|
12919 13615 | async fn rest_json_header_float_malformed_value_rejected_case1_malformed_request() {
|
12920 13616 | {
|
12921 13617 | #[allow(unused_mut)]
|
12922 - | let mut http_request = http::Request::builder()
|
13618 + | let mut http_request = ::http_1x::Request::builder()
|
12923 13619 | .uri("/MalformedFloat/1")
|
12924 13620 | .method("POST")
|
12925 13621 | .header("floatInHeader", "2ABC")
|
12926 - | .body(::aws_smithy_http_server::body::Body::empty())
|
13622 + | .body(::aws_smithy_http_server::body::boxed(
|
13623 + | ::http_body_util::Empty::new(),
|
13624 + | ))
|
12927 13625 | .unwrap();
|
12928 13626 | #[allow(unused_mut)]
|
12929 13627 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12930 13628 | let config = crate::service::RestJsonConfig::builder().build();
|
12931 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13629 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12932 13630 | .malformed_float(move |input: crate::input::MalformedFloatInput| {
|
12933 13631 | let sender = sender.clone();
|
12934 13632 | async move {
|
12935 13633 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedFloatOutput, crate::error::MalformedFloatError> };
|
12936 13634 | sender.send(()).await.expect("receiver dropped early");
|
12937 13635 | result
|
12938 13636 | }
|
12939 13637 | })
|
12940 13638 | .build_unchecked();
|
12941 13639 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12942 13640 | .await
|
12943 13641 | .expect("unable to make an HTTP request");
|
12944 13642 | ::pretty_assertions::assert_eq!(
|
12945 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13643 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12946 13644 | http_response.status()
|
12947 13645 | );
|
12948 13646 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12949 13647 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12950 13648 | http_response.headers(),
|
12951 13649 | expected_headers,
|
12952 13650 | ));
|
12953 13651 | }
|
12954 13652 | }
|
12955 13653 |
|
12956 13654 | /// Malformed values in headers should be rejected
|
12957 13655 | /// Test ID: RestJsonHeaderFloatMalformedValueRejected_case2
|
12958 13656 | #[::tokio::test]
|
12959 13657 | #[::tracing_test::traced_test]
|
12960 13658 | async fn rest_json_header_float_malformed_value_rejected_case2_malformed_request() {
|
12961 13659 | {
|
12962 13660 | #[allow(unused_mut)]
|
12963 - | let mut http_request = http::Request::builder()
|
13661 + | let mut http_request = ::http_1x::Request::builder()
|
12964 13662 | .uri("/MalformedFloat/1")
|
12965 13663 | .method("POST")
|
12966 13664 | .header("floatInHeader", "0x42")
|
12967 - | .body(::aws_smithy_http_server::body::Body::empty())
|
13665 + | .body(::aws_smithy_http_server::body::boxed(
|
13666 + | ::http_body_util::Empty::new(),
|
13667 + | ))
|
12968 13668 | .unwrap();
|
12969 13669 | #[allow(unused_mut)]
|
12970 13670 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12971 13671 | let config = crate::service::RestJsonConfig::builder().build();
|
12972 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13672 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
12973 13673 | .malformed_float(move |input: crate::input::MalformedFloatInput| {
|
12974 13674 | let sender = sender.clone();
|
12975 13675 | async move {
|
12976 13676 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedFloatOutput, crate::error::MalformedFloatError> };
|
12977 13677 | sender.send(()).await.expect("receiver dropped early");
|
12978 13678 | result
|
12979 13679 | }
|
12980 13680 | })
|
12981 13681 | .build_unchecked();
|
12982 13682 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12983 13683 | .await
|
12984 13684 | .expect("unable to make an HTTP request");
|
12985 13685 | ::pretty_assertions::assert_eq!(
|
12986 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13686 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
12987 13687 | http_response.status()
|
12988 13688 | );
|
12989 13689 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
12990 13690 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12991 13691 | http_response.headers(),
|
12992 13692 | expected_headers,
|
12993 13693 | ));
|
12994 13694 | }
|
12995 13695 | }
|
13696 + |
|
13697 + | /* ProtocolTestGenerator.kt:98 */
|
12996 13698 | }
|
12997 13699 |
|
13700 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
12998 13701 | ::pin_project_lite::pin_project! {
|
12999 13702 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
13000 13703 | /// [`MalformedLongInput`](crate::input::MalformedLongInput) using modelled bindings.
|
13001 13704 | pub struct MalformedLongInputFuture {
|
13002 13705 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedLongInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
13003 13706 | }
|
13004 13707 | }
|
13005 13708 |
|
13006 13709 | impl std::future::Future for MalformedLongInputFuture {
|
13007 13710 | type Output = Result<
|
13008 13711 | crate::input::MalformedLongInput,
|
13009 13712 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
13010 13713 | >;
|
13011 13714 |
|
13012 13715 | fn poll(
|
13013 13716 | self: std::pin::Pin<&mut Self>,
|
13014 13717 | cx: &mut std::task::Context<'_>,
|
13015 13718 | ) -> std::task::Poll<Self::Output> {
|
13016 13719 | let this = self.project();
|
13017 13720 | this.inner.as_mut().poll(cx)
|
13018 13721 | }
|
13019 13722 | }
|
13020 13723 |
|
13021 13724 | impl<B>
|
13022 13725 | ::aws_smithy_http_server::request::FromRequest<
|
13023 13726 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
13024 13727 | B,
|
13025 13728 | > for crate::input::MalformedLongInput
|
13026 13729 | where
|
13027 13730 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
13028 13731 | B: 'static,
|
13029 13732 |
|
13030 13733 | B::Data: Send,
|
13031 13734 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
13032 13735 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
13033 13736 | {
|
13034 13737 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
13035 13738 | type Future = MalformedLongInputFuture;
|
13036 13739 |
|
13037 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
13740 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
13038 13741 | let fut = async move {
|
13039 13742 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
13040 13743 | request.headers(),
|
13041 13744 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
13042 13745 | ) {
|
13043 13746 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
13044 13747 | }
|
13045 13748 | crate::protocol_serde::shape_malformed_long::de_malformed_long_http_request(request)
|
13046 13749 | .await
|
13047 13750 | };
|
13048 13751 | use ::futures_util::future::TryFutureExt;
|
13049 13752 | let fut = fut.map_err(
|
13050 13753 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
13051 13754 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
13052 13755 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
13053 13756 | e,
|
13054 13757 | )
|
13055 13758 | },
|
13056 13759 | );
|
13057 13760 | MalformedLongInputFuture {
|
13058 13761 | inner: Box::pin(fut),
|
13059 13762 | }
|
13060 13763 | }
|
13061 13764 | }
|
13765 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
13062 13766 | impl
|
13063 13767 | ::aws_smithy_http_server::response::IntoResponse<
|
13064 13768 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
13065 13769 | > for crate::output::MalformedLongOutput
|
13066 13770 | {
|
13067 13771 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
13068 13772 | match crate::protocol_serde::shape_malformed_long::ser_malformed_long_http_response(self) {
|
13069 13773 | Ok(response) => response,
|
13070 13774 | Err(e) => {
|
13071 13775 | ::tracing::error!(error = %e, "failed to serialize response");
|
13072 13776 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
13073 13777 | }
|
13074 13778 | }
|
13075 13779 | }
|
13076 13780 | }
|
13781 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
13077 13782 | impl
|
13078 13783 | ::aws_smithy_http_server::response::IntoResponse<
|
13079 13784 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
13080 13785 | > for crate::error::MalformedLongError
|
13081 13786 | {
|
13082 13787 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
13083 13788 | match crate::protocol_serde::shape_malformed_long::ser_malformed_long_http_error(&self) {
|
13084 13789 | Ok(mut response) => {
|
13085 13790 | response.extensions_mut().insert(
|
13086 13791 | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
13087 13792 | );
|
13088 13793 | response
|
13089 13794 | }
|
13090 13795 | Err(e) => {
|
13091 13796 | ::tracing::error!(error = %e, "failed to serialize response");
|
13092 13797 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
13093 13798 | }
|
13094 13799 | }
|
13095 13800 | }
|
13096 13801 | }
|
13097 13802 |
|
13803 + | /* RustType.kt:534 */
|
13098 13804 | #[allow(unreachable_code, unused_variables)]
|
13805 + | /* RustType.kt:534 */
|
13099 13806 | #[cfg(test)]
|
13807 + | /* ProtocolTestGenerator.kt:98 */
|
13100 13808 | mod malformed_long_test {
|
13101 13809 |
|
13102 13810 | /// Underflow or overflow should result in SerializationException
|
13103 13811 | /// Test ID: RestJsonBodyLongUnderflowOverflow_case0
|
13104 13812 | #[::tokio::test]
|
13105 13813 | #[::tracing_test::traced_test]
|
13106 13814 | async fn rest_json_body_long_underflow_overflow_case0_malformed_request() {
|
13107 13815 | {
|
13108 13816 | #[allow(unused_mut)]
|
13109 - | let mut http_request = http::Request::builder()
|
13817 + | let mut http_request = ::http_1x::Request::builder()
|
13110 13818 | .uri("/MalformedLong/1")
|
13111 13819 | .method("POST")
|
13112 13820 | .header("content-type", "application/json")
|
13113 - | .body(::aws_smithy_http_server::body::Body::from(
|
13114 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
13115 - | "{ \"longInBody\" : -184467440737095500000 }".as_bytes(),
|
13116 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13821 + | .body(::aws_smithy_http_server::body::boxed(
|
13822 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
13823 + | &::aws_smithy_protocol_test::decode_body_data(
|
13824 + | "{ \"longInBody\" : -184467440737095500000 }".as_bytes(),
|
13825 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13826 + | ),
|
13117 13827 | )),
|
13118 13828 | ))
|
13119 13829 | .unwrap();
|
13120 13830 | #[allow(unused_mut)]
|
13121 13831 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13122 13832 | let config = crate::service::RestJsonConfig::builder().build();
|
13123 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13833 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13124 13834 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13125 13835 | let sender = sender.clone();
|
13126 13836 | async move {
|
13127 13837 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13128 13838 | sender.send(()).await.expect("receiver dropped early");
|
13129 13839 | result
|
13130 13840 | }
|
13131 13841 | })
|
13132 13842 | .build_unchecked();
|
13133 13843 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13134 13844 | .await
|
13135 13845 | .expect("unable to make an HTTP request");
|
13136 13846 | ::pretty_assertions::assert_eq!(
|
13137 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13847 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13138 13848 | http_response.status()
|
13139 13849 | );
|
13140 13850 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13141 13851 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13142 13852 | http_response.headers(),
|
13143 13853 | expected_headers,
|
13144 13854 | ));
|
13145 13855 | }
|
13146 13856 | }
|
13147 13857 |
|
13148 13858 | /// Underflow or overflow should result in SerializationException
|
13149 13859 | /// Test ID: RestJsonBodyLongUnderflowOverflow_case1
|
13150 13860 | #[::tokio::test]
|
13151 13861 | #[::tracing_test::traced_test]
|
13152 13862 | async fn rest_json_body_long_underflow_overflow_case1_malformed_request() {
|
13153 13863 | {
|
13154 13864 | #[allow(unused_mut)]
|
13155 - | let mut http_request = http::Request::builder()
|
13865 + | let mut http_request = ::http_1x::Request::builder()
|
13156 13866 | .uri("/MalformedLong/1")
|
13157 13867 | .method("POST")
|
13158 13868 | .header("content-type", "application/json")
|
13159 - | .body(::aws_smithy_http_server::body::Body::from(
|
13160 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
13161 - | "{ \"longInBody\" : 184467440737095500000 }".as_bytes(),
|
13162 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13869 + | .body(::aws_smithy_http_server::body::boxed(
|
13870 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
13871 + | &::aws_smithy_protocol_test::decode_body_data(
|
13872 + | "{ \"longInBody\" : 184467440737095500000 }".as_bytes(),
|
13873 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13874 + | ),
|
13163 13875 | )),
|
13164 13876 | ))
|
13165 13877 | .unwrap();
|
13166 13878 | #[allow(unused_mut)]
|
13167 13879 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13168 13880 | let config = crate::service::RestJsonConfig::builder().build();
|
13169 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13881 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13170 13882 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13171 13883 | let sender = sender.clone();
|
13172 13884 | async move {
|
13173 13885 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13174 13886 | sender.send(()).await.expect("receiver dropped early");
|
13175 13887 | result
|
13176 13888 | }
|
13177 13889 | })
|
13178 13890 | .build_unchecked();
|
13179 13891 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13180 13892 | .await
|
13181 13893 | .expect("unable to make an HTTP request");
|
13182 13894 | ::pretty_assertions::assert_eq!(
|
13183 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13895 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13184 13896 | http_response.status()
|
13185 13897 | );
|
13186 13898 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13187 13899 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13188 13900 | http_response.headers(),
|
13189 13901 | expected_headers,
|
13190 13902 | ));
|
13191 13903 | }
|
13192 13904 | }
|
13193 13905 |
|
13194 13906 | /// Underflow or overflow should result in SerializationException
|
13195 13907 | /// Test ID: RestJsonBodyLongUnderflowOverflow_case2
|
13196 13908 | #[::tokio::test]
|
13197 13909 | #[::tracing_test::traced_test]
|
13198 13910 | async fn rest_json_body_long_underflow_overflow_case2_malformed_request() {
|
13199 13911 | {
|
13200 13912 | #[allow(unused_mut)]
|
13201 - | let mut http_request = http::Request::builder()
|
13913 + | let mut http_request = ::http_1x::Request::builder()
|
13202 13914 | .uri("/MalformedLong/1")
|
13203 13915 | .method("POST")
|
13204 13916 | .header("content-type", "application/json")
|
13205 - | .body(::aws_smithy_http_server::body::Body::from(
|
13206 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
13207 - | "{ \"longInBody\" : 123000000000000000000000 }".as_bytes(),
|
13208 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13917 + | .body(::aws_smithy_http_server::body::boxed(
|
13918 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
13919 + | &::aws_smithy_protocol_test::decode_body_data(
|
13920 + | "{ \"longInBody\" : 123000000000000000000000 }".as_bytes(),
|
13921 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
13922 + | ),
|
13209 13923 | )),
|
13210 13924 | ))
|
13211 13925 | .unwrap();
|
13212 13926 | #[allow(unused_mut)]
|
13213 13927 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13214 13928 | let config = crate::service::RestJsonConfig::builder().build();
|
13215 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13929 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13216 13930 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13217 13931 | let sender = sender.clone();
|
13218 13932 | async move {
|
13219 13933 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13220 13934 | sender.send(()).await.expect("receiver dropped early");
|
13221 13935 | result
|
13222 13936 | }
|
13223 13937 | })
|
13224 13938 | .build_unchecked();
|
13225 13939 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13226 13940 | .await
|
13227 13941 | .expect("unable to make an HTTP request");
|
13228 13942 | ::pretty_assertions::assert_eq!(
|
13229 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13943 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13230 13944 | http_response.status()
|
13231 13945 | );
|
13232 13946 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13233 13947 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13234 13948 | http_response.headers(),
|
13235 13949 | expected_headers,
|
13236 13950 | ));
|
13237 13951 | }
|
13238 13952 | }
|
13239 13953 |
|
13240 13954 | /// Underflow or overflow should result in SerializationException
|
13241 13955 | /// Test ID: RestJsonPathLongUnderflowOverflow_case0
|
13242 13956 | #[::tokio::test]
|
13243 13957 | #[::tracing_test::traced_test]
|
13244 13958 | async fn rest_json_path_long_underflow_overflow_case0_malformed_request() {
|
13245 13959 | {
|
13246 13960 | #[allow(unused_mut)]
|
13247 - | let mut http_request = http::Request::builder()
|
13961 + | let mut http_request = ::http_1x::Request::builder()
|
13248 13962 | .uri("/MalformedLong/-184467440737095500000")
|
13249 13963 | .method("POST")
|
13250 - | .body(::aws_smithy_http_server::body::Body::empty())
|
13964 + | .body(::aws_smithy_http_server::body::boxed(
|
13965 + | ::http_body_util::Empty::new(),
|
13966 + | ))
|
13251 13967 | .unwrap();
|
13252 13968 | #[allow(unused_mut)]
|
13253 13969 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13254 13970 | let config = crate::service::RestJsonConfig::builder().build();
|
13255 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
13971 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13256 13972 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13257 13973 | let sender = sender.clone();
|
13258 13974 | async move {
|
13259 13975 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13260 13976 | sender.send(()).await.expect("receiver dropped early");
|
13261 13977 | result
|
13262 13978 | }
|
13263 13979 | })
|
13264 13980 | .build_unchecked();
|
13265 13981 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13266 13982 | .await
|
13267 13983 | .expect("unable to make an HTTP request");
|
13268 13984 | ::pretty_assertions::assert_eq!(
|
13269 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13985 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13270 13986 | http_response.status()
|
13271 13987 | );
|
13272 13988 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13273 13989 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13274 13990 | http_response.headers(),
|
13275 13991 | expected_headers,
|
13276 13992 | ));
|
13277 13993 | }
|
13278 13994 | }
|
13279 13995 |
|
13280 13996 | /// Underflow or overflow should result in SerializationException
|
13281 13997 | /// Test ID: RestJsonPathLongUnderflowOverflow_case1
|
13282 13998 | #[::tokio::test]
|
13283 13999 | #[::tracing_test::traced_test]
|
13284 14000 | async fn rest_json_path_long_underflow_overflow_case1_malformed_request() {
|
13285 14001 | {
|
13286 14002 | #[allow(unused_mut)]
|
13287 - | let mut http_request = http::Request::builder()
|
14003 + | let mut http_request = ::http_1x::Request::builder()
|
13288 14004 | .uri("/MalformedLong/184467440737095500000")
|
13289 14005 | .method("POST")
|
13290 - | .body(::aws_smithy_http_server::body::Body::empty())
|
14006 + | .body(::aws_smithy_http_server::body::boxed(
|
14007 + | ::http_body_util::Empty::new(),
|
14008 + | ))
|
13291 14009 | .unwrap();
|
13292 14010 | #[allow(unused_mut)]
|
13293 14011 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13294 14012 | let config = crate::service::RestJsonConfig::builder().build();
|
13295 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14013 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13296 14014 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13297 14015 | let sender = sender.clone();
|
13298 14016 | async move {
|
13299 14017 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13300 14018 | sender.send(()).await.expect("receiver dropped early");
|
13301 14019 | result
|
13302 14020 | }
|
13303 14021 | })
|
13304 14022 | .build_unchecked();
|
13305 14023 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13306 14024 | .await
|
13307 14025 | .expect("unable to make an HTTP request");
|
13308 14026 | ::pretty_assertions::assert_eq!(
|
13309 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14027 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13310 14028 | http_response.status()
|
13311 14029 | );
|
13312 14030 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13313 14031 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13314 14032 | http_response.headers(),
|
13315 14033 | expected_headers,
|
13316 14034 | ));
|
13317 14035 | }
|
13318 14036 | }
|
13319 14037 |
|
13320 14038 | /// Underflow or overflow should result in SerializationException
|
13321 14039 | /// Test ID: RestJsonPathLongUnderflowOverflow_case2
|
13322 14040 | #[::tokio::test]
|
13323 14041 | #[::tracing_test::traced_test]
|
13324 14042 | async fn rest_json_path_long_underflow_overflow_case2_malformed_request() {
|
13325 14043 | {
|
13326 14044 | #[allow(unused_mut)]
|
13327 - | let mut http_request = http::Request::builder()
|
14045 + | let mut http_request = ::http_1x::Request::builder()
|
13328 14046 | .uri("/MalformedLong/123000000000000000000000")
|
13329 14047 | .method("POST")
|
13330 - | .body(::aws_smithy_http_server::body::Body::empty())
|
14048 + | .body(::aws_smithy_http_server::body::boxed(
|
14049 + | ::http_body_util::Empty::new(),
|
14050 + | ))
|
13331 14051 | .unwrap();
|
13332 14052 | #[allow(unused_mut)]
|
13333 14053 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13334 14054 | let config = crate::service::RestJsonConfig::builder().build();
|
13335 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14055 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13336 14056 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13337 14057 | let sender = sender.clone();
|
13338 14058 | async move {
|
13339 14059 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13340 14060 | sender.send(()).await.expect("receiver dropped early");
|
13341 14061 | result
|
13342 14062 | }
|
13343 14063 | })
|
13344 14064 | .build_unchecked();
|
13345 14065 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13346 14066 | .await
|
13347 14067 | .expect("unable to make an HTTP request");
|
13348 14068 | ::pretty_assertions::assert_eq!(
|
13349 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14069 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13350 14070 | http_response.status()
|
13351 14071 | );
|
13352 14072 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13353 14073 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13354 14074 | http_response.headers(),
|
13355 14075 | expected_headers,
|
13356 14076 | ));
|
13357 14077 | }
|
13358 14078 | }
|
13359 14079 |
|
13360 14080 | /// Underflow or overflow should result in SerializationException
|
13361 14081 | /// Test ID: RestJsonQueryLongUnderflowOverflow_case0
|
13362 14082 | #[::tokio::test]
|
13363 14083 | #[::tracing_test::traced_test]
|
13364 14084 | async fn rest_json_query_long_underflow_overflow_case0_malformed_request() {
|
13365 14085 | {
|
13366 14086 | #[allow(unused_mut)]
|
13367 - | let mut http_request = http::Request::builder()
|
14087 + | let mut http_request = ::http_1x::Request::builder()
|
13368 14088 | .uri("/MalformedLong/1")
|
13369 14089 | .method("POST")
|
13370 - | .body(::aws_smithy_http_server::body::Body::empty())
|
14090 + | .body(::aws_smithy_http_server::body::boxed(
|
14091 + | ::http_body_util::Empty::new(),
|
14092 + | ))
|
13371 14093 | .unwrap();
|
13372 14094 | *http_request.uri_mut() = "/MalformedLong/1?longInQuery=-184467440737095500000"
|
13373 14095 | .parse()
|
13374 14096 | .unwrap();
|
13375 14097 | #[allow(unused_mut)]
|
13376 14098 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13377 14099 | let config = crate::service::RestJsonConfig::builder().build();
|
13378 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14100 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13379 14101 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13380 14102 | let sender = sender.clone();
|
13381 14103 | async move {
|
13382 14104 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13383 14105 | sender.send(()).await.expect("receiver dropped early");
|
13384 14106 | result
|
13385 14107 | }
|
13386 14108 | })
|
13387 14109 | .build_unchecked();
|
13388 14110 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13389 14111 | .await
|
13390 14112 | .expect("unable to make an HTTP request");
|
13391 14113 | ::pretty_assertions::assert_eq!(
|
13392 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14114 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13393 14115 | http_response.status()
|
13394 14116 | );
|
13395 14117 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13396 14118 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13397 14119 | http_response.headers(),
|
13398 14120 | expected_headers,
|
13399 14121 | ));
|
13400 14122 | }
|
13401 14123 | }
|
13402 14124 |
|
13403 14125 | /// Underflow or overflow should result in SerializationException
|
13404 14126 | /// Test ID: RestJsonQueryLongUnderflowOverflow_case1
|
13405 14127 | #[::tokio::test]
|
13406 14128 | #[::tracing_test::traced_test]
|
13407 14129 | async fn rest_json_query_long_underflow_overflow_case1_malformed_request() {
|
13408 14130 | {
|
13409 14131 | #[allow(unused_mut)]
|
13410 - | let mut http_request = http::Request::builder()
|
14132 + | let mut http_request = ::http_1x::Request::builder()
|
13411 14133 | .uri("/MalformedLong/1")
|
13412 14134 | .method("POST")
|
13413 - | .body(::aws_smithy_http_server::body::Body::empty())
|
14135 + | .body(::aws_smithy_http_server::body::boxed(
|
14136 + | ::http_body_util::Empty::new(),
|
14137 + | ))
|
13414 14138 | .unwrap();
|
13415 14139 | *http_request.uri_mut() = "/MalformedLong/1?longInQuery=184467440737095500000"
|
13416 14140 | .parse()
|
13417 14141 | .unwrap();
|
13418 14142 | #[allow(unused_mut)]
|
13419 14143 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13420 14144 | let config = crate::service::RestJsonConfig::builder().build();
|
13421 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14145 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13422 14146 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13423 14147 | let sender = sender.clone();
|
13424 14148 | async move {
|
13425 14149 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13426 14150 | sender.send(()).await.expect("receiver dropped early");
|
13427 14151 | result
|
13428 14152 | }
|
13429 14153 | })
|
13430 14154 | .build_unchecked();
|
13431 14155 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13432 14156 | .await
|
13433 14157 | .expect("unable to make an HTTP request");
|
13434 14158 | ::pretty_assertions::assert_eq!(
|
13435 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14159 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13436 14160 | http_response.status()
|
13437 14161 | );
|
13438 14162 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13439 14163 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13440 14164 | http_response.headers(),
|
13441 14165 | expected_headers,
|
13442 14166 | ));
|
13443 14167 | }
|
13444 14168 | }
|
13445 14169 |
|
13446 14170 | /// Underflow or overflow should result in SerializationException
|
13447 14171 | /// Test ID: RestJsonQueryLongUnderflowOverflow_case2
|
13448 14172 | #[::tokio::test]
|
13449 14173 | #[::tracing_test::traced_test]
|
13450 14174 | async fn rest_json_query_long_underflow_overflow_case2_malformed_request() {
|
13451 14175 | {
|
13452 14176 | #[allow(unused_mut)]
|
13453 - | let mut http_request = http::Request::builder()
|
14177 + | let mut http_request = ::http_1x::Request::builder()
|
13454 14178 | .uri("/MalformedLong/1")
|
13455 14179 | .method("POST")
|
13456 - | .body(::aws_smithy_http_server::body::Body::empty())
|
14180 + | .body(::aws_smithy_http_server::body::boxed(
|
14181 + | ::http_body_util::Empty::new(),
|
14182 + | ))
|
13457 14183 | .unwrap();
|
13458 14184 | *http_request.uri_mut() = "/MalformedLong/1?longInQuery=123000000000000000000000"
|
13459 14185 | .parse()
|
13460 14186 | .unwrap();
|
13461 14187 | #[allow(unused_mut)]
|
13462 14188 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13463 14189 | let config = crate::service::RestJsonConfig::builder().build();
|
13464 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14190 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13465 14191 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13466 14192 | let sender = sender.clone();
|
13467 14193 | async move {
|
13468 14194 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13469 14195 | sender.send(()).await.expect("receiver dropped early");
|
13470 14196 | result
|
13471 14197 | }
|
13472 14198 | })
|
13473 14199 | .build_unchecked();
|
13474 14200 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13475 14201 | .await
|
13476 14202 | .expect("unable to make an HTTP request");
|
13477 14203 | ::pretty_assertions::assert_eq!(
|
13478 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14204 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13479 14205 | http_response.status()
|
13480 14206 | );
|
13481 14207 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13482 14208 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13483 14209 | http_response.headers(),
|
13484 14210 | expected_headers,
|
13485 14211 | ));
|
13486 14212 | }
|
13487 14213 | }
|
13488 14214 |
|
13489 14215 | /// Underflow or overflow should result in SerializationException
|
13490 14216 | /// Test ID: RestJsonHeaderLongUnderflowOverflow_case0
|
13491 14217 | #[::tokio::test]
|
13492 14218 | #[::tracing_test::traced_test]
|
13493 14219 | async fn rest_json_header_long_underflow_overflow_case0_malformed_request() {
|
13494 14220 | {
|
13495 14221 | #[allow(unused_mut)]
|
13496 - | let mut http_request = http::Request::builder()
|
14222 + | let mut http_request = ::http_1x::Request::builder()
|
13497 14223 | .uri("/MalformedLong/1")
|
13498 14224 | .method("POST")
|
13499 14225 | .header("longInHeader", "-184467440737095500000")
|
13500 - | .body(::aws_smithy_http_server::body::Body::empty())
|
14226 + | .body(::aws_smithy_http_server::body::boxed(
|
14227 + | ::http_body_util::Empty::new(),
|
14228 + | ))
|
13501 14229 | .unwrap();
|
13502 14230 | #[allow(unused_mut)]
|
13503 14231 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13504 14232 | let config = crate::service::RestJsonConfig::builder().build();
|
13505 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14233 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13506 14234 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13507 14235 | let sender = sender.clone();
|
13508 14236 | async move {
|
13509 14237 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13510 14238 | sender.send(()).await.expect("receiver dropped early");
|
13511 14239 | result
|
13512 14240 | }
|
13513 14241 | })
|
13514 14242 | .build_unchecked();
|
13515 14243 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13516 14244 | .await
|
13517 14245 | .expect("unable to make an HTTP request");
|
13518 14246 | ::pretty_assertions::assert_eq!(
|
13519 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14247 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13520 14248 | http_response.status()
|
13521 14249 | );
|
13522 14250 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13523 14251 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13524 14252 | http_response.headers(),
|
13525 14253 | expected_headers,
|
13526 14254 | ));
|
13527 14255 | }
|
13528 14256 | }
|
13529 14257 |
|
13530 14258 | /// Underflow or overflow should result in SerializationException
|
13531 14259 | /// Test ID: RestJsonHeaderLongUnderflowOverflow_case1
|
13532 14260 | #[::tokio::test]
|
13533 14261 | #[::tracing_test::traced_test]
|
13534 14262 | async fn rest_json_header_long_underflow_overflow_case1_malformed_request() {
|
13535 14263 | {
|
13536 14264 | #[allow(unused_mut)]
|
13537 - | let mut http_request = http::Request::builder()
|
14265 + | let mut http_request = ::http_1x::Request::builder()
|
13538 14266 | .uri("/MalformedLong/1")
|
13539 14267 | .method("POST")
|
13540 14268 | .header("longInHeader", "184467440737095500000")
|
13541 - | .body(::aws_smithy_http_server::body::Body::empty())
|
14269 + | .body(::aws_smithy_http_server::body::boxed(
|
14270 + | ::http_body_util::Empty::new(),
|
14271 + | ))
|
13542 14272 | .unwrap();
|
13543 14273 | #[allow(unused_mut)]
|
13544 14274 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13545 14275 | let config = crate::service::RestJsonConfig::builder().build();
|
13546 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14276 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13547 14277 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13548 14278 | let sender = sender.clone();
|
13549 14279 | async move {
|
13550 14280 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13551 14281 | sender.send(()).await.expect("receiver dropped early");
|
13552 14282 | result
|
13553 14283 | }
|
13554 14284 | })
|
13555 14285 | .build_unchecked();
|
13556 14286 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13557 14287 | .await
|
13558 14288 | .expect("unable to make an HTTP request");
|
13559 14289 | ::pretty_assertions::assert_eq!(
|
13560 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14290 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13561 14291 | http_response.status()
|
13562 14292 | );
|
13563 14293 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13564 14294 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13565 14295 | http_response.headers(),
|
13566 14296 | expected_headers,
|
13567 14297 | ));
|
13568 14298 | }
|
13569 14299 | }
|
13570 14300 |
|
13571 14301 | /// Underflow or overflow should result in SerializationException
|
13572 14302 | /// Test ID: RestJsonHeaderLongUnderflowOverflow_case2
|
13573 14303 | #[::tokio::test]
|
13574 14304 | #[::tracing_test::traced_test]
|
13575 14305 | async fn rest_json_header_long_underflow_overflow_case2_malformed_request() {
|
13576 14306 | {
|
13577 14307 | #[allow(unused_mut)]
|
13578 - | let mut http_request = http::Request::builder()
|
14308 + | let mut http_request = ::http_1x::Request::builder()
|
13579 14309 | .uri("/MalformedLong/1")
|
13580 14310 | .method("POST")
|
13581 14311 | .header("longInHeader", "123000000000000000000000")
|
13582 - | .body(::aws_smithy_http_server::body::Body::empty())
|
14312 + | .body(::aws_smithy_http_server::body::boxed(
|
14313 + | ::http_body_util::Empty::new(),
|
14314 + | ))
|
13583 14315 | .unwrap();
|
13584 14316 | #[allow(unused_mut)]
|
13585 14317 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13586 14318 | let config = crate::service::RestJsonConfig::builder().build();
|
13587 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14319 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13588 14320 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13589 14321 | let sender = sender.clone();
|
13590 14322 | async move {
|
13591 14323 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13592 14324 | sender.send(()).await.expect("receiver dropped early");
|
13593 14325 | result
|
13594 14326 | }
|
13595 14327 | })
|
13596 14328 | .build_unchecked();
|
13597 14329 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13598 14330 | .await
|
13599 14331 | .expect("unable to make an HTTP request");
|
13600 14332 | ::pretty_assertions::assert_eq!(
|
13601 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14333 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13602 14334 | http_response.status()
|
13603 14335 | );
|
13604 14336 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13605 14337 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13606 14338 | http_response.headers(),
|
13607 14339 | expected_headers,
|
13608 14340 | ));
|
13609 14341 | }
|
13610 14342 | }
|
13611 14343 |
|
13612 14344 | /// Malformed values in the body should be rejected
|
13613 14345 | /// Test ID: RestJsonBodyLongMalformedValueRejected_case0
|
13614 14346 | #[::tokio::test]
|
13615 14347 | #[::tracing_test::traced_test]
|
13616 14348 | async fn rest_json_body_long_malformed_value_rejected_case0_malformed_request() {
|
13617 14349 | {
|
13618 14350 | #[allow(unused_mut)]
|
13619 - | let mut http_request = http::Request::builder()
|
14351 + | let mut http_request = ::http_1x::Request::builder()
|
13620 14352 | .uri("/MalformedLong/1")
|
13621 14353 | .method("POST")
|
13622 14354 | .header("content-type", "application/json")
|
13623 - | .body(::aws_smithy_http_server::body::Body::from(
|
13624 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
13625 - | "{ \"longInBody\" : \"123\" }".as_bytes(),
|
13626 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14355 + | .body(::aws_smithy_http_server::body::boxed(
|
14356 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
14357 + | &::aws_smithy_protocol_test::decode_body_data(
|
14358 + | "{ \"longInBody\" : \"123\" }".as_bytes(),
|
14359 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14360 + | ),
|
13627 14361 | )),
|
13628 14362 | ))
|
13629 14363 | .unwrap();
|
13630 14364 | #[allow(unused_mut)]
|
13631 14365 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13632 14366 | let config = crate::service::RestJsonConfig::builder().build();
|
13633 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14367 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13634 14368 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13635 14369 | let sender = sender.clone();
|
13636 14370 | async move {
|
13637 14371 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13638 14372 | sender.send(()).await.expect("receiver dropped early");
|
13639 14373 | result
|
13640 14374 | }
|
13641 14375 | })
|
13642 14376 | .build_unchecked();
|
13643 14377 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13644 14378 | .await
|
13645 14379 | .expect("unable to make an HTTP request");
|
13646 14380 | ::pretty_assertions::assert_eq!(
|
13647 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14381 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13648 14382 | http_response.status()
|
13649 14383 | );
|
13650 14384 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13651 14385 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13652 14386 | http_response.headers(),
|
13653 14387 | expected_headers,
|
13654 14388 | ));
|
13655 14389 | }
|
13656 14390 | }
|
13657 14391 |
|
13658 14392 | /// Malformed values in the body should be rejected
|
13659 14393 | /// Test ID: RestJsonBodyLongMalformedValueRejected_case1
|
13660 14394 | #[::tokio::test]
|
13661 14395 | #[::tracing_test::traced_test]
|
13662 14396 | async fn rest_json_body_long_malformed_value_rejected_case1_malformed_request() {
|
13663 14397 | {
|
13664 14398 | #[allow(unused_mut)]
|
13665 - | let mut http_request = http::Request::builder()
|
14399 + | let mut http_request = ::http_1x::Request::builder()
|
13666 14400 | .uri("/MalformedLong/1")
|
13667 14401 | .method("POST")
|
13668 14402 | .header("content-type", "application/json")
|
13669 - | .body(::aws_smithy_http_server::body::Body::from(
|
13670 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
13671 - | "{ \"longInBody\" : true }".as_bytes(),
|
13672 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14403 + | .body(::aws_smithy_http_server::body::boxed(
|
14404 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
14405 + | &::aws_smithy_protocol_test::decode_body_data(
|
14406 + | "{ \"longInBody\" : true }".as_bytes(),
|
14407 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14408 + | ),
|
13673 14409 | )),
|
13674 14410 | ))
|
13675 14411 | .unwrap();
|
13676 14412 | #[allow(unused_mut)]
|
13677 14413 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13678 14414 | let config = crate::service::RestJsonConfig::builder().build();
|
13679 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14415 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13680 14416 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13681 14417 | let sender = sender.clone();
|
13682 14418 | async move {
|
13683 14419 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13684 14420 | sender.send(()).await.expect("receiver dropped early");
|
13685 14421 | result
|
13686 14422 | }
|
13687 14423 | })
|
13688 14424 | .build_unchecked();
|
13689 14425 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13690 14426 | .await
|
13691 14427 | .expect("unable to make an HTTP request");
|
13692 14428 | ::pretty_assertions::assert_eq!(
|
13693 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14429 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13694 14430 | http_response.status()
|
13695 14431 | );
|
13696 14432 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13697 14433 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13698 14434 | http_response.headers(),
|
13699 14435 | expected_headers,
|
13700 14436 | ));
|
13701 14437 | }
|
13702 14438 | }
|
13703 14439 |
|
13704 14440 | /// Malformed values in the body should be rejected
|
13705 14441 | /// Test ID: RestJsonBodyLongMalformedValueRejected_case2
|
13706 14442 | #[::tokio::test]
|
13707 14443 | #[::tracing_test::traced_test]
|
13708 14444 | async fn rest_json_body_long_malformed_value_rejected_case2_malformed_request() {
|
13709 14445 | {
|
13710 14446 | #[allow(unused_mut)]
|
13711 - | let mut http_request = http::Request::builder()
|
14447 + | let mut http_request = ::http_1x::Request::builder()
|
13712 14448 | .uri("/MalformedLong/1")
|
13713 14449 | .method("POST")
|
13714 14450 | .header("content-type", "application/json")
|
13715 - | .body(::aws_smithy_http_server::body::Body::from(
|
13716 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
13717 - | "{ \"longInBody\" : 1.001 }".as_bytes(),
|
13718 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14451 + | .body(::aws_smithy_http_server::body::boxed(
|
14452 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
14453 + | &::aws_smithy_protocol_test::decode_body_data(
|
14454 + | "{ \"longInBody\" : 1.001 }".as_bytes(),
|
14455 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14456 + | ),
|
13719 14457 | )),
|
13720 14458 | ))
|
13721 14459 | .unwrap();
|
13722 14460 | #[allow(unused_mut)]
|
13723 14461 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13724 14462 | let config = crate::service::RestJsonConfig::builder().build();
|
13725 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14463 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13726 14464 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13727 14465 | let sender = sender.clone();
|
13728 14466 | async move {
|
13729 14467 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13730 14468 | sender.send(()).await.expect("receiver dropped early");
|
13731 14469 | result
|
13732 14470 | }
|
13733 14471 | })
|
13734 14472 | .build_unchecked();
|
13735 14473 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13736 14474 | .await
|
13737 14475 | .expect("unable to make an HTTP request");
|
13738 14476 | ::pretty_assertions::assert_eq!(
|
13739 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14477 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13740 14478 | http_response.status()
|
13741 14479 | );
|
13742 14480 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13743 14481 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13744 14482 | http_response.headers(),
|
13745 14483 | expected_headers,
|
13746 14484 | ));
|
13747 14485 | }
|
13748 14486 | }
|
13749 14487 |
|
13750 14488 | /// Malformed values in the body should be rejected
|
13751 14489 | /// Test ID: RestJsonBodyLongMalformedValueRejected_case3
|
13752 14490 | #[::tokio::test]
|
13753 14491 | #[::tracing_test::traced_test]
|
13754 14492 | async fn rest_json_body_long_malformed_value_rejected_case3_malformed_request() {
|
13755 14493 | {
|
13756 14494 | #[allow(unused_mut)]
|
13757 - | let mut http_request = http::Request::builder()
|
14495 + | let mut http_request = ::http_1x::Request::builder()
|
13758 14496 | .uri("/MalformedLong/1")
|
13759 14497 | .method("POST")
|
13760 14498 | .header("content-type", "application/json")
|
13761 - | .body(::aws_smithy_http_server::body::Body::from(
|
13762 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
13763 - | "{ \"longInBody\" : 2ABC }".as_bytes(),
|
13764 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14499 + | .body(::aws_smithy_http_server::body::boxed(
|
14500 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
14501 + | &::aws_smithy_protocol_test::decode_body_data(
|
14502 + | "{ \"longInBody\" : 2ABC }".as_bytes(),
|
14503 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14504 + | ),
|
13765 14505 | )),
|
13766 14506 | ))
|
13767 14507 | .unwrap();
|
13768 14508 | #[allow(unused_mut)]
|
13769 14509 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13770 14510 | let config = crate::service::RestJsonConfig::builder().build();
|
13771 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14511 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13772 14512 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13773 14513 | let sender = sender.clone();
|
13774 14514 | async move {
|
13775 14515 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13776 14516 | sender.send(()).await.expect("receiver dropped early");
|
13777 14517 | result
|
13778 14518 | }
|
13779 14519 | })
|
13780 14520 | .build_unchecked();
|
13781 14521 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13782 14522 | .await
|
13783 14523 | .expect("unable to make an HTTP request");
|
13784 14524 | ::pretty_assertions::assert_eq!(
|
13785 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14525 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13786 14526 | http_response.status()
|
13787 14527 | );
|
13788 14528 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13789 14529 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13790 14530 | http_response.headers(),
|
13791 14531 | expected_headers,
|
13792 14532 | ));
|
13793 14533 | }
|
13794 14534 | }
|
13795 14535 |
|
13796 14536 | /// Malformed values in the body should be rejected
|
13797 14537 | /// Test ID: RestJsonBodyLongMalformedValueRejected_case4
|
13798 14538 | #[::tokio::test]
|
13799 14539 | #[::tracing_test::traced_test]
|
13800 14540 | async fn rest_json_body_long_malformed_value_rejected_case4_malformed_request() {
|
13801 14541 | {
|
13802 14542 | #[allow(unused_mut)]
|
13803 - | let mut http_request = http::Request::builder()
|
14543 + | let mut http_request = ::http_1x::Request::builder()
|
13804 14544 | .uri("/MalformedLong/1")
|
13805 14545 | .method("POST")
|
13806 14546 | .header("content-type", "application/json")
|
13807 - | .body(::aws_smithy_http_server::body::Body::from(
|
13808 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
13809 - | "{ \"longInBody\" : 0x42 }".as_bytes(),
|
13810 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14547 + | .body(::aws_smithy_http_server::body::boxed(
|
14548 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
14549 + | &::aws_smithy_protocol_test::decode_body_data(
|
14550 + | "{ \"longInBody\" : 0x42 }".as_bytes(),
|
14551 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14552 + | ),
|
13811 14553 | )),
|
13812 14554 | ))
|
13813 14555 | .unwrap();
|
13814 14556 | #[allow(unused_mut)]
|
13815 14557 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13816 14558 | let config = crate::service::RestJsonConfig::builder().build();
|
13817 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14559 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13818 14560 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13819 14561 | let sender = sender.clone();
|
13820 14562 | async move {
|
13821 14563 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13822 14564 | sender.send(()).await.expect("receiver dropped early");
|
13823 14565 | result
|
13824 14566 | }
|
13825 14567 | })
|
13826 14568 | .build_unchecked();
|
13827 14569 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13828 14570 | .await
|
13829 14571 | .expect("unable to make an HTTP request");
|
13830 14572 | ::pretty_assertions::assert_eq!(
|
13831 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14573 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13832 14574 | http_response.status()
|
13833 14575 | );
|
13834 14576 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13835 14577 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13836 14578 | http_response.headers(),
|
13837 14579 | expected_headers,
|
13838 14580 | ));
|
13839 14581 | }
|
13840 14582 | }
|
13841 14583 |
|
13842 14584 | /// Malformed values in the body should be rejected
|
13843 14585 | /// Test ID: RestJsonBodyLongMalformedValueRejected_case5
|
13844 14586 | #[::tokio::test]
|
13845 14587 | #[::tracing_test::traced_test]
|
13846 14588 | async fn rest_json_body_long_malformed_value_rejected_case5_malformed_request() {
|
13847 14589 | {
|
13848 14590 | #[allow(unused_mut)]
|
13849 - | let mut http_request = http::Request::builder()
|
14591 + | let mut http_request = ::http_1x::Request::builder()
|
13850 14592 | .uri("/MalformedLong/1")
|
13851 14593 | .method("POST")
|
13852 14594 | .header("content-type", "application/json")
|
13853 - | .body(::aws_smithy_http_server::body::Body::from(
|
13854 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
13855 - | "{ \"longInBody\" : Infinity }".as_bytes(),
|
13856 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14595 + | .body(::aws_smithy_http_server::body::boxed(
|
14596 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
14597 + | &::aws_smithy_protocol_test::decode_body_data(
|
14598 + | "{ \"longInBody\" : Infinity }".as_bytes(),
|
14599 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14600 + | ),
|
13857 14601 | )),
|
13858 14602 | ))
|
13859 14603 | .unwrap();
|
13860 14604 | #[allow(unused_mut)]
|
13861 14605 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13862 14606 | let config = crate::service::RestJsonConfig::builder().build();
|
13863 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14607 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13864 14608 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13865 14609 | let sender = sender.clone();
|
13866 14610 | async move {
|
13867 14611 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13868 14612 | sender.send(()).await.expect("receiver dropped early");
|
13869 14613 | result
|
13870 14614 | }
|
13871 14615 | })
|
13872 14616 | .build_unchecked();
|
13873 14617 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13874 14618 | .await
|
13875 14619 | .expect("unable to make an HTTP request");
|
13876 14620 | ::pretty_assertions::assert_eq!(
|
13877 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14621 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13878 14622 | http_response.status()
|
13879 14623 | );
|
13880 14624 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13881 14625 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13882 14626 | http_response.headers(),
|
13883 14627 | expected_headers,
|
13884 14628 | ));
|
13885 14629 | }
|
13886 14630 | }
|
13887 14631 |
|
13888 14632 | /// Malformed values in the body should be rejected
|
13889 14633 | /// Test ID: RestJsonBodyLongMalformedValueRejected_case6
|
13890 14634 | #[::tokio::test]
|
13891 14635 | #[::tracing_test::traced_test]
|
13892 14636 | async fn rest_json_body_long_malformed_value_rejected_case6_malformed_request() {
|
13893 14637 | {
|
13894 14638 | #[allow(unused_mut)]
|
13895 - | let mut http_request = http::Request::builder()
|
14639 + | let mut http_request = ::http_1x::Request::builder()
|
13896 14640 | .uri("/MalformedLong/1")
|
13897 14641 | .method("POST")
|
13898 14642 | .header("content-type", "application/json")
|
13899 - | .body(::aws_smithy_http_server::body::Body::from(
|
13900 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
13901 - | "{ \"longInBody\" : \"Infinity\" }".as_bytes(),
|
13902 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14643 + | .body(::aws_smithy_http_server::body::boxed(
|
14644 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
14645 + | &::aws_smithy_protocol_test::decode_body_data(
|
14646 + | "{ \"longInBody\" : \"Infinity\" }".as_bytes(),
|
14647 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14648 + | ),
|
13903 14649 | )),
|
13904 14650 | ))
|
13905 14651 | .unwrap();
|
13906 14652 | #[allow(unused_mut)]
|
13907 14653 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13908 14654 | let config = crate::service::RestJsonConfig::builder().build();
|
13909 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14655 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13910 14656 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13911 14657 | let sender = sender.clone();
|
13912 14658 | async move {
|
13913 14659 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13914 14660 | sender.send(()).await.expect("receiver dropped early");
|
13915 14661 | result
|
13916 14662 | }
|
13917 14663 | })
|
13918 14664 | .build_unchecked();
|
13919 14665 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13920 14666 | .await
|
13921 14667 | .expect("unable to make an HTTP request");
|
13922 14668 | ::pretty_assertions::assert_eq!(
|
13923 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14669 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13924 14670 | http_response.status()
|
13925 14671 | );
|
13926 14672 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13927 14673 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13928 14674 | http_response.headers(),
|
13929 14675 | expected_headers,
|
13930 14676 | ));
|
13931 14677 | }
|
13932 14678 | }
|
13933 14679 |
|
13934 14680 | /// Malformed values in the body should be rejected
|
13935 14681 | /// Test ID: RestJsonBodyLongMalformedValueRejected_case7
|
13936 14682 | #[::tokio::test]
|
13937 14683 | #[::tracing_test::traced_test]
|
13938 14684 | async fn rest_json_body_long_malformed_value_rejected_case7_malformed_request() {
|
13939 14685 | {
|
13940 14686 | #[allow(unused_mut)]
|
13941 - | let mut http_request = http::Request::builder()
|
14687 + | let mut http_request = ::http_1x::Request::builder()
|
13942 14688 | .uri("/MalformedLong/1")
|
13943 14689 | .method("POST")
|
13944 14690 | .header("content-type", "application/json")
|
13945 - | .body(::aws_smithy_http_server::body::Body::from(
|
13946 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
13947 - | "{ \"longInBody\" : -Infinity }".as_bytes(),
|
13948 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14691 + | .body(::aws_smithy_http_server::body::boxed(
|
14692 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
14693 + | &::aws_smithy_protocol_test::decode_body_data(
|
14694 + | "{ \"longInBody\" : -Infinity }".as_bytes(),
|
14695 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14696 + | ),
|
13949 14697 | )),
|
13950 14698 | ))
|
13951 14699 | .unwrap();
|
13952 14700 | #[allow(unused_mut)]
|
13953 14701 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
13954 14702 | let config = crate::service::RestJsonConfig::builder().build();
|
13955 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14703 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
13956 14704 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
13957 14705 | let sender = sender.clone();
|
13958 14706 | async move {
|
13959 14707 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
13960 14708 | sender.send(()).await.expect("receiver dropped early");
|
13961 14709 | result
|
13962 14710 | }
|
13963 14711 | })
|
13964 14712 | .build_unchecked();
|
13965 14713 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
13966 14714 | .await
|
13967 14715 | .expect("unable to make an HTTP request");
|
13968 14716 | ::pretty_assertions::assert_eq!(
|
13969 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14717 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
13970 14718 | http_response.status()
|
13971 14719 | );
|
13972 14720 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
13973 14721 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
13974 14722 | http_response.headers(),
|
13975 14723 | expected_headers,
|
13976 14724 | ));
|
13977 14725 | }
|
13978 14726 | }
|
13979 14727 |
|
13980 14728 | /// Malformed values in the body should be rejected
|
13981 14729 | /// Test ID: RestJsonBodyLongMalformedValueRejected_case8
|
13982 14730 | #[::tokio::test]
|
13983 14731 | #[::tracing_test::traced_test]
|
13984 14732 | async fn rest_json_body_long_malformed_value_rejected_case8_malformed_request() {
|
13985 14733 | {
|
13986 14734 | #[allow(unused_mut)]
|
13987 - | let mut http_request = http::Request::builder()
|
14735 + | let mut http_request = ::http_1x::Request::builder()
|
13988 14736 | .uri("/MalformedLong/1")
|
13989 14737 | .method("POST")
|
13990 14738 | .header("content-type", "application/json")
|
13991 - | .body(::aws_smithy_http_server::body::Body::from(
|
13992 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
13993 - | "{ \"longInBody\" : \"-Infinity\" }".as_bytes(),
|
13994 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14739 + | .body(::aws_smithy_http_server::body::boxed(
|
14740 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
14741 + | &::aws_smithy_protocol_test::decode_body_data(
|
14742 + | "{ \"longInBody\" : \"-Infinity\" }".as_bytes(),
|
14743 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14744 + | ),
|
13995 14745 | )),
|
13996 14746 | ))
|
13997 14747 | .unwrap();
|
13998 14748 | #[allow(unused_mut)]
|
13999 14749 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14000 14750 | let config = crate::service::RestJsonConfig::builder().build();
|
14001 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14751 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14002 14752 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14003 14753 | let sender = sender.clone();
|
14004 14754 | async move {
|
14005 14755 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14006 14756 | sender.send(()).await.expect("receiver dropped early");
|
14007 14757 | result
|
14008 14758 | }
|
14009 14759 | })
|
14010 14760 | .build_unchecked();
|
14011 14761 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14012 14762 | .await
|
14013 14763 | .expect("unable to make an HTTP request");
|
14014 14764 | ::pretty_assertions::assert_eq!(
|
14015 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14765 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14016 14766 | http_response.status()
|
14017 14767 | );
|
14018 14768 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14019 14769 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14020 14770 | http_response.headers(),
|
14021 14771 | expected_headers,
|
14022 14772 | ));
|
14023 14773 | }
|
14024 14774 | }
|
14025 14775 |
|
14026 14776 | /// Malformed values in the body should be rejected
|
14027 14777 | /// Test ID: RestJsonBodyLongMalformedValueRejected_case9
|
14028 14778 | #[::tokio::test]
|
14029 14779 | #[::tracing_test::traced_test]
|
14030 14780 | async fn rest_json_body_long_malformed_value_rejected_case9_malformed_request() {
|
14031 14781 | {
|
14032 14782 | #[allow(unused_mut)]
|
14033 - | let mut http_request = http::Request::builder()
|
14783 + | let mut http_request = ::http_1x::Request::builder()
|
14034 14784 | .uri("/MalformedLong/1")
|
14035 14785 | .method("POST")
|
14036 14786 | .header("content-type", "application/json")
|
14037 - | .body(::aws_smithy_http_server::body::Body::from(
|
14038 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
14039 - | "{ \"longInBody\" : NaN }".as_bytes(),
|
14040 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14787 + | .body(::aws_smithy_http_server::body::boxed(
|
14788 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
14789 + | &::aws_smithy_protocol_test::decode_body_data(
|
14790 + | "{ \"longInBody\" : NaN }".as_bytes(),
|
14791 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14792 + | ),
|
14041 14793 | )),
|
14042 14794 | ))
|
14043 14795 | .unwrap();
|
14044 14796 | #[allow(unused_mut)]
|
14045 14797 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14046 14798 | let config = crate::service::RestJsonConfig::builder().build();
|
14047 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14799 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14048 14800 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14049 14801 | let sender = sender.clone();
|
14050 14802 | async move {
|
14051 14803 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14052 14804 | sender.send(()).await.expect("receiver dropped early");
|
14053 14805 | result
|
14054 14806 | }
|
14055 14807 | })
|
14056 14808 | .build_unchecked();
|
14057 14809 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14058 14810 | .await
|
14059 14811 | .expect("unable to make an HTTP request");
|
14060 14812 | ::pretty_assertions::assert_eq!(
|
14061 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14813 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14062 14814 | http_response.status()
|
14063 14815 | );
|
14064 14816 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14065 14817 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14066 14818 | http_response.headers(),
|
14067 14819 | expected_headers,
|
14068 14820 | ));
|
14069 14821 | }
|
14070 14822 | }
|
14071 14823 |
|
14072 14824 | /// Malformed values in the body should be rejected
|
14073 14825 | /// Test ID: RestJsonBodyLongMalformedValueRejected_case10
|
14074 14826 | #[::tokio::test]
|
14075 14827 | #[::tracing_test::traced_test]
|
14076 14828 | async fn rest_json_body_long_malformed_value_rejected_case10_malformed_request() {
|
14077 14829 | {
|
14078 14830 | #[allow(unused_mut)]
|
14079 - | let mut http_request = http::Request::builder()
|
14831 + | let mut http_request = ::http_1x::Request::builder()
|
14080 14832 | .uri("/MalformedLong/1")
|
14081 14833 | .method("POST")
|
14082 14834 | .header("content-type", "application/json")
|
14083 - | .body(::aws_smithy_http_server::body::Body::from(
|
14084 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
14085 - | "{ \"longInBody\" : \"NaN\" }".as_bytes(),
|
14086 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14835 + | .body(::aws_smithy_http_server::body::boxed(
|
14836 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
14837 + | &::aws_smithy_protocol_test::decode_body_data(
|
14838 + | "{ \"longInBody\" : \"NaN\" }".as_bytes(),
|
14839 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
14840 + | ),
|
14087 14841 | )),
|
14088 14842 | ))
|
14089 14843 | .unwrap();
|
14090 14844 | #[allow(unused_mut)]
|
14091 14845 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14092 14846 | let config = crate::service::RestJsonConfig::builder().build();
|
14093 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14847 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14094 14848 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14095 14849 | let sender = sender.clone();
|
14096 14850 | async move {
|
14097 14851 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14098 14852 | sender.send(()).await.expect("receiver dropped early");
|
14099 14853 | result
|
14100 14854 | }
|
14101 14855 | })
|
14102 14856 | .build_unchecked();
|
14103 14857 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14104 14858 | .await
|
14105 14859 | .expect("unable to make an HTTP request");
|
14106 14860 | ::pretty_assertions::assert_eq!(
|
14107 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14861 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14108 14862 | http_response.status()
|
14109 14863 | );
|
14110 14864 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14111 14865 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14112 14866 | http_response.headers(),
|
14113 14867 | expected_headers,
|
14114 14868 | ));
|
14115 14869 | }
|
14116 14870 | }
|
14117 14871 |
|
14118 14872 | /// Malformed values in the path should be rejected
|
14119 14873 | /// Test ID: RestJsonPathLongMalformedValueRejected_case0
|
14120 14874 | #[::tokio::test]
|
14121 14875 | #[::tracing_test::traced_test]
|
14122 14876 | async fn rest_json_path_long_malformed_value_rejected_case0_malformed_request() {
|
14123 14877 | {
|
14124 14878 | #[allow(unused_mut)]
|
14125 - | let mut http_request = http::Request::builder()
|
14879 + | let mut http_request = ::http_1x::Request::builder()
|
14126 14880 | .uri("/MalformedLong/true")
|
14127 14881 | .method("POST")
|
14128 - | .body(::aws_smithy_http_server::body::Body::empty())
|
14882 + | .body(::aws_smithy_http_server::body::boxed(
|
14883 + | ::http_body_util::Empty::new(),
|
14884 + | ))
|
14129 14885 | .unwrap();
|
14130 14886 | #[allow(unused_mut)]
|
14131 14887 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14132 14888 | let config = crate::service::RestJsonConfig::builder().build();
|
14133 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14889 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14134 14890 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14135 14891 | let sender = sender.clone();
|
14136 14892 | async move {
|
14137 14893 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14138 14894 | sender.send(()).await.expect("receiver dropped early");
|
14139 14895 | result
|
14140 14896 | }
|
14141 14897 | })
|
14142 14898 | .build_unchecked();
|
14143 14899 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14144 14900 | .await
|
14145 14901 | .expect("unable to make an HTTP request");
|
14146 14902 | ::pretty_assertions::assert_eq!(
|
14147 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14903 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14148 14904 | http_response.status()
|
14149 14905 | );
|
14150 14906 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14151 14907 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14152 14908 | http_response.headers(),
|
14153 14909 | expected_headers,
|
14154 14910 | ));
|
14155 14911 | }
|
14156 14912 | }
|
14157 14913 |
|
14158 14914 | /// Malformed values in the path should be rejected
|
14159 14915 | /// Test ID: RestJsonPathLongMalformedValueRejected_case1
|
14160 14916 | #[::tokio::test]
|
14161 14917 | #[::tracing_test::traced_test]
|
14162 14918 | async fn rest_json_path_long_malformed_value_rejected_case1_malformed_request() {
|
14163 14919 | {
|
14164 14920 | #[allow(unused_mut)]
|
14165 - | let mut http_request = http::Request::builder()
|
14921 + | let mut http_request = ::http_1x::Request::builder()
|
14166 14922 | .uri("/MalformedLong/1.001")
|
14167 14923 | .method("POST")
|
14168 - | .body(::aws_smithy_http_server::body::Body::empty())
|
14924 + | .body(::aws_smithy_http_server::body::boxed(
|
14925 + | ::http_body_util::Empty::new(),
|
14926 + | ))
|
14169 14927 | .unwrap();
|
14170 14928 | #[allow(unused_mut)]
|
14171 14929 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14172 14930 | let config = crate::service::RestJsonConfig::builder().build();
|
14173 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14931 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14174 14932 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14175 14933 | let sender = sender.clone();
|
14176 14934 | async move {
|
14177 14935 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14178 14936 | sender.send(()).await.expect("receiver dropped early");
|
14179 14937 | result
|
14180 14938 | }
|
14181 14939 | })
|
14182 14940 | .build_unchecked();
|
14183 14941 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14184 14942 | .await
|
14185 14943 | .expect("unable to make an HTTP request");
|
14186 14944 | ::pretty_assertions::assert_eq!(
|
14187 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14945 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14188 14946 | http_response.status()
|
14189 14947 | );
|
14190 14948 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14191 14949 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14192 14950 | http_response.headers(),
|
14193 14951 | expected_headers,
|
14194 14952 | ));
|
14195 14953 | }
|
14196 14954 | }
|
14197 14955 |
|
14198 14956 | /// Malformed values in the path should be rejected
|
14199 14957 | /// Test ID: RestJsonPathLongMalformedValueRejected_case2
|
14200 14958 | #[::tokio::test]
|
14201 14959 | #[::tracing_test::traced_test]
|
14202 14960 | async fn rest_json_path_long_malformed_value_rejected_case2_malformed_request() {
|
14203 14961 | {
|
14204 14962 | #[allow(unused_mut)]
|
14205 - | let mut http_request = http::Request::builder()
|
14963 + | let mut http_request = ::http_1x::Request::builder()
|
14206 14964 | .uri("/MalformedLong/2ABC")
|
14207 14965 | .method("POST")
|
14208 - | .body(::aws_smithy_http_server::body::Body::empty())
|
14966 + | .body(::aws_smithy_http_server::body::boxed(
|
14967 + | ::http_body_util::Empty::new(),
|
14968 + | ))
|
14209 14969 | .unwrap();
|
14210 14970 | #[allow(unused_mut)]
|
14211 14971 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14212 14972 | let config = crate::service::RestJsonConfig::builder().build();
|
14213 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
14973 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14214 14974 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14215 14975 | let sender = sender.clone();
|
14216 14976 | async move {
|
14217 14977 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14218 14978 | sender.send(()).await.expect("receiver dropped early");
|
14219 14979 | result
|
14220 14980 | }
|
14221 14981 | })
|
14222 14982 | .build_unchecked();
|
14223 14983 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14224 14984 | .await
|
14225 14985 | .expect("unable to make an HTTP request");
|
14226 14986 | ::pretty_assertions::assert_eq!(
|
14227 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14987 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14228 14988 | http_response.status()
|
14229 14989 | );
|
14230 14990 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14231 14991 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14232 14992 | http_response.headers(),
|
14233 14993 | expected_headers,
|
14234 14994 | ));
|
14235 14995 | }
|
14236 14996 | }
|
14237 14997 |
|
14238 14998 | /// Malformed values in the path should be rejected
|
14239 14999 | /// Test ID: RestJsonPathLongMalformedValueRejected_case3
|
14240 15000 | #[::tokio::test]
|
14241 15001 | #[::tracing_test::traced_test]
|
14242 15002 | async fn rest_json_path_long_malformed_value_rejected_case3_malformed_request() {
|
14243 15003 | {
|
14244 15004 | #[allow(unused_mut)]
|
14245 - | let mut http_request = http::Request::builder()
|
15005 + | let mut http_request = ::http_1x::Request::builder()
|
14246 15006 | .uri("/MalformedLong/0x42")
|
14247 15007 | .method("POST")
|
14248 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15008 + | .body(::aws_smithy_http_server::body::boxed(
|
15009 + | ::http_body_util::Empty::new(),
|
15010 + | ))
|
14249 15011 | .unwrap();
|
14250 15012 | #[allow(unused_mut)]
|
14251 15013 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14252 15014 | let config = crate::service::RestJsonConfig::builder().build();
|
14253 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15015 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14254 15016 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14255 15017 | let sender = sender.clone();
|
14256 15018 | async move {
|
14257 15019 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14258 15020 | sender.send(()).await.expect("receiver dropped early");
|
14259 15021 | result
|
14260 15022 | }
|
14261 15023 | })
|
14262 15024 | .build_unchecked();
|
14263 15025 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14264 15026 | .await
|
14265 15027 | .expect("unable to make an HTTP request");
|
14266 15028 | ::pretty_assertions::assert_eq!(
|
14267 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15029 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14268 15030 | http_response.status()
|
14269 15031 | );
|
14270 15032 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14271 15033 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14272 15034 | http_response.headers(),
|
14273 15035 | expected_headers,
|
14274 15036 | ));
|
14275 15037 | }
|
14276 15038 | }
|
14277 15039 |
|
14278 15040 | /// Malformed values in the path should be rejected
|
14279 15041 | /// Test ID: RestJsonPathLongMalformedValueRejected_case4
|
14280 15042 | #[::tokio::test]
|
14281 15043 | #[::tracing_test::traced_test]
|
14282 15044 | async fn rest_json_path_long_malformed_value_rejected_case4_malformed_request() {
|
14283 15045 | {
|
14284 15046 | #[allow(unused_mut)]
|
14285 - | let mut http_request = http::Request::builder()
|
15047 + | let mut http_request = ::http_1x::Request::builder()
|
14286 15048 | .uri("/MalformedLong/Infinity")
|
14287 15049 | .method("POST")
|
14288 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15050 + | .body(::aws_smithy_http_server::body::boxed(
|
15051 + | ::http_body_util::Empty::new(),
|
15052 + | ))
|
14289 15053 | .unwrap();
|
14290 15054 | #[allow(unused_mut)]
|
14291 15055 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14292 15056 | let config = crate::service::RestJsonConfig::builder().build();
|
14293 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15057 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14294 15058 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14295 15059 | let sender = sender.clone();
|
14296 15060 | async move {
|
14297 15061 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14298 15062 | sender.send(()).await.expect("receiver dropped early");
|
14299 15063 | result
|
14300 15064 | }
|
14301 15065 | })
|
14302 15066 | .build_unchecked();
|
14303 15067 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14304 15068 | .await
|
14305 15069 | .expect("unable to make an HTTP request");
|
14306 15070 | ::pretty_assertions::assert_eq!(
|
14307 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15071 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14308 15072 | http_response.status()
|
14309 15073 | );
|
14310 15074 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14311 15075 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14312 15076 | http_response.headers(),
|
14313 15077 | expected_headers,
|
14314 15078 | ));
|
14315 15079 | }
|
14316 15080 | }
|
14317 15081 |
|
14318 15082 | /// Malformed values in the path should be rejected
|
14319 15083 | /// Test ID: RestJsonPathLongMalformedValueRejected_case5
|
14320 15084 | #[::tokio::test]
|
14321 15085 | #[::tracing_test::traced_test]
|
14322 15086 | async fn rest_json_path_long_malformed_value_rejected_case5_malformed_request() {
|
14323 15087 | {
|
14324 15088 | #[allow(unused_mut)]
|
14325 - | let mut http_request = http::Request::builder()
|
15089 + | let mut http_request = ::http_1x::Request::builder()
|
14326 15090 | .uri("/MalformedLong/-Infinity")
|
14327 15091 | .method("POST")
|
14328 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15092 + | .body(::aws_smithy_http_server::body::boxed(
|
15093 + | ::http_body_util::Empty::new(),
|
15094 + | ))
|
14329 15095 | .unwrap();
|
14330 15096 | #[allow(unused_mut)]
|
14331 15097 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14332 15098 | let config = crate::service::RestJsonConfig::builder().build();
|
14333 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15099 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14334 15100 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14335 15101 | let sender = sender.clone();
|
14336 15102 | async move {
|
14337 15103 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14338 15104 | sender.send(()).await.expect("receiver dropped early");
|
14339 15105 | result
|
14340 15106 | }
|
14341 15107 | })
|
14342 15108 | .build_unchecked();
|
14343 15109 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14344 15110 | .await
|
14345 15111 | .expect("unable to make an HTTP request");
|
14346 15112 | ::pretty_assertions::assert_eq!(
|
14347 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15113 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14348 15114 | http_response.status()
|
14349 15115 | );
|
14350 15116 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14351 15117 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14352 15118 | http_response.headers(),
|
14353 15119 | expected_headers,
|
14354 15120 | ));
|
14355 15121 | }
|
14356 15122 | }
|
14357 15123 |
|
14358 15124 | /// Malformed values in the path should be rejected
|
14359 15125 | /// Test ID: RestJsonPathLongMalformedValueRejected_case6
|
14360 15126 | #[::tokio::test]
|
14361 15127 | #[::tracing_test::traced_test]
|
14362 15128 | async fn rest_json_path_long_malformed_value_rejected_case6_malformed_request() {
|
14363 15129 | {
|
14364 15130 | #[allow(unused_mut)]
|
14365 - | let mut http_request = http::Request::builder()
|
15131 + | let mut http_request = ::http_1x::Request::builder()
|
14366 15132 | .uri("/MalformedLong/NaN")
|
14367 15133 | .method("POST")
|
14368 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15134 + | .body(::aws_smithy_http_server::body::boxed(
|
15135 + | ::http_body_util::Empty::new(),
|
15136 + | ))
|
14369 15137 | .unwrap();
|
14370 15138 | #[allow(unused_mut)]
|
14371 15139 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14372 15140 | let config = crate::service::RestJsonConfig::builder().build();
|
14373 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15141 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14374 15142 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14375 15143 | let sender = sender.clone();
|
14376 15144 | async move {
|
14377 15145 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14378 15146 | sender.send(()).await.expect("receiver dropped early");
|
14379 15147 | result
|
14380 15148 | }
|
14381 15149 | })
|
14382 15150 | .build_unchecked();
|
14383 15151 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14384 15152 | .await
|
14385 15153 | .expect("unable to make an HTTP request");
|
14386 15154 | ::pretty_assertions::assert_eq!(
|
14387 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15155 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14388 15156 | http_response.status()
|
14389 15157 | );
|
14390 15158 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14391 15159 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14392 15160 | http_response.headers(),
|
14393 15161 | expected_headers,
|
14394 15162 | ));
|
14395 15163 | }
|
14396 15164 | }
|
14397 15165 |
|
14398 15166 | /// Malformed values in query parameters should be rejected
|
14399 15167 | /// Test ID: RestJsonQueryLongMalformedValueRejected_case0
|
14400 15168 | #[::tokio::test]
|
14401 15169 | #[::tracing_test::traced_test]
|
14402 15170 | async fn rest_json_query_long_malformed_value_rejected_case0_malformed_request() {
|
14403 15171 | {
|
14404 15172 | #[allow(unused_mut)]
|
14405 - | let mut http_request = http::Request::builder()
|
15173 + | let mut http_request = ::http_1x::Request::builder()
|
14406 15174 | .uri("/MalformedLong/1")
|
14407 15175 | .method("POST")
|
14408 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15176 + | .body(::aws_smithy_http_server::body::boxed(
|
15177 + | ::http_body_util::Empty::new(),
|
15178 + | ))
|
14409 15179 | .unwrap();
|
14410 15180 | *http_request.uri_mut() = "/MalformedLong/1?longInQuery=true".parse().unwrap();
|
14411 15181 | #[allow(unused_mut)]
|
14412 15182 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14413 15183 | let config = crate::service::RestJsonConfig::builder().build();
|
14414 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15184 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14415 15185 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14416 15186 | let sender = sender.clone();
|
14417 15187 | async move {
|
14418 15188 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14419 15189 | sender.send(()).await.expect("receiver dropped early");
|
14420 15190 | result
|
14421 15191 | }
|
14422 15192 | })
|
14423 15193 | .build_unchecked();
|
14424 15194 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14425 15195 | .await
|
14426 15196 | .expect("unable to make an HTTP request");
|
14427 15197 | ::pretty_assertions::assert_eq!(
|
14428 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15198 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14429 15199 | http_response.status()
|
14430 15200 | );
|
14431 15201 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14432 15202 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14433 15203 | http_response.headers(),
|
14434 15204 | expected_headers,
|
14435 15205 | ));
|
14436 15206 | }
|
14437 15207 | }
|
14438 15208 |
|
14439 15209 | /// Malformed values in query parameters should be rejected
|
14440 15210 | /// Test ID: RestJsonQueryLongMalformedValueRejected_case1
|
14441 15211 | #[::tokio::test]
|
14442 15212 | #[::tracing_test::traced_test]
|
14443 15213 | async fn rest_json_query_long_malformed_value_rejected_case1_malformed_request() {
|
14444 15214 | {
|
14445 15215 | #[allow(unused_mut)]
|
14446 - | let mut http_request = http::Request::builder()
|
15216 + | let mut http_request = ::http_1x::Request::builder()
|
14447 15217 | .uri("/MalformedLong/1")
|
14448 15218 | .method("POST")
|
14449 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15219 + | .body(::aws_smithy_http_server::body::boxed(
|
15220 + | ::http_body_util::Empty::new(),
|
15221 + | ))
|
14450 15222 | .unwrap();
|
14451 15223 | *http_request.uri_mut() = "/MalformedLong/1?longInQuery=1.001".parse().unwrap();
|
14452 15224 | #[allow(unused_mut)]
|
14453 15225 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14454 15226 | let config = crate::service::RestJsonConfig::builder().build();
|
14455 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15227 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14456 15228 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14457 15229 | let sender = sender.clone();
|
14458 15230 | async move {
|
14459 15231 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14460 15232 | sender.send(()).await.expect("receiver dropped early");
|
14461 15233 | result
|
14462 15234 | }
|
14463 15235 | })
|
14464 15236 | .build_unchecked();
|
14465 15237 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14466 15238 | .await
|
14467 15239 | .expect("unable to make an HTTP request");
|
14468 15240 | ::pretty_assertions::assert_eq!(
|
14469 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15241 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14470 15242 | http_response.status()
|
14471 15243 | );
|
14472 15244 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14473 15245 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14474 15246 | http_response.headers(),
|
14475 15247 | expected_headers,
|
14476 15248 | ));
|
14477 15249 | }
|
14478 15250 | }
|
14479 15251 |
|
14480 15252 | /// Malformed values in query parameters should be rejected
|
14481 15253 | /// Test ID: RestJsonQueryLongMalformedValueRejected_case2
|
14482 15254 | #[::tokio::test]
|
14483 15255 | #[::tracing_test::traced_test]
|
14484 15256 | async fn rest_json_query_long_malformed_value_rejected_case2_malformed_request() {
|
14485 15257 | {
|
14486 15258 | #[allow(unused_mut)]
|
14487 - | let mut http_request = http::Request::builder()
|
15259 + | let mut http_request = ::http_1x::Request::builder()
|
14488 15260 | .uri("/MalformedLong/1")
|
14489 15261 | .method("POST")
|
14490 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15262 + | .body(::aws_smithy_http_server::body::boxed(
|
15263 + | ::http_body_util::Empty::new(),
|
15264 + | ))
|
14491 15265 | .unwrap();
|
14492 15266 | *http_request.uri_mut() = "/MalformedLong/1?longInQuery=2ABC".parse().unwrap();
|
14493 15267 | #[allow(unused_mut)]
|
14494 15268 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14495 15269 | let config = crate::service::RestJsonConfig::builder().build();
|
14496 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15270 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14497 15271 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14498 15272 | let sender = sender.clone();
|
14499 15273 | async move {
|
14500 15274 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14501 15275 | sender.send(()).await.expect("receiver dropped early");
|
14502 15276 | result
|
14503 15277 | }
|
14504 15278 | })
|
14505 15279 | .build_unchecked();
|
14506 15280 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14507 15281 | .await
|
14508 15282 | .expect("unable to make an HTTP request");
|
14509 15283 | ::pretty_assertions::assert_eq!(
|
14510 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15284 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14511 15285 | http_response.status()
|
14512 15286 | );
|
14513 15287 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14514 15288 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14515 15289 | http_response.headers(),
|
14516 15290 | expected_headers,
|
14517 15291 | ));
|
14518 15292 | }
|
14519 15293 | }
|
14520 15294 |
|
14521 15295 | /// Malformed values in query parameters should be rejected
|
14522 15296 | /// Test ID: RestJsonQueryLongMalformedValueRejected_case3
|
14523 15297 | #[::tokio::test]
|
14524 15298 | #[::tracing_test::traced_test]
|
14525 15299 | async fn rest_json_query_long_malformed_value_rejected_case3_malformed_request() {
|
14526 15300 | {
|
14527 15301 | #[allow(unused_mut)]
|
14528 - | let mut http_request = http::Request::builder()
|
15302 + | let mut http_request = ::http_1x::Request::builder()
|
14529 15303 | .uri("/MalformedLong/1")
|
14530 15304 | .method("POST")
|
14531 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15305 + | .body(::aws_smithy_http_server::body::boxed(
|
15306 + | ::http_body_util::Empty::new(),
|
15307 + | ))
|
14532 15308 | .unwrap();
|
14533 15309 | *http_request.uri_mut() = "/MalformedLong/1?longInQuery=0x42".parse().unwrap();
|
14534 15310 | #[allow(unused_mut)]
|
14535 15311 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14536 15312 | let config = crate::service::RestJsonConfig::builder().build();
|
14537 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15313 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14538 15314 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14539 15315 | let sender = sender.clone();
|
14540 15316 | async move {
|
14541 15317 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14542 15318 | sender.send(()).await.expect("receiver dropped early");
|
14543 15319 | result
|
14544 15320 | }
|
14545 15321 | })
|
14546 15322 | .build_unchecked();
|
14547 15323 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14548 15324 | .await
|
14549 15325 | .expect("unable to make an HTTP request");
|
14550 15326 | ::pretty_assertions::assert_eq!(
|
14551 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15327 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14552 15328 | http_response.status()
|
14553 15329 | );
|
14554 15330 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14555 15331 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14556 15332 | http_response.headers(),
|
14557 15333 | expected_headers,
|
14558 15334 | ));
|
14559 15335 | }
|
14560 15336 | }
|
14561 15337 |
|
14562 15338 | /// Malformed values in query parameters should be rejected
|
14563 15339 | /// Test ID: RestJsonQueryLongMalformedValueRejected_case4
|
14564 15340 | #[::tokio::test]
|
14565 15341 | #[::tracing_test::traced_test]
|
14566 15342 | async fn rest_json_query_long_malformed_value_rejected_case4_malformed_request() {
|
14567 15343 | {
|
14568 15344 | #[allow(unused_mut)]
|
14569 - | let mut http_request = http::Request::builder()
|
15345 + | let mut http_request = ::http_1x::Request::builder()
|
14570 15346 | .uri("/MalformedLong/1")
|
14571 15347 | .method("POST")
|
14572 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15348 + | .body(::aws_smithy_http_server::body::boxed(
|
15349 + | ::http_body_util::Empty::new(),
|
15350 + | ))
|
14573 15351 | .unwrap();
|
14574 15352 | *http_request.uri_mut() = "/MalformedLong/1?longInQuery=Infinity".parse().unwrap();
|
14575 15353 | #[allow(unused_mut)]
|
14576 15354 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14577 15355 | let config = crate::service::RestJsonConfig::builder().build();
|
14578 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15356 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14579 15357 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14580 15358 | let sender = sender.clone();
|
14581 15359 | async move {
|
14582 15360 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14583 15361 | sender.send(()).await.expect("receiver dropped early");
|
14584 15362 | result
|
14585 15363 | }
|
14586 15364 | })
|
14587 15365 | .build_unchecked();
|
14588 15366 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14589 15367 | .await
|
14590 15368 | .expect("unable to make an HTTP request");
|
14591 15369 | ::pretty_assertions::assert_eq!(
|
14592 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15370 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14593 15371 | http_response.status()
|
14594 15372 | );
|
14595 15373 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14596 15374 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14597 15375 | http_response.headers(),
|
14598 15376 | expected_headers,
|
14599 15377 | ));
|
14600 15378 | }
|
14601 15379 | }
|
14602 15380 |
|
14603 15381 | /// Malformed values in query parameters should be rejected
|
14604 15382 | /// Test ID: RestJsonQueryLongMalformedValueRejected_case5
|
14605 15383 | #[::tokio::test]
|
14606 15384 | #[::tracing_test::traced_test]
|
14607 15385 | async fn rest_json_query_long_malformed_value_rejected_case5_malformed_request() {
|
14608 15386 | {
|
14609 15387 | #[allow(unused_mut)]
|
14610 - | let mut http_request = http::Request::builder()
|
15388 + | let mut http_request = ::http_1x::Request::builder()
|
14611 15389 | .uri("/MalformedLong/1")
|
14612 15390 | .method("POST")
|
14613 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15391 + | .body(::aws_smithy_http_server::body::boxed(
|
15392 + | ::http_body_util::Empty::new(),
|
15393 + | ))
|
14614 15394 | .unwrap();
|
14615 15395 | *http_request.uri_mut() = "/MalformedLong/1?longInQuery=-Infinity".parse().unwrap();
|
14616 15396 | #[allow(unused_mut)]
|
14617 15397 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14618 15398 | let config = crate::service::RestJsonConfig::builder().build();
|
14619 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15399 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14620 15400 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14621 15401 | let sender = sender.clone();
|
14622 15402 | async move {
|
14623 15403 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14624 15404 | sender.send(()).await.expect("receiver dropped early");
|
14625 15405 | result
|
14626 15406 | }
|
14627 15407 | })
|
14628 15408 | .build_unchecked();
|
14629 15409 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14630 15410 | .await
|
14631 15411 | .expect("unable to make an HTTP request");
|
14632 15412 | ::pretty_assertions::assert_eq!(
|
14633 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15413 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14634 15414 | http_response.status()
|
14635 15415 | );
|
14636 15416 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14637 15417 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14638 15418 | http_response.headers(),
|
14639 15419 | expected_headers,
|
14640 15420 | ));
|
14641 15421 | }
|
14642 15422 | }
|
14643 15423 |
|
14644 15424 | /// Malformed values in query parameters should be rejected
|
14645 15425 | /// Test ID: RestJsonQueryLongMalformedValueRejected_case6
|
14646 15426 | #[::tokio::test]
|
14647 15427 | #[::tracing_test::traced_test]
|
14648 15428 | async fn rest_json_query_long_malformed_value_rejected_case6_malformed_request() {
|
14649 15429 | {
|
14650 15430 | #[allow(unused_mut)]
|
14651 - | let mut http_request = http::Request::builder()
|
15431 + | let mut http_request = ::http_1x::Request::builder()
|
14652 15432 | .uri("/MalformedLong/1")
|
14653 15433 | .method("POST")
|
14654 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15434 + | .body(::aws_smithy_http_server::body::boxed(
|
15435 + | ::http_body_util::Empty::new(),
|
15436 + | ))
|
14655 15437 | .unwrap();
|
14656 15438 | *http_request.uri_mut() = "/MalformedLong/1?longInQuery=NaN".parse().unwrap();
|
14657 15439 | #[allow(unused_mut)]
|
14658 15440 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14659 15441 | let config = crate::service::RestJsonConfig::builder().build();
|
14660 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15442 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14661 15443 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14662 15444 | let sender = sender.clone();
|
14663 15445 | async move {
|
14664 15446 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14665 15447 | sender.send(()).await.expect("receiver dropped early");
|
14666 15448 | result
|
14667 15449 | }
|
14668 15450 | })
|
14669 15451 | .build_unchecked();
|
14670 15452 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14671 15453 | .await
|
14672 15454 | .expect("unable to make an HTTP request");
|
14673 15455 | ::pretty_assertions::assert_eq!(
|
14674 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15456 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14675 15457 | http_response.status()
|
14676 15458 | );
|
14677 15459 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14678 15460 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14679 15461 | http_response.headers(),
|
14680 15462 | expected_headers,
|
14681 15463 | ));
|
14682 15464 | }
|
14683 15465 | }
|
14684 15466 |
|
14685 15467 | /// Malformed values in headers should be rejected
|
14686 15468 | /// Test ID: RestJsonHeaderLongMalformedValueRejected_case0
|
14687 15469 | #[::tokio::test]
|
14688 15470 | #[::tracing_test::traced_test]
|
14689 15471 | async fn rest_json_header_long_malformed_value_rejected_case0_malformed_request() {
|
14690 15472 | {
|
14691 15473 | #[allow(unused_mut)]
|
14692 - | let mut http_request = http::Request::builder()
|
15474 + | let mut http_request = ::http_1x::Request::builder()
|
14693 15475 | .uri("/MalformedLong/1")
|
14694 15476 | .method("POST")
|
14695 15477 | .header("longInHeader", "true")
|
14696 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15478 + | .body(::aws_smithy_http_server::body::boxed(
|
15479 + | ::http_body_util::Empty::new(),
|
15480 + | ))
|
14697 15481 | .unwrap();
|
14698 15482 | #[allow(unused_mut)]
|
14699 15483 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14700 15484 | let config = crate::service::RestJsonConfig::builder().build();
|
14701 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15485 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14702 15486 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14703 15487 | let sender = sender.clone();
|
14704 15488 | async move {
|
14705 15489 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14706 15490 | sender.send(()).await.expect("receiver dropped early");
|
14707 15491 | result
|
14708 15492 | }
|
14709 15493 | })
|
14710 15494 | .build_unchecked();
|
14711 15495 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14712 15496 | .await
|
14713 15497 | .expect("unable to make an HTTP request");
|
14714 15498 | ::pretty_assertions::assert_eq!(
|
14715 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15499 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14716 15500 | http_response.status()
|
14717 15501 | );
|
14718 15502 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14719 15503 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14720 15504 | http_response.headers(),
|
14721 15505 | expected_headers,
|
14722 15506 | ));
|
14723 15507 | }
|
14724 15508 | }
|
14725 15509 |
|
14726 15510 | /// Malformed values in headers should be rejected
|
14727 15511 | /// Test ID: RestJsonHeaderLongMalformedValueRejected_case1
|
14728 15512 | #[::tokio::test]
|
14729 15513 | #[::tracing_test::traced_test]
|
14730 15514 | async fn rest_json_header_long_malformed_value_rejected_case1_malformed_request() {
|
14731 15515 | {
|
14732 15516 | #[allow(unused_mut)]
|
14733 - | let mut http_request = http::Request::builder()
|
15517 + | let mut http_request = ::http_1x::Request::builder()
|
14734 15518 | .uri("/MalformedLong/1")
|
14735 15519 | .method("POST")
|
14736 15520 | .header("longInHeader", "1.001")
|
14737 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15521 + | .body(::aws_smithy_http_server::body::boxed(
|
15522 + | ::http_body_util::Empty::new(),
|
15523 + | ))
|
14738 15524 | .unwrap();
|
14739 15525 | #[allow(unused_mut)]
|
14740 15526 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14741 15527 | let config = crate::service::RestJsonConfig::builder().build();
|
14742 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15528 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14743 15529 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14744 15530 | let sender = sender.clone();
|
14745 15531 | async move {
|
14746 15532 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14747 15533 | sender.send(()).await.expect("receiver dropped early");
|
14748 15534 | result
|
14749 15535 | }
|
14750 15536 | })
|
14751 15537 | .build_unchecked();
|
14752 15538 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14753 15539 | .await
|
14754 15540 | .expect("unable to make an HTTP request");
|
14755 15541 | ::pretty_assertions::assert_eq!(
|
14756 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15542 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14757 15543 | http_response.status()
|
14758 15544 | );
|
14759 15545 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14760 15546 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14761 15547 | http_response.headers(),
|
14762 15548 | expected_headers,
|
14763 15549 | ));
|
14764 15550 | }
|
14765 15551 | }
|
14766 15552 |
|
14767 15553 | /// Malformed values in headers should be rejected
|
14768 15554 | /// Test ID: RestJsonHeaderLongMalformedValueRejected_case2
|
14769 15555 | #[::tokio::test]
|
14770 15556 | #[::tracing_test::traced_test]
|
14771 15557 | async fn rest_json_header_long_malformed_value_rejected_case2_malformed_request() {
|
14772 15558 | {
|
14773 15559 | #[allow(unused_mut)]
|
14774 - | let mut http_request = http::Request::builder()
|
15560 + | let mut http_request = ::http_1x::Request::builder()
|
14775 15561 | .uri("/MalformedLong/1")
|
14776 15562 | .method("POST")
|
14777 15563 | .header("longInHeader", "2ABC")
|
14778 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15564 + | .body(::aws_smithy_http_server::body::boxed(
|
15565 + | ::http_body_util::Empty::new(),
|
15566 + | ))
|
14779 15567 | .unwrap();
|
14780 15568 | #[allow(unused_mut)]
|
14781 15569 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14782 15570 | let config = crate::service::RestJsonConfig::builder().build();
|
14783 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15571 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14784 15572 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14785 15573 | let sender = sender.clone();
|
14786 15574 | async move {
|
14787 15575 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14788 15576 | sender.send(()).await.expect("receiver dropped early");
|
14789 15577 | result
|
14790 15578 | }
|
14791 15579 | })
|
14792 15580 | .build_unchecked();
|
14793 15581 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14794 15582 | .await
|
14795 15583 | .expect("unable to make an HTTP request");
|
14796 15584 | ::pretty_assertions::assert_eq!(
|
14797 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15585 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14798 15586 | http_response.status()
|
14799 15587 | );
|
14800 15588 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14801 15589 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14802 15590 | http_response.headers(),
|
14803 15591 | expected_headers,
|
14804 15592 | ));
|
14805 15593 | }
|
14806 15594 | }
|
14807 15595 |
|
14808 15596 | /// Malformed values in headers should be rejected
|
14809 15597 | /// Test ID: RestJsonHeaderLongMalformedValueRejected_case3
|
14810 15598 | #[::tokio::test]
|
14811 15599 | #[::tracing_test::traced_test]
|
14812 15600 | async fn rest_json_header_long_malformed_value_rejected_case3_malformed_request() {
|
14813 15601 | {
|
14814 15602 | #[allow(unused_mut)]
|
14815 - | let mut http_request = http::Request::builder()
|
15603 + | let mut http_request = ::http_1x::Request::builder()
|
14816 15604 | .uri("/MalformedLong/1")
|
14817 15605 | .method("POST")
|
14818 15606 | .header("longInHeader", "0x42")
|
14819 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15607 + | .body(::aws_smithy_http_server::body::boxed(
|
15608 + | ::http_body_util::Empty::new(),
|
15609 + | ))
|
14820 15610 | .unwrap();
|
14821 15611 | #[allow(unused_mut)]
|
14822 15612 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14823 15613 | let config = crate::service::RestJsonConfig::builder().build();
|
14824 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15614 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14825 15615 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14826 15616 | let sender = sender.clone();
|
14827 15617 | async move {
|
14828 15618 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14829 15619 | sender.send(()).await.expect("receiver dropped early");
|
14830 15620 | result
|
14831 15621 | }
|
14832 15622 | })
|
14833 15623 | .build_unchecked();
|
14834 15624 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14835 15625 | .await
|
14836 15626 | .expect("unable to make an HTTP request");
|
14837 15627 | ::pretty_assertions::assert_eq!(
|
14838 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15628 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14839 15629 | http_response.status()
|
14840 15630 | );
|
14841 15631 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14842 15632 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14843 15633 | http_response.headers(),
|
14844 15634 | expected_headers,
|
14845 15635 | ));
|
14846 15636 | }
|
14847 15637 | }
|
14848 15638 |
|
14849 15639 | /// Malformed values in headers should be rejected
|
14850 15640 | /// Test ID: RestJsonHeaderLongMalformedValueRejected_case4
|
14851 15641 | #[::tokio::test]
|
14852 15642 | #[::tracing_test::traced_test]
|
14853 15643 | async fn rest_json_header_long_malformed_value_rejected_case4_malformed_request() {
|
14854 15644 | {
|
14855 15645 | #[allow(unused_mut)]
|
14856 - | let mut http_request = http::Request::builder()
|
15646 + | let mut http_request = ::http_1x::Request::builder()
|
14857 15647 | .uri("/MalformedLong/1")
|
14858 15648 | .method("POST")
|
14859 15649 | .header("longInHeader", "Infinity")
|
14860 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15650 + | .body(::aws_smithy_http_server::body::boxed(
|
15651 + | ::http_body_util::Empty::new(),
|
15652 + | ))
|
14861 15653 | .unwrap();
|
14862 15654 | #[allow(unused_mut)]
|
14863 15655 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14864 15656 | let config = crate::service::RestJsonConfig::builder().build();
|
14865 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15657 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14866 15658 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14867 15659 | let sender = sender.clone();
|
14868 15660 | async move {
|
14869 15661 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14870 15662 | sender.send(()).await.expect("receiver dropped early");
|
14871 15663 | result
|
14872 15664 | }
|
14873 15665 | })
|
14874 15666 | .build_unchecked();
|
14875 15667 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14876 15668 | .await
|
14877 15669 | .expect("unable to make an HTTP request");
|
14878 15670 | ::pretty_assertions::assert_eq!(
|
14879 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15671 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14880 15672 | http_response.status()
|
14881 15673 | );
|
14882 15674 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14883 15675 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14884 15676 | http_response.headers(),
|
14885 15677 | expected_headers,
|
14886 15678 | ));
|
14887 15679 | }
|
14888 15680 | }
|
14889 15681 |
|
14890 15682 | /// Malformed values in headers should be rejected
|
14891 15683 | /// Test ID: RestJsonHeaderLongMalformedValueRejected_case5
|
14892 15684 | #[::tokio::test]
|
14893 15685 | #[::tracing_test::traced_test]
|
14894 15686 | async fn rest_json_header_long_malformed_value_rejected_case5_malformed_request() {
|
14895 15687 | {
|
14896 15688 | #[allow(unused_mut)]
|
14897 - | let mut http_request = http::Request::builder()
|
15689 + | let mut http_request = ::http_1x::Request::builder()
|
14898 15690 | .uri("/MalformedLong/1")
|
14899 15691 | .method("POST")
|
14900 15692 | .header("longInHeader", "-Infinity")
|
14901 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15693 + | .body(::aws_smithy_http_server::body::boxed(
|
15694 + | ::http_body_util::Empty::new(),
|
15695 + | ))
|
14902 15696 | .unwrap();
|
14903 15697 | #[allow(unused_mut)]
|
14904 15698 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14905 15699 | let config = crate::service::RestJsonConfig::builder().build();
|
14906 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15700 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14907 15701 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14908 15702 | let sender = sender.clone();
|
14909 15703 | async move {
|
14910 15704 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14911 15705 | sender.send(()).await.expect("receiver dropped early");
|
14912 15706 | result
|
14913 15707 | }
|
14914 15708 | })
|
14915 15709 | .build_unchecked();
|
14916 15710 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14917 15711 | .await
|
14918 15712 | .expect("unable to make an HTTP request");
|
14919 15713 | ::pretty_assertions::assert_eq!(
|
14920 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15714 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14921 15715 | http_response.status()
|
14922 15716 | );
|
14923 15717 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14924 15718 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14925 15719 | http_response.headers(),
|
14926 15720 | expected_headers,
|
14927 15721 | ));
|
14928 15722 | }
|
14929 15723 | }
|
14930 15724 |
|
14931 15725 | /// Malformed values in headers should be rejected
|
14932 15726 | /// Test ID: RestJsonHeaderLongMalformedValueRejected_case6
|
14933 15727 | #[::tokio::test]
|
14934 15728 | #[::tracing_test::traced_test]
|
14935 15729 | async fn rest_json_header_long_malformed_value_rejected_case6_malformed_request() {
|
14936 15730 | {
|
14937 15731 | #[allow(unused_mut)]
|
14938 - | let mut http_request = http::Request::builder()
|
15732 + | let mut http_request = ::http_1x::Request::builder()
|
14939 15733 | .uri("/MalformedLong/1")
|
14940 15734 | .method("POST")
|
14941 15735 | .header("longInHeader", "NaN")
|
14942 - | .body(::aws_smithy_http_server::body::Body::empty())
|
15736 + | .body(::aws_smithy_http_server::body::boxed(
|
15737 + | ::http_body_util::Empty::new(),
|
15738 + | ))
|
14943 15739 | .unwrap();
|
14944 15740 | #[allow(unused_mut)]
|
14945 15741 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
14946 15742 | let config = crate::service::RestJsonConfig::builder().build();
|
14947 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15743 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
14948 15744 | .malformed_long(move |input: crate::input::MalformedLongInput| {
|
14949 15745 | let sender = sender.clone();
|
14950 15746 | async move {
|
14951 15747 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedLongOutput, crate::error::MalformedLongError> };
|
14952 15748 | sender.send(()).await.expect("receiver dropped early");
|
14953 15749 | result
|
14954 15750 | }
|
14955 15751 | })
|
14956 15752 | .build_unchecked();
|
14957 15753 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
14958 15754 | .await
|
14959 15755 | .expect("unable to make an HTTP request");
|
14960 15756 | ::pretty_assertions::assert_eq!(
|
14961 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15757 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
14962 15758 | http_response.status()
|
14963 15759 | );
|
14964 15760 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
14965 15761 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
14966 15762 | http_response.headers(),
|
14967 15763 | expected_headers,
|
14968 15764 | ));
|
14969 15765 | }
|
14970 15766 | }
|
15767 + |
|
15768 + | /* ProtocolTestGenerator.kt:98 */
|
14971 15769 | }
|
14972 15770 |
|
15771 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
14973 15772 | ::pin_project_lite::pin_project! {
|
14974 15773 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
14975 15774 | /// [`MalformedShortInput`](crate::input::MalformedShortInput) using modelled bindings.
|
14976 15775 | pub struct MalformedShortInputFuture {
|
14977 15776 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedShortInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
14978 15777 | }
|
14979 15778 | }
|
14980 15779 |
|
14981 15780 | impl std::future::Future for MalformedShortInputFuture {
|
14982 15781 | type Output = Result<
|
14983 15782 | crate::input::MalformedShortInput,
|
14984 15783 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
14985 15784 | >;
|
14986 15785 |
|
14987 15786 | fn poll(
|
14988 15787 | self: std::pin::Pin<&mut Self>,
|
14989 15788 | cx: &mut std::task::Context<'_>,
|
14990 15789 | ) -> std::task::Poll<Self::Output> {
|
14991 15790 | let this = self.project();
|
14992 15791 | this.inner.as_mut().poll(cx)
|
14993 15792 | }
|
14994 15793 | }
|
14995 15794 |
|
14996 15795 | impl<B>
|
14997 15796 | ::aws_smithy_http_server::request::FromRequest<
|
14998 15797 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
14999 15798 | B,
|
15000 15799 | > for crate::input::MalformedShortInput
|
15001 15800 | where
|
15002 15801 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
15003 15802 | B: 'static,
|
15004 15803 |
|
15005 15804 | B::Data: Send,
|
15006 15805 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
15007 15806 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
15008 15807 | {
|
15009 15808 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
15010 15809 | type Future = MalformedShortInputFuture;
|
15011 15810 |
|
15012 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
15811 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
15013 15812 | let fut = async move {
|
15014 15813 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
15015 15814 | request.headers(),
|
15016 15815 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
15017 15816 | ) {
|
15018 15817 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
15019 15818 | }
|
15020 15819 | crate::protocol_serde::shape_malformed_short::de_malformed_short_http_request(request)
|
15021 15820 | .await
|
15022 15821 | };
|
15023 15822 | use ::futures_util::future::TryFutureExt;
|
15024 15823 | let fut = fut.map_err(
|
15025 15824 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
15026 15825 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
15027 15826 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
15028 15827 | e,
|
15029 15828 | )
|
15030 15829 | },
|
15031 15830 | );
|
15032 15831 | MalformedShortInputFuture {
|
15033 15832 | inner: Box::pin(fut),
|
15034 15833 | }
|
15035 15834 | }
|
15036 15835 | }
|
15836 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
15037 15837 | impl
|
15038 15838 | ::aws_smithy_http_server::response::IntoResponse<
|
15039 15839 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
15040 15840 | > for crate::output::MalformedShortOutput
|
15041 15841 | {
|
15042 15842 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
15043 15843 | match crate::protocol_serde::shape_malformed_short::ser_malformed_short_http_response(self)
|
15044 15844 | {
|
15045 15845 | Ok(response) => response,
|
15046 15846 | Err(e) => {
|
15047 15847 | ::tracing::error!(error = %e, "failed to serialize response");
|
15048 15848 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
15049 15849 | }
|
15050 15850 | }
|
15051 15851 | }
|
15052 15852 | }
|
15853 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
15053 15854 | impl
|
15054 15855 | ::aws_smithy_http_server::response::IntoResponse<
|
15055 15856 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
15056 15857 | > for crate::error::MalformedShortError
|
15057 15858 | {
|
15058 15859 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
15059 15860 | match crate::protocol_serde::shape_malformed_short::ser_malformed_short_http_error(&self) {
|
15060 15861 | Ok(mut response) => {
|
15061 15862 | response.extensions_mut().insert(
|
15062 15863 | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
15063 15864 | );
|
15064 15865 | response
|
15065 15866 | }
|
15066 15867 | Err(e) => {
|
15067 15868 | ::tracing::error!(error = %e, "failed to serialize response");
|
15068 15869 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
15069 15870 | }
|
15070 15871 | }
|
15071 15872 | }
|
15072 15873 | }
|
15073 15874 |
|
15875 + | /* RustType.kt:534 */
|
15074 15876 | #[allow(unreachable_code, unused_variables)]
|
15877 + | /* RustType.kt:534 */
|
15075 15878 | #[cfg(test)]
|
15879 + | /* ProtocolTestGenerator.kt:98 */
|
15076 15880 | mod malformed_short_test {
|
15077 15881 |
|
15078 15882 | /// Underflow or overflow should result in SerializationException
|
15079 15883 | /// Test ID: RestJsonBodyShortUnderflowOverflow_case0
|
15080 15884 | #[::tokio::test]
|
15081 15885 | #[::tracing_test::traced_test]
|
15082 15886 | async fn rest_json_body_short_underflow_overflow_case0_malformed_request() {
|
15083 15887 | {
|
15084 15888 | #[allow(unused_mut)]
|
15085 - | let mut http_request = http::Request::builder()
|
15889 + | let mut http_request = ::http_1x::Request::builder()
|
15086 15890 | .uri("/MalformedShort/1")
|
15087 15891 | .method("POST")
|
15088 15892 | .header("content-type", "application/json")
|
15089 - | .body(::aws_smithy_http_server::body::Body::from(
|
15090 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
15091 - | "{ \"shortInBody\" : 40000 }".as_bytes(),
|
15092 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
15893 + | .body(::aws_smithy_http_server::body::boxed(
|
15894 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
15895 + | &::aws_smithy_protocol_test::decode_body_data(
|
15896 + | "{ \"shortInBody\" : 40000 }".as_bytes(),
|
15897 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
15898 + | ),
|
15093 15899 | )),
|
15094 15900 | ))
|
15095 15901 | .unwrap();
|
15096 15902 | #[allow(unused_mut)]
|
15097 15903 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15098 15904 | let config = crate::service::RestJsonConfig::builder().build();
|
15099 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15905 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15100 15906 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15101 15907 | let sender = sender.clone();
|
15102 15908 | async move {
|
15103 15909 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15104 15910 | sender.send(()).await.expect("receiver dropped early");
|
15105 15911 | result
|
15106 15912 | }
|
15107 15913 | })
|
15108 15914 | .build_unchecked();
|
15109 15915 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15110 15916 | .await
|
15111 15917 | .expect("unable to make an HTTP request");
|
15112 15918 | ::pretty_assertions::assert_eq!(
|
15113 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15919 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15114 15920 | http_response.status()
|
15115 15921 | );
|
15116 15922 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15117 15923 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15118 15924 | http_response.headers(),
|
15119 15925 | expected_headers,
|
15120 15926 | ));
|
15121 15927 | }
|
15122 15928 | }
|
15123 15929 |
|
15124 15930 | /// Underflow or overflow should result in SerializationException
|
15125 15931 | /// Test ID: RestJsonBodyShortUnderflowOverflow_case1
|
15126 15932 | #[::tokio::test]
|
15127 15933 | #[::tracing_test::traced_test]
|
15128 15934 | async fn rest_json_body_short_underflow_overflow_case1_malformed_request() {
|
15129 15935 | {
|
15130 15936 | #[allow(unused_mut)]
|
15131 - | let mut http_request = http::Request::builder()
|
15937 + | let mut http_request = ::http_1x::Request::builder()
|
15132 15938 | .uri("/MalformedShort/1")
|
15133 15939 | .method("POST")
|
15134 15940 | .header("content-type", "application/json")
|
15135 - | .body(::aws_smithy_http_server::body::Body::from(
|
15136 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
15137 - | "{ \"shortInBody\" : -40000 }".as_bytes(),
|
15138 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
15941 + | .body(::aws_smithy_http_server::body::boxed(
|
15942 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
15943 + | &::aws_smithy_protocol_test::decode_body_data(
|
15944 + | "{ \"shortInBody\" : -40000 }".as_bytes(),
|
15945 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
15946 + | ),
|
15139 15947 | )),
|
15140 15948 | ))
|
15141 15949 | .unwrap();
|
15142 15950 | #[allow(unused_mut)]
|
15143 15951 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15144 15952 | let config = crate::service::RestJsonConfig::builder().build();
|
15145 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
15953 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15146 15954 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15147 15955 | let sender = sender.clone();
|
15148 15956 | async move {
|
15149 15957 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15150 15958 | sender.send(()).await.expect("receiver dropped early");
|
15151 15959 | result
|
15152 15960 | }
|
15153 15961 | })
|
15154 15962 | .build_unchecked();
|
15155 15963 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15156 15964 | .await
|
15157 15965 | .expect("unable to make an HTTP request");
|
15158 15966 | ::pretty_assertions::assert_eq!(
|
15159 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15967 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15160 15968 | http_response.status()
|
15161 15969 | );
|
15162 15970 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15163 15971 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15164 15972 | http_response.headers(),
|
15165 15973 | expected_headers,
|
15166 15974 | ));
|
15167 15975 | }
|
15168 15976 | }
|
15169 15977 |
|
15170 15978 | /// Underflow or overflow should result in SerializationException
|
15171 15979 | /// Test ID: RestJsonBodyShortUnderflowOverflow_case2
|
15172 15980 | #[::tokio::test]
|
15173 15981 | #[::tracing_test::traced_test]
|
15174 15982 | async fn rest_json_body_short_underflow_overflow_case2_malformed_request() {
|
15175 15983 | {
|
15176 15984 | #[allow(unused_mut)]
|
15177 - | let mut http_request = http::Request::builder()
|
15985 + | let mut http_request = ::http_1x::Request::builder()
|
15178 15986 | .uri("/MalformedShort/1")
|
15179 15987 | .method("POST")
|
15180 15988 | .header("content-type", "application/json")
|
15181 - | .body(::aws_smithy_http_server::body::Body::from(
|
15182 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
15183 - | "{ \"shortInBody\" : -9223372000000000000 }".as_bytes(),
|
15184 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
15989 + | .body(::aws_smithy_http_server::body::boxed(
|
15990 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
15991 + | &::aws_smithy_protocol_test::decode_body_data(
|
15992 + | "{ \"shortInBody\" : -9223372000000000000 }".as_bytes(),
|
15993 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
15994 + | ),
|
15185 15995 | )),
|
15186 15996 | ))
|
15187 15997 | .unwrap();
|
15188 15998 | #[allow(unused_mut)]
|
15189 15999 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15190 16000 | let config = crate::service::RestJsonConfig::builder().build();
|
15191 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16001 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15192 16002 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15193 16003 | let sender = sender.clone();
|
15194 16004 | async move {
|
15195 16005 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15196 16006 | sender.send(()).await.expect("receiver dropped early");
|
15197 16007 | result
|
15198 16008 | }
|
15199 16009 | })
|
15200 16010 | .build_unchecked();
|
15201 16011 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15202 16012 | .await
|
15203 16013 | .expect("unable to make an HTTP request");
|
15204 16014 | ::pretty_assertions::assert_eq!(
|
15205 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16015 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15206 16016 | http_response.status()
|
15207 16017 | );
|
15208 16018 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15209 16019 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15210 16020 | http_response.headers(),
|
15211 16021 | expected_headers,
|
15212 16022 | ));
|
15213 16023 | }
|
15214 16024 | }
|
15215 16025 |
|
15216 16026 | /// Underflow or overflow should result in SerializationException
|
15217 16027 | /// Test ID: RestJsonBodyShortUnderflowOverflow_case3
|
15218 16028 | #[::tokio::test]
|
15219 16029 | #[::tracing_test::traced_test]
|
15220 16030 | async fn rest_json_body_short_underflow_overflow_case3_malformed_request() {
|
15221 16031 | {
|
15222 16032 | #[allow(unused_mut)]
|
15223 - | let mut http_request = http::Request::builder()
|
16033 + | let mut http_request = ::http_1x::Request::builder()
|
15224 16034 | .uri("/MalformedShort/1")
|
15225 16035 | .method("POST")
|
15226 16036 | .header("content-type", "application/json")
|
15227 - | .body(::aws_smithy_http_server::body::Body::from(
|
15228 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
15229 - | "{ \"shortInBody\" : 9223372000000000000 }".as_bytes(),
|
15230 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
16037 + | .body(::aws_smithy_http_server::body::boxed(
|
16038 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
16039 + | &::aws_smithy_protocol_test::decode_body_data(
|
16040 + | "{ \"shortInBody\" : 9223372000000000000 }".as_bytes(),
|
16041 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
16042 + | ),
|
15231 16043 | )),
|
15232 16044 | ))
|
15233 16045 | .unwrap();
|
15234 16046 | #[allow(unused_mut)]
|
15235 16047 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15236 16048 | let config = crate::service::RestJsonConfig::builder().build();
|
15237 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16049 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15238 16050 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15239 16051 | let sender = sender.clone();
|
15240 16052 | async move {
|
15241 16053 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15242 16054 | sender.send(()).await.expect("receiver dropped early");
|
15243 16055 | result
|
15244 16056 | }
|
15245 16057 | })
|
15246 16058 | .build_unchecked();
|
15247 16059 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15248 16060 | .await
|
15249 16061 | .expect("unable to make an HTTP request");
|
15250 16062 | ::pretty_assertions::assert_eq!(
|
15251 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16063 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15252 16064 | http_response.status()
|
15253 16065 | );
|
15254 16066 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15255 16067 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15256 16068 | http_response.headers(),
|
15257 16069 | expected_headers,
|
15258 16070 | ));
|
15259 16071 | }
|
15260 16072 | }
|
15261 16073 |
|
15262 16074 | /// Underflow or overflow should result in SerializationException
|
15263 16075 | /// Test ID: RestJsonBodyShortUnderflowOverflow_case4
|
15264 16076 | #[::tokio::test]
|
15265 16077 | #[::tracing_test::traced_test]
|
15266 16078 | async fn rest_json_body_short_underflow_overflow_case4_malformed_request() {
|
15267 16079 | {
|
15268 16080 | #[allow(unused_mut)]
|
15269 - | let mut http_request = http::Request::builder()
|
16081 + | let mut http_request = ::http_1x::Request::builder()
|
15270 16082 | .uri("/MalformedShort/1")
|
15271 16083 | .method("POST")
|
15272 16084 | .header("content-type", "application/json")
|
15273 - | .body(::aws_smithy_http_server::body::Body::from(
|
15274 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
15275 - | "{ \"shortInBody\" : 123000000000000000000000 }".as_bytes(),
|
15276 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
16085 + | .body(::aws_smithy_http_server::body::boxed(
|
16086 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
16087 + | &::aws_smithy_protocol_test::decode_body_data(
|
16088 + | "{ \"shortInBody\" : 123000000000000000000000 }".as_bytes(),
|
16089 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
16090 + | ),
|
15277 16091 | )),
|
15278 16092 | ))
|
15279 16093 | .unwrap();
|
15280 16094 | #[allow(unused_mut)]
|
15281 16095 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15282 16096 | let config = crate::service::RestJsonConfig::builder().build();
|
15283 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16097 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15284 16098 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15285 16099 | let sender = sender.clone();
|
15286 16100 | async move {
|
15287 16101 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15288 16102 | sender.send(()).await.expect("receiver dropped early");
|
15289 16103 | result
|
15290 16104 | }
|
15291 16105 | })
|
15292 16106 | .build_unchecked();
|
15293 16107 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15294 16108 | .await
|
15295 16109 | .expect("unable to make an HTTP request");
|
15296 16110 | ::pretty_assertions::assert_eq!(
|
15297 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16111 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15298 16112 | http_response.status()
|
15299 16113 | );
|
15300 16114 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15301 16115 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15302 16116 | http_response.headers(),
|
15303 16117 | expected_headers,
|
15304 16118 | ));
|
15305 16119 | }
|
15306 16120 | }
|
15307 16121 |
|
15308 16122 | /// Underflow or overflow should result in SerializationException
|
15309 16123 | /// Test ID: RestJsonPathShortUnderflowOverflow_case0
|
15310 16124 | #[::tokio::test]
|
15311 16125 | #[::tracing_test::traced_test]
|
15312 16126 | async fn rest_json_path_short_underflow_overflow_case0_malformed_request() {
|
15313 16127 | {
|
15314 16128 | #[allow(unused_mut)]
|
15315 - | let mut http_request = http::Request::builder()
|
16129 + | let mut http_request = ::http_1x::Request::builder()
|
15316 16130 | .uri("/MalformedShort/40000")
|
15317 16131 | .method("POST")
|
15318 - | .body(::aws_smithy_http_server::body::Body::empty())
|
16132 + | .body(::aws_smithy_http_server::body::boxed(
|
16133 + | ::http_body_util::Empty::new(),
|
16134 + | ))
|
15319 16135 | .unwrap();
|
15320 16136 | #[allow(unused_mut)]
|
15321 16137 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15322 16138 | let config = crate::service::RestJsonConfig::builder().build();
|
15323 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16139 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15324 16140 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15325 16141 | let sender = sender.clone();
|
15326 16142 | async move {
|
15327 16143 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15328 16144 | sender.send(()).await.expect("receiver dropped early");
|
15329 16145 | result
|
15330 16146 | }
|
15331 16147 | })
|
15332 16148 | .build_unchecked();
|
15333 16149 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15334 16150 | .await
|
15335 16151 | .expect("unable to make an HTTP request");
|
15336 16152 | ::pretty_assertions::assert_eq!(
|
15337 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16153 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15338 16154 | http_response.status()
|
15339 16155 | );
|
15340 16156 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15341 16157 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15342 16158 | http_response.headers(),
|
15343 16159 | expected_headers,
|
15344 16160 | ));
|
15345 16161 | }
|
15346 16162 | }
|
15347 16163 |
|
15348 16164 | /// Underflow or overflow should result in SerializationException
|
15349 16165 | /// Test ID: RestJsonPathShortUnderflowOverflow_case1
|
15350 16166 | #[::tokio::test]
|
15351 16167 | #[::tracing_test::traced_test]
|
15352 16168 | async fn rest_json_path_short_underflow_overflow_case1_malformed_request() {
|
15353 16169 | {
|
15354 16170 | #[allow(unused_mut)]
|
15355 - | let mut http_request = http::Request::builder()
|
16171 + | let mut http_request = ::http_1x::Request::builder()
|
15356 16172 | .uri("/MalformedShort/-40000")
|
15357 16173 | .method("POST")
|
15358 - | .body(::aws_smithy_http_server::body::Body::empty())
|
16174 + | .body(::aws_smithy_http_server::body::boxed(
|
16175 + | ::http_body_util::Empty::new(),
|
16176 + | ))
|
15359 16177 | .unwrap();
|
15360 16178 | #[allow(unused_mut)]
|
15361 16179 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15362 16180 | let config = crate::service::RestJsonConfig::builder().build();
|
15363 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16181 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15364 16182 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15365 16183 | let sender = sender.clone();
|
15366 16184 | async move {
|
15367 16185 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15368 16186 | sender.send(()).await.expect("receiver dropped early");
|
15369 16187 | result
|
15370 16188 | }
|
15371 16189 | })
|
15372 16190 | .build_unchecked();
|
15373 16191 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15374 16192 | .await
|
15375 16193 | .expect("unable to make an HTTP request");
|
15376 16194 | ::pretty_assertions::assert_eq!(
|
15377 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16195 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15378 16196 | http_response.status()
|
15379 16197 | );
|
15380 16198 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15381 16199 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15382 16200 | http_response.headers(),
|
15383 16201 | expected_headers,
|
15384 16202 | ));
|
15385 16203 | }
|
15386 16204 | }
|
15387 16205 |
|
15388 16206 | /// Underflow or overflow should result in SerializationException
|
15389 16207 | /// Test ID: RestJsonPathShortUnderflowOverflow_case2
|
15390 16208 | #[::tokio::test]
|
15391 16209 | #[::tracing_test::traced_test]
|
15392 16210 | async fn rest_json_path_short_underflow_overflow_case2_malformed_request() {
|
15393 16211 | {
|
15394 16212 | #[allow(unused_mut)]
|
15395 - | let mut http_request = http::Request::builder()
|
16213 + | let mut http_request = ::http_1x::Request::builder()
|
15396 16214 | .uri("/MalformedShort/-9223372000000000000")
|
15397 16215 | .method("POST")
|
15398 - | .body(::aws_smithy_http_server::body::Body::empty())
|
16216 + | .body(::aws_smithy_http_server::body::boxed(
|
16217 + | ::http_body_util::Empty::new(),
|
16218 + | ))
|
15399 16219 | .unwrap();
|
15400 16220 | #[allow(unused_mut)]
|
15401 16221 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15402 16222 | let config = crate::service::RestJsonConfig::builder().build();
|
15403 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16223 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15404 16224 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15405 16225 | let sender = sender.clone();
|
15406 16226 | async move {
|
15407 16227 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15408 16228 | sender.send(()).await.expect("receiver dropped early");
|
15409 16229 | result
|
15410 16230 | }
|
15411 16231 | })
|
15412 16232 | .build_unchecked();
|
15413 16233 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15414 16234 | .await
|
15415 16235 | .expect("unable to make an HTTP request");
|
15416 16236 | ::pretty_assertions::assert_eq!(
|
15417 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16237 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15418 16238 | http_response.status()
|
15419 16239 | );
|
15420 16240 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15421 16241 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15422 16242 | http_response.headers(),
|
15423 16243 | expected_headers,
|
15424 16244 | ));
|
15425 16245 | }
|
15426 16246 | }
|
15427 16247 |
|
15428 16248 | /// Underflow or overflow should result in SerializationException
|
15429 16249 | /// Test ID: RestJsonPathShortUnderflowOverflow_case3
|
15430 16250 | #[::tokio::test]
|
15431 16251 | #[::tracing_test::traced_test]
|
15432 16252 | async fn rest_json_path_short_underflow_overflow_case3_malformed_request() {
|
15433 16253 | {
|
15434 16254 | #[allow(unused_mut)]
|
15435 - | let mut http_request = http::Request::builder()
|
16255 + | let mut http_request = ::http_1x::Request::builder()
|
15436 16256 | .uri("/MalformedShort/9223372000000000000")
|
15437 16257 | .method("POST")
|
15438 - | .body(::aws_smithy_http_server::body::Body::empty())
|
16258 + | .body(::aws_smithy_http_server::body::boxed(
|
16259 + | ::http_body_util::Empty::new(),
|
16260 + | ))
|
15439 16261 | .unwrap();
|
15440 16262 | #[allow(unused_mut)]
|
15441 16263 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15442 16264 | let config = crate::service::RestJsonConfig::builder().build();
|
15443 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16265 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15444 16266 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15445 16267 | let sender = sender.clone();
|
15446 16268 | async move {
|
15447 16269 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15448 16270 | sender.send(()).await.expect("receiver dropped early");
|
15449 16271 | result
|
15450 16272 | }
|
15451 16273 | })
|
15452 16274 | .build_unchecked();
|
15453 16275 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15454 16276 | .await
|
15455 16277 | .expect("unable to make an HTTP request");
|
15456 16278 | ::pretty_assertions::assert_eq!(
|
15457 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16279 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15458 16280 | http_response.status()
|
15459 16281 | );
|
15460 16282 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15461 16283 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15462 16284 | http_response.headers(),
|
15463 16285 | expected_headers,
|
15464 16286 | ));
|
15465 16287 | }
|
15466 16288 | }
|
15467 16289 |
|
15468 16290 | /// Underflow or overflow should result in SerializationException
|
15469 16291 | /// Test ID: RestJsonPathShortUnderflowOverflow_case4
|
15470 16292 | #[::tokio::test]
|
15471 16293 | #[::tracing_test::traced_test]
|
15472 16294 | async fn rest_json_path_short_underflow_overflow_case4_malformed_request() {
|
15473 16295 | {
|
15474 16296 | #[allow(unused_mut)]
|
15475 - | let mut http_request = http::Request::builder()
|
16297 + | let mut http_request = ::http_1x::Request::builder()
|
15476 16298 | .uri("/MalformedShort/123000000000000000000000")
|
15477 16299 | .method("POST")
|
15478 - | .body(::aws_smithy_http_server::body::Body::empty())
|
16300 + | .body(::aws_smithy_http_server::body::boxed(
|
16301 + | ::http_body_util::Empty::new(),
|
16302 + | ))
|
15479 16303 | .unwrap();
|
15480 16304 | #[allow(unused_mut)]
|
15481 16305 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15482 16306 | let config = crate::service::RestJsonConfig::builder().build();
|
15483 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16307 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15484 16308 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15485 16309 | let sender = sender.clone();
|
15486 16310 | async move {
|
15487 16311 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15488 16312 | sender.send(()).await.expect("receiver dropped early");
|
15489 16313 | result
|
15490 16314 | }
|
15491 16315 | })
|
15492 16316 | .build_unchecked();
|
15493 16317 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15494 16318 | .await
|
15495 16319 | .expect("unable to make an HTTP request");
|
15496 16320 | ::pretty_assertions::assert_eq!(
|
15497 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16321 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15498 16322 | http_response.status()
|
15499 16323 | );
|
15500 16324 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15501 16325 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15502 16326 | http_response.headers(),
|
15503 16327 | expected_headers,
|
15504 16328 | ));
|
15505 16329 | }
|
15506 16330 | }
|
15507 16331 |
|
15508 16332 | /// Underflow or overflow should result in SerializationException
|
15509 16333 | /// Test ID: RestJsonQueryShortUnderflowOverflow_case0
|
15510 16334 | #[::tokio::test]
|
15511 16335 | #[::tracing_test::traced_test]
|
15512 16336 | async fn rest_json_query_short_underflow_overflow_case0_malformed_request() {
|
15513 16337 | {
|
15514 16338 | #[allow(unused_mut)]
|
15515 - | let mut http_request = http::Request::builder()
|
16339 + | let mut http_request = ::http_1x::Request::builder()
|
15516 16340 | .uri("/MalformedShort/1")
|
15517 16341 | .method("POST")
|
15518 - | .body(::aws_smithy_http_server::body::Body::empty())
|
16342 + | .body(::aws_smithy_http_server::body::boxed(
|
16343 + | ::http_body_util::Empty::new(),
|
16344 + | ))
|
15519 16345 | .unwrap();
|
15520 16346 | *http_request.uri_mut() = "/MalformedShort/1?shortInQuery=40000".parse().unwrap();
|
15521 16347 | #[allow(unused_mut)]
|
15522 16348 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15523 16349 | let config = crate::service::RestJsonConfig::builder().build();
|
15524 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16350 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15525 16351 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15526 16352 | let sender = sender.clone();
|
15527 16353 | async move {
|
15528 16354 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15529 16355 | sender.send(()).await.expect("receiver dropped early");
|
15530 16356 | result
|
15531 16357 | }
|
15532 16358 | })
|
15533 16359 | .build_unchecked();
|
15534 16360 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15535 16361 | .await
|
15536 16362 | .expect("unable to make an HTTP request");
|
15537 16363 | ::pretty_assertions::assert_eq!(
|
15538 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16364 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15539 16365 | http_response.status()
|
15540 16366 | );
|
15541 16367 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15542 16368 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15543 16369 | http_response.headers(),
|
15544 16370 | expected_headers,
|
15545 16371 | ));
|
15546 16372 | }
|
15547 16373 | }
|
15548 16374 |
|
15549 16375 | /// Underflow or overflow should result in SerializationException
|
15550 16376 | /// Test ID: RestJsonQueryShortUnderflowOverflow_case1
|
15551 16377 | #[::tokio::test]
|
15552 16378 | #[::tracing_test::traced_test]
|
15553 16379 | async fn rest_json_query_short_underflow_overflow_case1_malformed_request() {
|
15554 16380 | {
|
15555 16381 | #[allow(unused_mut)]
|
15556 - | let mut http_request = http::Request::builder()
|
16382 + | let mut http_request = ::http_1x::Request::builder()
|
15557 16383 | .uri("/MalformedShort/1")
|
15558 16384 | .method("POST")
|
15559 - | .body(::aws_smithy_http_server::body::Body::empty())
|
16385 + | .body(::aws_smithy_http_server::body::boxed(
|
16386 + | ::http_body_util::Empty::new(),
|
16387 + | ))
|
15560 16388 | .unwrap();
|
15561 16389 | *http_request.uri_mut() = "/MalformedShort/1?shortInQuery=-40000".parse().unwrap();
|
15562 16390 | #[allow(unused_mut)]
|
15563 16391 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15564 16392 | let config = crate::service::RestJsonConfig::builder().build();
|
15565 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16393 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15566 16394 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15567 16395 | let sender = sender.clone();
|
15568 16396 | async move {
|
15569 16397 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15570 16398 | sender.send(()).await.expect("receiver dropped early");
|
15571 16399 | result
|
15572 16400 | }
|
15573 16401 | })
|
15574 16402 | .build_unchecked();
|
15575 16403 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15576 16404 | .await
|
15577 16405 | .expect("unable to make an HTTP request");
|
15578 16406 | ::pretty_assertions::assert_eq!(
|
15579 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16407 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15580 16408 | http_response.status()
|
15581 16409 | );
|
15582 16410 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15583 16411 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15584 16412 | http_response.headers(),
|
15585 16413 | expected_headers,
|
15586 16414 | ));
|
15587 16415 | }
|
15588 16416 | }
|
15589 16417 |
|
15590 16418 | /// Underflow or overflow should result in SerializationException
|
15591 16419 | /// Test ID: RestJsonQueryShortUnderflowOverflow_case2
|
15592 16420 | #[::tokio::test]
|
15593 16421 | #[::tracing_test::traced_test]
|
15594 16422 | async fn rest_json_query_short_underflow_overflow_case2_malformed_request() {
|
15595 16423 | {
|
15596 16424 | #[allow(unused_mut)]
|
15597 - | let mut http_request = http::Request::builder()
|
16425 + | let mut http_request = ::http_1x::Request::builder()
|
15598 16426 | .uri("/MalformedShort/1")
|
15599 16427 | .method("POST")
|
15600 - | .body(::aws_smithy_http_server::body::Body::empty())
|
16428 + | .body(::aws_smithy_http_server::body::boxed(
|
16429 + | ::http_body_util::Empty::new(),
|
16430 + | ))
|
15601 16431 | .unwrap();
|
15602 16432 | *http_request.uri_mut() = "/MalformedShort/1?shortInQuery=-9223372000000000000"
|
15603 16433 | .parse()
|
15604 16434 | .unwrap();
|
15605 16435 | #[allow(unused_mut)]
|
15606 16436 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15607 16437 | let config = crate::service::RestJsonConfig::builder().build();
|
15608 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16438 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15609 16439 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15610 16440 | let sender = sender.clone();
|
15611 16441 | async move {
|
15612 16442 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15613 16443 | sender.send(()).await.expect("receiver dropped early");
|
15614 16444 | result
|
15615 16445 | }
|
15616 16446 | })
|
15617 16447 | .build_unchecked();
|
15618 16448 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15619 16449 | .await
|
15620 16450 | .expect("unable to make an HTTP request");
|
15621 16451 | ::pretty_assertions::assert_eq!(
|
15622 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16452 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15623 16453 | http_response.status()
|
15624 16454 | );
|
15625 16455 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15626 16456 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15627 16457 | http_response.headers(),
|
15628 16458 | expected_headers,
|
15629 16459 | ));
|
15630 16460 | }
|
15631 16461 | }
|
15632 16462 |
|
15633 16463 | /// Underflow or overflow should result in SerializationException
|
15634 16464 | /// Test ID: RestJsonQueryShortUnderflowOverflow_case3
|
15635 16465 | #[::tokio::test]
|
15636 16466 | #[::tracing_test::traced_test]
|
15637 16467 | async fn rest_json_query_short_underflow_overflow_case3_malformed_request() {
|
15638 16468 | {
|
15639 16469 | #[allow(unused_mut)]
|
15640 - | let mut http_request = http::Request::builder()
|
16470 + | let mut http_request = ::http_1x::Request::builder()
|
15641 16471 | .uri("/MalformedShort/1")
|
15642 16472 | .method("POST")
|
15643 - | .body(::aws_smithy_http_server::body::Body::empty())
|
16473 + | .body(::aws_smithy_http_server::body::boxed(
|
16474 + | ::http_body_util::Empty::new(),
|
16475 + | ))
|
15644 16476 | .unwrap();
|
15645 16477 | *http_request.uri_mut() = "/MalformedShort/1?shortInQuery=9223372000000000000"
|
15646 16478 | .parse()
|
15647 16479 | .unwrap();
|
15648 16480 | #[allow(unused_mut)]
|
15649 16481 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15650 16482 | let config = crate::service::RestJsonConfig::builder().build();
|
15651 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16483 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15652 16484 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15653 16485 | let sender = sender.clone();
|
15654 16486 | async move {
|
15655 16487 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15656 16488 | sender.send(()).await.expect("receiver dropped early");
|
15657 16489 | result
|
15658 16490 | }
|
15659 16491 | })
|
15660 16492 | .build_unchecked();
|
15661 16493 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15662 16494 | .await
|
15663 16495 | .expect("unable to make an HTTP request");
|
15664 16496 | ::pretty_assertions::assert_eq!(
|
15665 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16497 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15666 16498 | http_response.status()
|
15667 16499 | );
|
15668 16500 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15669 16501 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15670 16502 | http_response.headers(),
|
15671 16503 | expected_headers,
|
15672 16504 | ));
|
15673 16505 | }
|
15674 16506 | }
|
15675 16507 |
|
15676 16508 | /// Underflow or overflow should result in SerializationException
|
15677 16509 | /// Test ID: RestJsonQueryShortUnderflowOverflow_case4
|
15678 16510 | #[::tokio::test]
|
15679 16511 | #[::tracing_test::traced_test]
|
15680 16512 | async fn rest_json_query_short_underflow_overflow_case4_malformed_request() {
|
15681 16513 | {
|
15682 16514 | #[allow(unused_mut)]
|
15683 - | let mut http_request = http::Request::builder()
|
16515 + | let mut http_request = ::http_1x::Request::builder()
|
15684 16516 | .uri("/MalformedShort/1")
|
15685 16517 | .method("POST")
|
15686 - | .body(::aws_smithy_http_server::body::Body::empty())
|
16518 + | .body(::aws_smithy_http_server::body::boxed(
|
16519 + | ::http_body_util::Empty::new(),
|
16520 + | ))
|
15687 16521 | .unwrap();
|
15688 16522 | *http_request.uri_mut() = "/MalformedShort/1?shortInQuery=123000000000000000000000"
|
15689 16523 | .parse()
|
15690 16524 | .unwrap();
|
15691 16525 | #[allow(unused_mut)]
|
15692 16526 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15693 16527 | let config = crate::service::RestJsonConfig::builder().build();
|
15694 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16528 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15695 16529 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15696 16530 | let sender = sender.clone();
|
15697 16531 | async move {
|
15698 16532 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15699 16533 | sender.send(()).await.expect("receiver dropped early");
|
15700 16534 | result
|
15701 16535 | }
|
15702 16536 | })
|
15703 16537 | .build_unchecked();
|
15704 16538 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15705 16539 | .await
|
15706 16540 | .expect("unable to make an HTTP request");
|
15707 16541 | ::pretty_assertions::assert_eq!(
|
15708 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16542 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15709 16543 | http_response.status()
|
15710 16544 | );
|
15711 16545 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15712 16546 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15713 16547 | http_response.headers(),
|
15714 16548 | expected_headers,
|
15715 16549 | ));
|
15716 16550 | }
|
15717 16551 | }
|
15718 16552 |
|
15719 16553 | /// Underflow or overflow should result in SerializationException
|
15720 16554 | /// Test ID: RestJsonHeaderShortUnderflowOverflow_case0
|
15721 16555 | #[::tokio::test]
|
15722 16556 | #[::tracing_test::traced_test]
|
15723 16557 | async fn rest_json_header_short_underflow_overflow_case0_malformed_request() {
|
15724 16558 | {
|
15725 16559 | #[allow(unused_mut)]
|
15726 - | let mut http_request = http::Request::builder()
|
16560 + | let mut http_request = ::http_1x::Request::builder()
|
15727 16561 | .uri("/MalformedShort/1")
|
15728 16562 | .method("POST")
|
15729 16563 | .header("shortInHeader", "40000")
|
15730 - | .body(::aws_smithy_http_server::body::Body::empty())
|
16564 + | .body(::aws_smithy_http_server::body::boxed(
|
16565 + | ::http_body_util::Empty::new(),
|
16566 + | ))
|
15731 16567 | .unwrap();
|
15732 16568 | #[allow(unused_mut)]
|
15733 16569 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15734 16570 | let config = crate::service::RestJsonConfig::builder().build();
|
15735 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16571 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15736 16572 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15737 16573 | let sender = sender.clone();
|
15738 16574 | async move {
|
15739 16575 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15740 16576 | sender.send(()).await.expect("receiver dropped early");
|
15741 16577 | result
|
15742 16578 | }
|
15743 16579 | })
|
15744 16580 | .build_unchecked();
|
15745 16581 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15746 16582 | .await
|
15747 16583 | .expect("unable to make an HTTP request");
|
15748 16584 | ::pretty_assertions::assert_eq!(
|
15749 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16585 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15750 16586 | http_response.status()
|
15751 16587 | );
|
15752 16588 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15753 16589 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15754 16590 | http_response.headers(),
|
15755 16591 | expected_headers,
|
15756 16592 | ));
|
15757 16593 | }
|
15758 16594 | }
|
15759 16595 |
|
15760 16596 | /// Underflow or overflow should result in SerializationException
|
15761 16597 | /// Test ID: RestJsonHeaderShortUnderflowOverflow_case1
|
15762 16598 | #[::tokio::test]
|
15763 16599 | #[::tracing_test::traced_test]
|
15764 16600 | async fn rest_json_header_short_underflow_overflow_case1_malformed_request() {
|
15765 16601 | {
|
15766 16602 | #[allow(unused_mut)]
|
15767 - | let mut http_request = http::Request::builder()
|
16603 + | let mut http_request = ::http_1x::Request::builder()
|
15768 16604 | .uri("/MalformedShort/1")
|
15769 16605 | .method("POST")
|
15770 16606 | .header("shortInHeader", "-40000")
|
15771 - | .body(::aws_smithy_http_server::body::Body::empty())
|
16607 + | .body(::aws_smithy_http_server::body::boxed(
|
16608 + | ::http_body_util::Empty::new(),
|
16609 + | ))
|
15772 16610 | .unwrap();
|
15773 16611 | #[allow(unused_mut)]
|
15774 16612 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15775 16613 | let config = crate::service::RestJsonConfig::builder().build();
|
15776 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16614 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15777 16615 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15778 16616 | let sender = sender.clone();
|
15779 16617 | async move {
|
15780 16618 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15781 16619 | sender.send(()).await.expect("receiver dropped early");
|
15782 16620 | result
|
15783 16621 | }
|
15784 16622 | })
|
15785 16623 | .build_unchecked();
|
15786 16624 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15787 16625 | .await
|
15788 16626 | .expect("unable to make an HTTP request");
|
15789 16627 | ::pretty_assertions::assert_eq!(
|
15790 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16628 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15791 16629 | http_response.status()
|
15792 16630 | );
|
15793 16631 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15794 16632 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15795 16633 | http_response.headers(),
|
15796 16634 | expected_headers,
|
15797 16635 | ));
|
15798 16636 | }
|
15799 16637 | }
|
15800 16638 |
|
15801 16639 | /// Underflow or overflow should result in SerializationException
|
15802 16640 | /// Test ID: RestJsonHeaderShortUnderflowOverflow_case2
|
15803 16641 | #[::tokio::test]
|
15804 16642 | #[::tracing_test::traced_test]
|
15805 16643 | async fn rest_json_header_short_underflow_overflow_case2_malformed_request() {
|
15806 16644 | {
|
15807 16645 | #[allow(unused_mut)]
|
15808 - | let mut http_request = http::Request::builder()
|
16646 + | let mut http_request = ::http_1x::Request::builder()
|
15809 16647 | .uri("/MalformedShort/1")
|
15810 16648 | .method("POST")
|
15811 16649 | .header("shortInHeader", "-9223372000000000000")
|
15812 - | .body(::aws_smithy_http_server::body::Body::empty())
|
16650 + | .body(::aws_smithy_http_server::body::boxed(
|
16651 + | ::http_body_util::Empty::new(),
|
16652 + | ))
|
15813 16653 | .unwrap();
|
15814 16654 | #[allow(unused_mut)]
|
15815 16655 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15816 16656 | let config = crate::service::RestJsonConfig::builder().build();
|
15817 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16657 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15818 16658 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15819 16659 | let sender = sender.clone();
|
15820 16660 | async move {
|
15821 16661 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15822 16662 | sender.send(()).await.expect("receiver dropped early");
|
15823 16663 | result
|
15824 16664 | }
|
15825 16665 | })
|
15826 16666 | .build_unchecked();
|
15827 16667 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15828 16668 | .await
|
15829 16669 | .expect("unable to make an HTTP request");
|
15830 16670 | ::pretty_assertions::assert_eq!(
|
15831 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16671 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15832 16672 | http_response.status()
|
15833 16673 | );
|
15834 16674 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15835 16675 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15836 16676 | http_response.headers(),
|
15837 16677 | expected_headers,
|
15838 16678 | ));
|
15839 16679 | }
|
15840 16680 | }
|
15841 16681 |
|
15842 16682 | /// Underflow or overflow should result in SerializationException
|
15843 16683 | /// Test ID: RestJsonHeaderShortUnderflowOverflow_case3
|
15844 16684 | #[::tokio::test]
|
15845 16685 | #[::tracing_test::traced_test]
|
15846 16686 | async fn rest_json_header_short_underflow_overflow_case3_malformed_request() {
|
15847 16687 | {
|
15848 16688 | #[allow(unused_mut)]
|
15849 - | let mut http_request = http::Request::builder()
|
16689 + | let mut http_request = ::http_1x::Request::builder()
|
15850 16690 | .uri("/MalformedShort/1")
|
15851 16691 | .method("POST")
|
15852 16692 | .header("shortInHeader", "9223372000000000000")
|
15853 - | .body(::aws_smithy_http_server::body::Body::empty())
|
16693 + | .body(::aws_smithy_http_server::body::boxed(
|
16694 + | ::http_body_util::Empty::new(),
|
16695 + | ))
|
15854 16696 | .unwrap();
|
15855 16697 | #[allow(unused_mut)]
|
15856 16698 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15857 16699 | let config = crate::service::RestJsonConfig::builder().build();
|
15858 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16700 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15859 16701 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15860 16702 | let sender = sender.clone();
|
15861 16703 | async move {
|
15862 16704 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15863 16705 | sender.send(()).await.expect("receiver dropped early");
|
15864 16706 | result
|
15865 16707 | }
|
15866 16708 | })
|
15867 16709 | .build_unchecked();
|
15868 16710 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15869 16711 | .await
|
15870 16712 | .expect("unable to make an HTTP request");
|
15871 16713 | ::pretty_assertions::assert_eq!(
|
15872 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16714 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15873 16715 | http_response.status()
|
15874 16716 | );
|
15875 16717 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15876 16718 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15877 16719 | http_response.headers(),
|
15878 16720 | expected_headers,
|
15879 16721 | ));
|
15880 16722 | }
|
15881 16723 | }
|
15882 16724 |
|
15883 16725 | /// Underflow or overflow should result in SerializationException
|
15884 16726 | /// Test ID: RestJsonHeaderShortUnderflowOverflow_case4
|
15885 16727 | #[::tokio::test]
|
15886 16728 | #[::tracing_test::traced_test]
|
15887 16729 | async fn rest_json_header_short_underflow_overflow_case4_malformed_request() {
|
15888 16730 | {
|
15889 16731 | #[allow(unused_mut)]
|
15890 - | let mut http_request = http::Request::builder()
|
16732 + | let mut http_request = ::http_1x::Request::builder()
|
15891 16733 | .uri("/MalformedShort/1")
|
15892 16734 | .method("POST")
|
15893 16735 | .header("shortInHeader", "123000000000000000000000")
|
15894 - | .body(::aws_smithy_http_server::body::Body::empty())
|
16736 + | .body(::aws_smithy_http_server::body::boxed(
|
16737 + | ::http_body_util::Empty::new(),
|
16738 + | ))
|
15895 16739 | .unwrap();
|
15896 16740 | #[allow(unused_mut)]
|
15897 16741 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15898 16742 | let config = crate::service::RestJsonConfig::builder().build();
|
15899 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16743 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15900 16744 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15901 16745 | let sender = sender.clone();
|
15902 16746 | async move {
|
15903 16747 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15904 16748 | sender.send(()).await.expect("receiver dropped early");
|
15905 16749 | result
|
15906 16750 | }
|
15907 16751 | })
|
15908 16752 | .build_unchecked();
|
15909 16753 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15910 16754 | .await
|
15911 16755 | .expect("unable to make an HTTP request");
|
15912 16756 | ::pretty_assertions::assert_eq!(
|
15913 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16757 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15914 16758 | http_response.status()
|
15915 16759 | );
|
15916 16760 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15917 16761 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15918 16762 | http_response.headers(),
|
15919 16763 | expected_headers,
|
15920 16764 | ));
|
15921 16765 | }
|
15922 16766 | }
|
15923 16767 |
|
15924 16768 | /// Malformed values in the body should be rejected
|
15925 16769 | /// Test ID: RestJsonBodyShortMalformedValueRejected_case0
|
15926 16770 | #[::tokio::test]
|
15927 16771 | #[::tracing_test::traced_test]
|
15928 16772 | async fn rest_json_body_short_malformed_value_rejected_case0_malformed_request() {
|
15929 16773 | {
|
15930 16774 | #[allow(unused_mut)]
|
15931 - | let mut http_request = http::Request::builder()
|
16775 + | let mut http_request = ::http_1x::Request::builder()
|
15932 16776 | .uri("/MalformedShort/1")
|
15933 16777 | .method("POST")
|
15934 16778 | .header("content-type", "application/json")
|
15935 - | .body(::aws_smithy_http_server::body::Body::from(
|
15936 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
15937 - | "{ \"shortInBody\" : \"123\" }".as_bytes(),
|
15938 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
16779 + | .body(::aws_smithy_http_server::body::boxed(
|
16780 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
16781 + | &::aws_smithy_protocol_test::decode_body_data(
|
16782 + | "{ \"shortInBody\" : \"123\" }".as_bytes(),
|
16783 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
16784 + | ),
|
15939 16785 | )),
|
15940 16786 | ))
|
15941 16787 | .unwrap();
|
15942 16788 | #[allow(unused_mut)]
|
15943 16789 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15944 16790 | let config = crate::service::RestJsonConfig::builder().build();
|
15945 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16791 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15946 16792 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15947 16793 | let sender = sender.clone();
|
15948 16794 | async move {
|
15949 16795 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15950 16796 | sender.send(()).await.expect("receiver dropped early");
|
15951 16797 | result
|
15952 16798 | }
|
15953 16799 | })
|
15954 16800 | .build_unchecked();
|
15955 16801 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
15956 16802 | .await
|
15957 16803 | .expect("unable to make an HTTP request");
|
15958 16804 | ::pretty_assertions::assert_eq!(
|
15959 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16805 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
15960 16806 | http_response.status()
|
15961 16807 | );
|
15962 16808 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
15963 16809 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
15964 16810 | http_response.headers(),
|
15965 16811 | expected_headers,
|
15966 16812 | ));
|
15967 16813 | }
|
15968 16814 | }
|
15969 16815 |
|
15970 16816 | /// Malformed values in the body should be rejected
|
15971 16817 | /// Test ID: RestJsonBodyShortMalformedValueRejected_case1
|
15972 16818 | #[::tokio::test]
|
15973 16819 | #[::tracing_test::traced_test]
|
15974 16820 | async fn rest_json_body_short_malformed_value_rejected_case1_malformed_request() {
|
15975 16821 | {
|
15976 16822 | #[allow(unused_mut)]
|
15977 - | let mut http_request = http::Request::builder()
|
16823 + | let mut http_request = ::http_1x::Request::builder()
|
15978 16824 | .uri("/MalformedShort/1")
|
15979 16825 | .method("POST")
|
15980 16826 | .header("content-type", "application/json")
|
15981 - | .body(::aws_smithy_http_server::body::Body::from(
|
15982 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
15983 - | "{ \"shortInBody\" : true }".as_bytes(),
|
15984 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
16827 + | .body(::aws_smithy_http_server::body::boxed(
|
16828 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
16829 + | &::aws_smithy_protocol_test::decode_body_data(
|
16830 + | "{ \"shortInBody\" : true }".as_bytes(),
|
16831 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
16832 + | ),
|
15985 16833 | )),
|
15986 16834 | ))
|
15987 16835 | .unwrap();
|
15988 16836 | #[allow(unused_mut)]
|
15989 16837 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
15990 16838 | let config = crate::service::RestJsonConfig::builder().build();
|
15991 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16839 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
15992 16840 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
15993 16841 | let sender = sender.clone();
|
15994 16842 | async move {
|
15995 16843 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
15996 16844 | sender.send(()).await.expect("receiver dropped early");
|
15997 16845 | result
|
15998 16846 | }
|
15999 16847 | })
|
16000 16848 | .build_unchecked();
|
16001 16849 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16002 16850 | .await
|
16003 16851 | .expect("unable to make an HTTP request");
|
16004 16852 | ::pretty_assertions::assert_eq!(
|
16005 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16853 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16006 16854 | http_response.status()
|
16007 16855 | );
|
16008 16856 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16009 16857 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16010 16858 | http_response.headers(),
|
16011 16859 | expected_headers,
|
16012 16860 | ));
|
16013 16861 | }
|
16014 16862 | }
|
16015 16863 |
|
16016 16864 | /// Malformed values in the body should be rejected
|
16017 16865 | /// Test ID: RestJsonBodyShortMalformedValueRejected_case2
|
16018 16866 | #[::tokio::test]
|
16019 16867 | #[::tracing_test::traced_test]
|
16020 16868 | async fn rest_json_body_short_malformed_value_rejected_case2_malformed_request() {
|
16021 16869 | {
|
16022 16870 | #[allow(unused_mut)]
|
16023 - | let mut http_request = http::Request::builder()
|
16871 + | let mut http_request = ::http_1x::Request::builder()
|
16024 16872 | .uri("/MalformedShort/1")
|
16025 16873 | .method("POST")
|
16026 16874 | .header("content-type", "application/json")
|
16027 - | .body(::aws_smithy_http_server::body::Body::from(
|
16028 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
16029 - | "{ \"shortInBody\" : 1.001 }".as_bytes(),
|
16030 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
16875 + | .body(::aws_smithy_http_server::body::boxed(
|
16876 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
16877 + | &::aws_smithy_protocol_test::decode_body_data(
|
16878 + | "{ \"shortInBody\" : 1.001 }".as_bytes(),
|
16879 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
16880 + | ),
|
16031 16881 | )),
|
16032 16882 | ))
|
16033 16883 | .unwrap();
|
16034 16884 | #[allow(unused_mut)]
|
16035 16885 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16036 16886 | let config = crate::service::RestJsonConfig::builder().build();
|
16037 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16887 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16038 16888 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16039 16889 | let sender = sender.clone();
|
16040 16890 | async move {
|
16041 16891 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16042 16892 | sender.send(()).await.expect("receiver dropped early");
|
16043 16893 | result
|
16044 16894 | }
|
16045 16895 | })
|
16046 16896 | .build_unchecked();
|
16047 16897 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16048 16898 | .await
|
16049 16899 | .expect("unable to make an HTTP request");
|
16050 16900 | ::pretty_assertions::assert_eq!(
|
16051 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16901 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16052 16902 | http_response.status()
|
16053 16903 | );
|
16054 16904 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16055 16905 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16056 16906 | http_response.headers(),
|
16057 16907 | expected_headers,
|
16058 16908 | ));
|
16059 16909 | }
|
16060 16910 | }
|
16061 16911 |
|
16062 16912 | /// Malformed values in the body should be rejected
|
16063 16913 | /// Test ID: RestJsonBodyShortMalformedValueRejected_case3
|
16064 16914 | #[::tokio::test]
|
16065 16915 | #[::tracing_test::traced_test]
|
16066 16916 | async fn rest_json_body_short_malformed_value_rejected_case3_malformed_request() {
|
16067 16917 | {
|
16068 16918 | #[allow(unused_mut)]
|
16069 - | let mut http_request = http::Request::builder()
|
16919 + | let mut http_request = ::http_1x::Request::builder()
|
16070 16920 | .uri("/MalformedShort/1")
|
16071 16921 | .method("POST")
|
16072 16922 | .header("content-type", "application/json")
|
16073 - | .body(::aws_smithy_http_server::body::Body::from(
|
16074 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
16075 - | "{ \"shortInBody\" : 2ABC }".as_bytes(),
|
16076 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
16923 + | .body(::aws_smithy_http_server::body::boxed(
|
16924 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
16925 + | &::aws_smithy_protocol_test::decode_body_data(
|
16926 + | "{ \"shortInBody\" : 2ABC }".as_bytes(),
|
16927 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
16928 + | ),
|
16077 16929 | )),
|
16078 16930 | ))
|
16079 16931 | .unwrap();
|
16080 16932 | #[allow(unused_mut)]
|
16081 16933 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16082 16934 | let config = crate::service::RestJsonConfig::builder().build();
|
16083 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16935 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16084 16936 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16085 16937 | let sender = sender.clone();
|
16086 16938 | async move {
|
16087 16939 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16088 16940 | sender.send(()).await.expect("receiver dropped early");
|
16089 16941 | result
|
16090 16942 | }
|
16091 16943 | })
|
16092 16944 | .build_unchecked();
|
16093 16945 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16094 16946 | .await
|
16095 16947 | .expect("unable to make an HTTP request");
|
16096 16948 | ::pretty_assertions::assert_eq!(
|
16097 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16949 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16098 16950 | http_response.status()
|
16099 16951 | );
|
16100 16952 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16101 16953 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16102 16954 | http_response.headers(),
|
16103 16955 | expected_headers,
|
16104 16956 | ));
|
16105 16957 | }
|
16106 16958 | }
|
16107 16959 |
|
16108 16960 | /// Malformed values in the body should be rejected
|
16109 16961 | /// Test ID: RestJsonBodyShortMalformedValueRejected_case4
|
16110 16962 | #[::tokio::test]
|
16111 16963 | #[::tracing_test::traced_test]
|
16112 16964 | async fn rest_json_body_short_malformed_value_rejected_case4_malformed_request() {
|
16113 16965 | {
|
16114 16966 | #[allow(unused_mut)]
|
16115 - | let mut http_request = http::Request::builder()
|
16967 + | let mut http_request = ::http_1x::Request::builder()
|
16116 16968 | .uri("/MalformedShort/1")
|
16117 16969 | .method("POST")
|
16118 16970 | .header("content-type", "application/json")
|
16119 - | .body(::aws_smithy_http_server::body::Body::from(
|
16120 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
16121 - | "{ \"shortInBody\" : 0x42 }".as_bytes(),
|
16122 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
16971 + | .body(::aws_smithy_http_server::body::boxed(
|
16972 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
16973 + | &::aws_smithy_protocol_test::decode_body_data(
|
16974 + | "{ \"shortInBody\" : 0x42 }".as_bytes(),
|
16975 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
16976 + | ),
|
16123 16977 | )),
|
16124 16978 | ))
|
16125 16979 | .unwrap();
|
16126 16980 | #[allow(unused_mut)]
|
16127 16981 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16128 16982 | let config = crate::service::RestJsonConfig::builder().build();
|
16129 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
16983 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16130 16984 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16131 16985 | let sender = sender.clone();
|
16132 16986 | async move {
|
16133 16987 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16134 16988 | sender.send(()).await.expect("receiver dropped early");
|
16135 16989 | result
|
16136 16990 | }
|
16137 16991 | })
|
16138 16992 | .build_unchecked();
|
16139 16993 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16140 16994 | .await
|
16141 16995 | .expect("unable to make an HTTP request");
|
16142 16996 | ::pretty_assertions::assert_eq!(
|
16143 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16997 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16144 16998 | http_response.status()
|
16145 16999 | );
|
16146 17000 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16147 17001 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16148 17002 | http_response.headers(),
|
16149 17003 | expected_headers,
|
16150 17004 | ));
|
16151 17005 | }
|
16152 17006 | }
|
16153 17007 |
|
16154 17008 | /// Malformed values in the body should be rejected
|
16155 17009 | /// Test ID: RestJsonBodyShortMalformedValueRejected_case5
|
16156 17010 | #[::tokio::test]
|
16157 17011 | #[::tracing_test::traced_test]
|
16158 17012 | async fn rest_json_body_short_malformed_value_rejected_case5_malformed_request() {
|
16159 17013 | {
|
16160 17014 | #[allow(unused_mut)]
|
16161 - | let mut http_request = http::Request::builder()
|
17015 + | let mut http_request = ::http_1x::Request::builder()
|
16162 17016 | .uri("/MalformedShort/1")
|
16163 17017 | .method("POST")
|
16164 17018 | .header("content-type", "application/json")
|
16165 - | .body(::aws_smithy_http_server::body::Body::from(
|
16166 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
16167 - | "{ \"shortInBody\" : Infinity }".as_bytes(),
|
16168 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
17019 + | .body(::aws_smithy_http_server::body::boxed(
|
17020 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
17021 + | &::aws_smithy_protocol_test::decode_body_data(
|
17022 + | "{ \"shortInBody\" : Infinity }".as_bytes(),
|
17023 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
17024 + | ),
|
16169 17025 | )),
|
16170 17026 | ))
|
16171 17027 | .unwrap();
|
16172 17028 | #[allow(unused_mut)]
|
16173 17029 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16174 17030 | let config = crate::service::RestJsonConfig::builder().build();
|
16175 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17031 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16176 17032 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16177 17033 | let sender = sender.clone();
|
16178 17034 | async move {
|
16179 17035 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16180 17036 | sender.send(()).await.expect("receiver dropped early");
|
16181 17037 | result
|
16182 17038 | }
|
16183 17039 | })
|
16184 17040 | .build_unchecked();
|
16185 17041 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16186 17042 | .await
|
16187 17043 | .expect("unable to make an HTTP request");
|
16188 17044 | ::pretty_assertions::assert_eq!(
|
16189 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17045 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16190 17046 | http_response.status()
|
16191 17047 | );
|
16192 17048 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16193 17049 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16194 17050 | http_response.headers(),
|
16195 17051 | expected_headers,
|
16196 17052 | ));
|
16197 17053 | }
|
16198 17054 | }
|
16199 17055 |
|
16200 17056 | /// Malformed values in the body should be rejected
|
16201 17057 | /// Test ID: RestJsonBodyShortMalformedValueRejected_case6
|
16202 17058 | #[::tokio::test]
|
16203 17059 | #[::tracing_test::traced_test]
|
16204 17060 | async fn rest_json_body_short_malformed_value_rejected_case6_malformed_request() {
|
16205 17061 | {
|
16206 17062 | #[allow(unused_mut)]
|
16207 - | let mut http_request = http::Request::builder()
|
17063 + | let mut http_request = ::http_1x::Request::builder()
|
16208 17064 | .uri("/MalformedShort/1")
|
16209 17065 | .method("POST")
|
16210 17066 | .header("content-type", "application/json")
|
16211 - | .body(::aws_smithy_http_server::body::Body::from(
|
16212 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
16213 - | "{ \"shortInBody\" : \"Infinity\" }".as_bytes(),
|
16214 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
17067 + | .body(::aws_smithy_http_server::body::boxed(
|
17068 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
17069 + | &::aws_smithy_protocol_test::decode_body_data(
|
17070 + | "{ \"shortInBody\" : \"Infinity\" }".as_bytes(),
|
17071 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
17072 + | ),
|
16215 17073 | )),
|
16216 17074 | ))
|
16217 17075 | .unwrap();
|
16218 17076 | #[allow(unused_mut)]
|
16219 17077 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16220 17078 | let config = crate::service::RestJsonConfig::builder().build();
|
16221 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17079 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16222 17080 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16223 17081 | let sender = sender.clone();
|
16224 17082 | async move {
|
16225 17083 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16226 17084 | sender.send(()).await.expect("receiver dropped early");
|
16227 17085 | result
|
16228 17086 | }
|
16229 17087 | })
|
16230 17088 | .build_unchecked();
|
16231 17089 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16232 17090 | .await
|
16233 17091 | .expect("unable to make an HTTP request");
|
16234 17092 | ::pretty_assertions::assert_eq!(
|
16235 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17093 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16236 17094 | http_response.status()
|
16237 17095 | );
|
16238 17096 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16239 17097 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16240 17098 | http_response.headers(),
|
16241 17099 | expected_headers,
|
16242 17100 | ));
|
16243 17101 | }
|
16244 17102 | }
|
16245 17103 |
|
16246 17104 | /// Malformed values in the body should be rejected
|
16247 17105 | /// Test ID: RestJsonBodyShortMalformedValueRejected_case7
|
16248 17106 | #[::tokio::test]
|
16249 17107 | #[::tracing_test::traced_test]
|
16250 17108 | async fn rest_json_body_short_malformed_value_rejected_case7_malformed_request() {
|
16251 17109 | {
|
16252 17110 | #[allow(unused_mut)]
|
16253 - | let mut http_request = http::Request::builder()
|
17111 + | let mut http_request = ::http_1x::Request::builder()
|
16254 17112 | .uri("/MalformedShort/1")
|
16255 17113 | .method("POST")
|
16256 17114 | .header("content-type", "application/json")
|
16257 - | .body(::aws_smithy_http_server::body::Body::from(
|
16258 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
16259 - | "{ \"shortInBody\" : -Infinity }".as_bytes(),
|
16260 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
17115 + | .body(::aws_smithy_http_server::body::boxed(
|
17116 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
17117 + | &::aws_smithy_protocol_test::decode_body_data(
|
17118 + | "{ \"shortInBody\" : -Infinity }".as_bytes(),
|
17119 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
17120 + | ),
|
16261 17121 | )),
|
16262 17122 | ))
|
16263 17123 | .unwrap();
|
16264 17124 | #[allow(unused_mut)]
|
16265 17125 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16266 17126 | let config = crate::service::RestJsonConfig::builder().build();
|
16267 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17127 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16268 17128 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16269 17129 | let sender = sender.clone();
|
16270 17130 | async move {
|
16271 17131 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16272 17132 | sender.send(()).await.expect("receiver dropped early");
|
16273 17133 | result
|
16274 17134 | }
|
16275 17135 | })
|
16276 17136 | .build_unchecked();
|
16277 17137 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16278 17138 | .await
|
16279 17139 | .expect("unable to make an HTTP request");
|
16280 17140 | ::pretty_assertions::assert_eq!(
|
16281 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17141 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16282 17142 | http_response.status()
|
16283 17143 | );
|
16284 17144 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16285 17145 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16286 17146 | http_response.headers(),
|
16287 17147 | expected_headers,
|
16288 17148 | ));
|
16289 17149 | }
|
16290 17150 | }
|
16291 17151 |
|
16292 17152 | /// Malformed values in the body should be rejected
|
16293 17153 | /// Test ID: RestJsonBodyShortMalformedValueRejected_case8
|
16294 17154 | #[::tokio::test]
|
16295 17155 | #[::tracing_test::traced_test]
|
16296 17156 | async fn rest_json_body_short_malformed_value_rejected_case8_malformed_request() {
|
16297 17157 | {
|
16298 17158 | #[allow(unused_mut)]
|
16299 - | let mut http_request = http::Request::builder()
|
17159 + | let mut http_request = ::http_1x::Request::builder()
|
16300 17160 | .uri("/MalformedShort/1")
|
16301 17161 | .method("POST")
|
16302 17162 | .header("content-type", "application/json")
|
16303 - | .body(::aws_smithy_http_server::body::Body::from(
|
16304 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
16305 - | "{ \"shortInBody\" : \"-Infinity\" }".as_bytes(),
|
16306 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
17163 + | .body(::aws_smithy_http_server::body::boxed(
|
17164 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
17165 + | &::aws_smithy_protocol_test::decode_body_data(
|
17166 + | "{ \"shortInBody\" : \"-Infinity\" }".as_bytes(),
|
17167 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
17168 + | ),
|
16307 17169 | )),
|
16308 17170 | ))
|
16309 17171 | .unwrap();
|
16310 17172 | #[allow(unused_mut)]
|
16311 17173 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16312 17174 | let config = crate::service::RestJsonConfig::builder().build();
|
16313 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17175 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16314 17176 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16315 17177 | let sender = sender.clone();
|
16316 17178 | async move {
|
16317 17179 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16318 17180 | sender.send(()).await.expect("receiver dropped early");
|
16319 17181 | result
|
16320 17182 | }
|
16321 17183 | })
|
16322 17184 | .build_unchecked();
|
16323 17185 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16324 17186 | .await
|
16325 17187 | .expect("unable to make an HTTP request");
|
16326 17188 | ::pretty_assertions::assert_eq!(
|
16327 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17189 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16328 17190 | http_response.status()
|
16329 17191 | );
|
16330 17192 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16331 17193 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16332 17194 | http_response.headers(),
|
16333 17195 | expected_headers,
|
16334 17196 | ));
|
16335 17197 | }
|
16336 17198 | }
|
16337 17199 |
|
16338 17200 | /// Malformed values in the body should be rejected
|
16339 17201 | /// Test ID: RestJsonBodyShortMalformedValueRejected_case9
|
16340 17202 | #[::tokio::test]
|
16341 17203 | #[::tracing_test::traced_test]
|
16342 17204 | async fn rest_json_body_short_malformed_value_rejected_case9_malformed_request() {
|
16343 17205 | {
|
16344 17206 | #[allow(unused_mut)]
|
16345 - | let mut http_request = http::Request::builder()
|
17207 + | let mut http_request = ::http_1x::Request::builder()
|
16346 17208 | .uri("/MalformedShort/1")
|
16347 17209 | .method("POST")
|
16348 17210 | .header("content-type", "application/json")
|
16349 - | .body(::aws_smithy_http_server::body::Body::from(
|
16350 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
16351 - | "{ \"shortInBody\" : NaN }".as_bytes(),
|
16352 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
17211 + | .body(::aws_smithy_http_server::body::boxed(
|
17212 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
17213 + | &::aws_smithy_protocol_test::decode_body_data(
|
17214 + | "{ \"shortInBody\" : NaN }".as_bytes(),
|
17215 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
17216 + | ),
|
16353 17217 | )),
|
16354 17218 | ))
|
16355 17219 | .unwrap();
|
16356 17220 | #[allow(unused_mut)]
|
16357 17221 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16358 17222 | let config = crate::service::RestJsonConfig::builder().build();
|
16359 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17223 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16360 17224 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16361 17225 | let sender = sender.clone();
|
16362 17226 | async move {
|
16363 17227 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16364 17228 | sender.send(()).await.expect("receiver dropped early");
|
16365 17229 | result
|
16366 17230 | }
|
16367 17231 | })
|
16368 17232 | .build_unchecked();
|
16369 17233 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16370 17234 | .await
|
16371 17235 | .expect("unable to make an HTTP request");
|
16372 17236 | ::pretty_assertions::assert_eq!(
|
16373 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17237 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16374 17238 | http_response.status()
|
16375 17239 | );
|
16376 17240 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16377 17241 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16378 17242 | http_response.headers(),
|
16379 17243 | expected_headers,
|
16380 17244 | ));
|
16381 17245 | }
|
16382 17246 | }
|
16383 17247 |
|
16384 17248 | /// Malformed values in the body should be rejected
|
16385 17249 | /// Test ID: RestJsonBodyShortMalformedValueRejected_case10
|
16386 17250 | #[::tokio::test]
|
16387 17251 | #[::tracing_test::traced_test]
|
16388 17252 | async fn rest_json_body_short_malformed_value_rejected_case10_malformed_request() {
|
16389 17253 | {
|
16390 17254 | #[allow(unused_mut)]
|
16391 - | let mut http_request = http::Request::builder()
|
17255 + | let mut http_request = ::http_1x::Request::builder()
|
16392 17256 | .uri("/MalformedShort/1")
|
16393 17257 | .method("POST")
|
16394 17258 | .header("content-type", "application/json")
|
16395 - | .body(::aws_smithy_http_server::body::Body::from(
|
16396 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
16397 - | "{ \"shortInBody\" : \"NaN\" }".as_bytes(),
|
16398 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
17259 + | .body(::aws_smithy_http_server::body::boxed(
|
17260 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
17261 + | &::aws_smithy_protocol_test::decode_body_data(
|
17262 + | "{ \"shortInBody\" : \"NaN\" }".as_bytes(),
|
17263 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
17264 + | ),
|
16399 17265 | )),
|
16400 17266 | ))
|
16401 17267 | .unwrap();
|
16402 17268 | #[allow(unused_mut)]
|
16403 17269 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16404 17270 | let config = crate::service::RestJsonConfig::builder().build();
|
16405 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17271 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16406 17272 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16407 17273 | let sender = sender.clone();
|
16408 17274 | async move {
|
16409 17275 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16410 17276 | sender.send(()).await.expect("receiver dropped early");
|
16411 17277 | result
|
16412 17278 | }
|
16413 17279 | })
|
16414 17280 | .build_unchecked();
|
16415 17281 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16416 17282 | .await
|
16417 17283 | .expect("unable to make an HTTP request");
|
16418 17284 | ::pretty_assertions::assert_eq!(
|
16419 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17285 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16420 17286 | http_response.status()
|
16421 17287 | );
|
16422 17288 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16423 17289 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16424 17290 | http_response.headers(),
|
16425 17291 | expected_headers,
|
16426 17292 | ));
|
16427 17293 | }
|
16428 17294 | }
|
16429 17295 |
|
16430 17296 | /// Malformed values in the path should be rejected
|
16431 17297 | /// Test ID: RestJsonPathShortMalformedValueRejected_case0
|
16432 17298 | #[::tokio::test]
|
16433 17299 | #[::tracing_test::traced_test]
|
16434 17300 | async fn rest_json_path_short_malformed_value_rejected_case0_malformed_request() {
|
16435 17301 | {
|
16436 17302 | #[allow(unused_mut)]
|
16437 - | let mut http_request = http::Request::builder()
|
17303 + | let mut http_request = ::http_1x::Request::builder()
|
16438 17304 | .uri("/MalformedShort/true")
|
16439 17305 | .method("POST")
|
16440 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17306 + | .body(::aws_smithy_http_server::body::boxed(
|
17307 + | ::http_body_util::Empty::new(),
|
17308 + | ))
|
16441 17309 | .unwrap();
|
16442 17310 | #[allow(unused_mut)]
|
16443 17311 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16444 17312 | let config = crate::service::RestJsonConfig::builder().build();
|
16445 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17313 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16446 17314 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16447 17315 | let sender = sender.clone();
|
16448 17316 | async move {
|
16449 17317 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16450 17318 | sender.send(()).await.expect("receiver dropped early");
|
16451 17319 | result
|
16452 17320 | }
|
16453 17321 | })
|
16454 17322 | .build_unchecked();
|
16455 17323 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16456 17324 | .await
|
16457 17325 | .expect("unable to make an HTTP request");
|
16458 17326 | ::pretty_assertions::assert_eq!(
|
16459 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17327 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16460 17328 | http_response.status()
|
16461 17329 | );
|
16462 17330 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16463 17331 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16464 17332 | http_response.headers(),
|
16465 17333 | expected_headers,
|
16466 17334 | ));
|
16467 17335 | }
|
16468 17336 | }
|
16469 17337 |
|
16470 17338 | /// Malformed values in the path should be rejected
|
16471 17339 | /// Test ID: RestJsonPathShortMalformedValueRejected_case1
|
16472 17340 | #[::tokio::test]
|
16473 17341 | #[::tracing_test::traced_test]
|
16474 17342 | async fn rest_json_path_short_malformed_value_rejected_case1_malformed_request() {
|
16475 17343 | {
|
16476 17344 | #[allow(unused_mut)]
|
16477 - | let mut http_request = http::Request::builder()
|
17345 + | let mut http_request = ::http_1x::Request::builder()
|
16478 17346 | .uri("/MalformedShort/1.001")
|
16479 17347 | .method("POST")
|
16480 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17348 + | .body(::aws_smithy_http_server::body::boxed(
|
17349 + | ::http_body_util::Empty::new(),
|
17350 + | ))
|
16481 17351 | .unwrap();
|
16482 17352 | #[allow(unused_mut)]
|
16483 17353 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16484 17354 | let config = crate::service::RestJsonConfig::builder().build();
|
16485 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17355 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16486 17356 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16487 17357 | let sender = sender.clone();
|
16488 17358 | async move {
|
16489 17359 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16490 17360 | sender.send(()).await.expect("receiver dropped early");
|
16491 17361 | result
|
16492 17362 | }
|
16493 17363 | })
|
16494 17364 | .build_unchecked();
|
16495 17365 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16496 17366 | .await
|
16497 17367 | .expect("unable to make an HTTP request");
|
16498 17368 | ::pretty_assertions::assert_eq!(
|
16499 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17369 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16500 17370 | http_response.status()
|
16501 17371 | );
|
16502 17372 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16503 17373 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16504 17374 | http_response.headers(),
|
16505 17375 | expected_headers,
|
16506 17376 | ));
|
16507 17377 | }
|
16508 17378 | }
|
16509 17379 |
|
16510 17380 | /// Malformed values in the path should be rejected
|
16511 17381 | /// Test ID: RestJsonPathShortMalformedValueRejected_case2
|
16512 17382 | #[::tokio::test]
|
16513 17383 | #[::tracing_test::traced_test]
|
16514 17384 | async fn rest_json_path_short_malformed_value_rejected_case2_malformed_request() {
|
16515 17385 | {
|
16516 17386 | #[allow(unused_mut)]
|
16517 - | let mut http_request = http::Request::builder()
|
17387 + | let mut http_request = ::http_1x::Request::builder()
|
16518 17388 | .uri("/MalformedShort/2ABC")
|
16519 17389 | .method("POST")
|
16520 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17390 + | .body(::aws_smithy_http_server::body::boxed(
|
17391 + | ::http_body_util::Empty::new(),
|
17392 + | ))
|
16521 17393 | .unwrap();
|
16522 17394 | #[allow(unused_mut)]
|
16523 17395 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16524 17396 | let config = crate::service::RestJsonConfig::builder().build();
|
16525 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17397 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16526 17398 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16527 17399 | let sender = sender.clone();
|
16528 17400 | async move {
|
16529 17401 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16530 17402 | sender.send(()).await.expect("receiver dropped early");
|
16531 17403 | result
|
16532 17404 | }
|
16533 17405 | })
|
16534 17406 | .build_unchecked();
|
16535 17407 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16536 17408 | .await
|
16537 17409 | .expect("unable to make an HTTP request");
|
16538 17410 | ::pretty_assertions::assert_eq!(
|
16539 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17411 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16540 17412 | http_response.status()
|
16541 17413 | );
|
16542 17414 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16543 17415 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16544 17416 | http_response.headers(),
|
16545 17417 | expected_headers,
|
16546 17418 | ));
|
16547 17419 | }
|
16548 17420 | }
|
16549 17421 |
|
16550 17422 | /// Malformed values in the path should be rejected
|
16551 17423 | /// Test ID: RestJsonPathShortMalformedValueRejected_case3
|
16552 17424 | #[::tokio::test]
|
16553 17425 | #[::tracing_test::traced_test]
|
16554 17426 | async fn rest_json_path_short_malformed_value_rejected_case3_malformed_request() {
|
16555 17427 | {
|
16556 17428 | #[allow(unused_mut)]
|
16557 - | let mut http_request = http::Request::builder()
|
17429 + | let mut http_request = ::http_1x::Request::builder()
|
16558 17430 | .uri("/MalformedShort/0x42")
|
16559 17431 | .method("POST")
|
16560 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17432 + | .body(::aws_smithy_http_server::body::boxed(
|
17433 + | ::http_body_util::Empty::new(),
|
17434 + | ))
|
16561 17435 | .unwrap();
|
16562 17436 | #[allow(unused_mut)]
|
16563 17437 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16564 17438 | let config = crate::service::RestJsonConfig::builder().build();
|
16565 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17439 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16566 17440 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16567 17441 | let sender = sender.clone();
|
16568 17442 | async move {
|
16569 17443 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16570 17444 | sender.send(()).await.expect("receiver dropped early");
|
16571 17445 | result
|
16572 17446 | }
|
16573 17447 | })
|
16574 17448 | .build_unchecked();
|
16575 17449 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16576 17450 | .await
|
16577 17451 | .expect("unable to make an HTTP request");
|
16578 17452 | ::pretty_assertions::assert_eq!(
|
16579 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17453 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16580 17454 | http_response.status()
|
16581 17455 | );
|
16582 17456 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16583 17457 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16584 17458 | http_response.headers(),
|
16585 17459 | expected_headers,
|
16586 17460 | ));
|
16587 17461 | }
|
16588 17462 | }
|
16589 17463 |
|
16590 17464 | /// Malformed values in the path should be rejected
|
16591 17465 | /// Test ID: RestJsonPathShortMalformedValueRejected_case4
|
16592 17466 | #[::tokio::test]
|
16593 17467 | #[::tracing_test::traced_test]
|
16594 17468 | async fn rest_json_path_short_malformed_value_rejected_case4_malformed_request() {
|
16595 17469 | {
|
16596 17470 | #[allow(unused_mut)]
|
16597 - | let mut http_request = http::Request::builder()
|
17471 + | let mut http_request = ::http_1x::Request::builder()
|
16598 17472 | .uri("/MalformedShort/Infinity")
|
16599 17473 | .method("POST")
|
16600 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17474 + | .body(::aws_smithy_http_server::body::boxed(
|
17475 + | ::http_body_util::Empty::new(),
|
17476 + | ))
|
16601 17477 | .unwrap();
|
16602 17478 | #[allow(unused_mut)]
|
16603 17479 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16604 17480 | let config = crate::service::RestJsonConfig::builder().build();
|
16605 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17481 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16606 17482 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16607 17483 | let sender = sender.clone();
|
16608 17484 | async move {
|
16609 17485 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16610 17486 | sender.send(()).await.expect("receiver dropped early");
|
16611 17487 | result
|
16612 17488 | }
|
16613 17489 | })
|
16614 17490 | .build_unchecked();
|
16615 17491 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16616 17492 | .await
|
16617 17493 | .expect("unable to make an HTTP request");
|
16618 17494 | ::pretty_assertions::assert_eq!(
|
16619 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17495 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16620 17496 | http_response.status()
|
16621 17497 | );
|
16622 17498 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16623 17499 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16624 17500 | http_response.headers(),
|
16625 17501 | expected_headers,
|
16626 17502 | ));
|
16627 17503 | }
|
16628 17504 | }
|
16629 17505 |
|
16630 17506 | /// Malformed values in the path should be rejected
|
16631 17507 | /// Test ID: RestJsonPathShortMalformedValueRejected_case5
|
16632 17508 | #[::tokio::test]
|
16633 17509 | #[::tracing_test::traced_test]
|
16634 17510 | async fn rest_json_path_short_malformed_value_rejected_case5_malformed_request() {
|
16635 17511 | {
|
16636 17512 | #[allow(unused_mut)]
|
16637 - | let mut http_request = http::Request::builder()
|
17513 + | let mut http_request = ::http_1x::Request::builder()
|
16638 17514 | .uri("/MalformedShort/-Infinity")
|
16639 17515 | .method("POST")
|
16640 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17516 + | .body(::aws_smithy_http_server::body::boxed(
|
17517 + | ::http_body_util::Empty::new(),
|
17518 + | ))
|
16641 17519 | .unwrap();
|
16642 17520 | #[allow(unused_mut)]
|
16643 17521 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16644 17522 | let config = crate::service::RestJsonConfig::builder().build();
|
16645 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17523 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16646 17524 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16647 17525 | let sender = sender.clone();
|
16648 17526 | async move {
|
16649 17527 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16650 17528 | sender.send(()).await.expect("receiver dropped early");
|
16651 17529 | result
|
16652 17530 | }
|
16653 17531 | })
|
16654 17532 | .build_unchecked();
|
16655 17533 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16656 17534 | .await
|
16657 17535 | .expect("unable to make an HTTP request");
|
16658 17536 | ::pretty_assertions::assert_eq!(
|
16659 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17537 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16660 17538 | http_response.status()
|
16661 17539 | );
|
16662 17540 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16663 17541 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16664 17542 | http_response.headers(),
|
16665 17543 | expected_headers,
|
16666 17544 | ));
|
16667 17545 | }
|
16668 17546 | }
|
16669 17547 |
|
16670 17548 | /// Malformed values in the path should be rejected
|
16671 17549 | /// Test ID: RestJsonPathShortMalformedValueRejected_case6
|
16672 17550 | #[::tokio::test]
|
16673 17551 | #[::tracing_test::traced_test]
|
16674 17552 | async fn rest_json_path_short_malformed_value_rejected_case6_malformed_request() {
|
16675 17553 | {
|
16676 17554 | #[allow(unused_mut)]
|
16677 - | let mut http_request = http::Request::builder()
|
17555 + | let mut http_request = ::http_1x::Request::builder()
|
16678 17556 | .uri("/MalformedShort/NaN")
|
16679 17557 | .method("POST")
|
16680 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17558 + | .body(::aws_smithy_http_server::body::boxed(
|
17559 + | ::http_body_util::Empty::new(),
|
17560 + | ))
|
16681 17561 | .unwrap();
|
16682 17562 | #[allow(unused_mut)]
|
16683 17563 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16684 17564 | let config = crate::service::RestJsonConfig::builder().build();
|
16685 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17565 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16686 17566 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16687 17567 | let sender = sender.clone();
|
16688 17568 | async move {
|
16689 17569 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16690 17570 | sender.send(()).await.expect("receiver dropped early");
|
16691 17571 | result
|
16692 17572 | }
|
16693 17573 | })
|
16694 17574 | .build_unchecked();
|
16695 17575 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16696 17576 | .await
|
16697 17577 | .expect("unable to make an HTTP request");
|
16698 17578 | ::pretty_assertions::assert_eq!(
|
16699 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17579 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16700 17580 | http_response.status()
|
16701 17581 | );
|
16702 17582 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16703 17583 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16704 17584 | http_response.headers(),
|
16705 17585 | expected_headers,
|
16706 17586 | ));
|
16707 17587 | }
|
16708 17588 | }
|
16709 17589 |
|
16710 17590 | /// Malformed values in query parameters should be rejected
|
16711 17591 | /// Test ID: RestJsonQueryShortMalformedValueRejected_case0
|
16712 17592 | #[::tokio::test]
|
16713 17593 | #[::tracing_test::traced_test]
|
16714 17594 | async fn rest_json_query_short_malformed_value_rejected_case0_malformed_request() {
|
16715 17595 | {
|
16716 17596 | #[allow(unused_mut)]
|
16717 - | let mut http_request = http::Request::builder()
|
17597 + | let mut http_request = ::http_1x::Request::builder()
|
16718 17598 | .uri("/MalformedShort/1")
|
16719 17599 | .method("POST")
|
16720 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17600 + | .body(::aws_smithy_http_server::body::boxed(
|
17601 + | ::http_body_util::Empty::new(),
|
17602 + | ))
|
16721 17603 | .unwrap();
|
16722 17604 | *http_request.uri_mut() = "/MalformedShort/1?shortInQuery=true".parse().unwrap();
|
16723 17605 | #[allow(unused_mut)]
|
16724 17606 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16725 17607 | let config = crate::service::RestJsonConfig::builder().build();
|
16726 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17608 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16727 17609 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16728 17610 | let sender = sender.clone();
|
16729 17611 | async move {
|
16730 17612 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16731 17613 | sender.send(()).await.expect("receiver dropped early");
|
16732 17614 | result
|
16733 17615 | }
|
16734 17616 | })
|
16735 17617 | .build_unchecked();
|
16736 17618 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16737 17619 | .await
|
16738 17620 | .expect("unable to make an HTTP request");
|
16739 17621 | ::pretty_assertions::assert_eq!(
|
16740 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17622 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16741 17623 | http_response.status()
|
16742 17624 | );
|
16743 17625 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16744 17626 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16745 17627 | http_response.headers(),
|
16746 17628 | expected_headers,
|
16747 17629 | ));
|
16748 17630 | }
|
16749 17631 | }
|
16750 17632 |
|
16751 17633 | /// Malformed values in query parameters should be rejected
|
16752 17634 | /// Test ID: RestJsonQueryShortMalformedValueRejected_case1
|
16753 17635 | #[::tokio::test]
|
16754 17636 | #[::tracing_test::traced_test]
|
16755 17637 | async fn rest_json_query_short_malformed_value_rejected_case1_malformed_request() {
|
16756 17638 | {
|
16757 17639 | #[allow(unused_mut)]
|
16758 - | let mut http_request = http::Request::builder()
|
17640 + | let mut http_request = ::http_1x::Request::builder()
|
16759 17641 | .uri("/MalformedShort/1")
|
16760 17642 | .method("POST")
|
16761 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17643 + | .body(::aws_smithy_http_server::body::boxed(
|
17644 + | ::http_body_util::Empty::new(),
|
17645 + | ))
|
16762 17646 | .unwrap();
|
16763 17647 | *http_request.uri_mut() = "/MalformedShort/1?shortInQuery=1.001".parse().unwrap();
|
16764 17648 | #[allow(unused_mut)]
|
16765 17649 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16766 17650 | let config = crate::service::RestJsonConfig::builder().build();
|
16767 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17651 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16768 17652 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16769 17653 | let sender = sender.clone();
|
16770 17654 | async move {
|
16771 17655 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16772 17656 | sender.send(()).await.expect("receiver dropped early");
|
16773 17657 | result
|
16774 17658 | }
|
16775 17659 | })
|
16776 17660 | .build_unchecked();
|
16777 17661 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16778 17662 | .await
|
16779 17663 | .expect("unable to make an HTTP request");
|
16780 17664 | ::pretty_assertions::assert_eq!(
|
16781 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17665 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16782 17666 | http_response.status()
|
16783 17667 | );
|
16784 17668 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16785 17669 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16786 17670 | http_response.headers(),
|
16787 17671 | expected_headers,
|
16788 17672 | ));
|
16789 17673 | }
|
16790 17674 | }
|
16791 17675 |
|
16792 17676 | /// Malformed values in query parameters should be rejected
|
16793 17677 | /// Test ID: RestJsonQueryShortMalformedValueRejected_case2
|
16794 17678 | #[::tokio::test]
|
16795 17679 | #[::tracing_test::traced_test]
|
16796 17680 | async fn rest_json_query_short_malformed_value_rejected_case2_malformed_request() {
|
16797 17681 | {
|
16798 17682 | #[allow(unused_mut)]
|
16799 - | let mut http_request = http::Request::builder()
|
17683 + | let mut http_request = ::http_1x::Request::builder()
|
16800 17684 | .uri("/MalformedShort/1")
|
16801 17685 | .method("POST")
|
16802 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17686 + | .body(::aws_smithy_http_server::body::boxed(
|
17687 + | ::http_body_util::Empty::new(),
|
17688 + | ))
|
16803 17689 | .unwrap();
|
16804 17690 | *http_request.uri_mut() = "/MalformedShort/1?shortInQuery=2ABC".parse().unwrap();
|
16805 17691 | #[allow(unused_mut)]
|
16806 17692 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16807 17693 | let config = crate::service::RestJsonConfig::builder().build();
|
16808 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17694 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16809 17695 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16810 17696 | let sender = sender.clone();
|
16811 17697 | async move {
|
16812 17698 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16813 17699 | sender.send(()).await.expect("receiver dropped early");
|
16814 17700 | result
|
16815 17701 | }
|
16816 17702 | })
|
16817 17703 | .build_unchecked();
|
16818 17704 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16819 17705 | .await
|
16820 17706 | .expect("unable to make an HTTP request");
|
16821 17707 | ::pretty_assertions::assert_eq!(
|
16822 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17708 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16823 17709 | http_response.status()
|
16824 17710 | );
|
16825 17711 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16826 17712 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16827 17713 | http_response.headers(),
|
16828 17714 | expected_headers,
|
16829 17715 | ));
|
16830 17716 | }
|
16831 17717 | }
|
16832 17718 |
|
16833 17719 | /// Malformed values in query parameters should be rejected
|
16834 17720 | /// Test ID: RestJsonQueryShortMalformedValueRejected_case3
|
16835 17721 | #[::tokio::test]
|
16836 17722 | #[::tracing_test::traced_test]
|
16837 17723 | async fn rest_json_query_short_malformed_value_rejected_case3_malformed_request() {
|
16838 17724 | {
|
16839 17725 | #[allow(unused_mut)]
|
16840 - | let mut http_request = http::Request::builder()
|
17726 + | let mut http_request = ::http_1x::Request::builder()
|
16841 17727 | .uri("/MalformedShort/1")
|
16842 17728 | .method("POST")
|
16843 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17729 + | .body(::aws_smithy_http_server::body::boxed(
|
17730 + | ::http_body_util::Empty::new(),
|
17731 + | ))
|
16844 17732 | .unwrap();
|
16845 17733 | *http_request.uri_mut() = "/MalformedShort/1?shortInQuery=0x42".parse().unwrap();
|
16846 17734 | #[allow(unused_mut)]
|
16847 17735 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16848 17736 | let config = crate::service::RestJsonConfig::builder().build();
|
16849 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17737 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16850 17738 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16851 17739 | let sender = sender.clone();
|
16852 17740 | async move {
|
16853 17741 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16854 17742 | sender.send(()).await.expect("receiver dropped early");
|
16855 17743 | result
|
16856 17744 | }
|
16857 17745 | })
|
16858 17746 | .build_unchecked();
|
16859 17747 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16860 17748 | .await
|
16861 17749 | .expect("unable to make an HTTP request");
|
16862 17750 | ::pretty_assertions::assert_eq!(
|
16863 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17751 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16864 17752 | http_response.status()
|
16865 17753 | );
|
16866 17754 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16867 17755 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16868 17756 | http_response.headers(),
|
16869 17757 | expected_headers,
|
16870 17758 | ));
|
16871 17759 | }
|
16872 17760 | }
|
16873 17761 |
|
16874 17762 | /// Malformed values in query parameters should be rejected
|
16875 17763 | /// Test ID: RestJsonQueryShortMalformedValueRejected_case4
|
16876 17764 | #[::tokio::test]
|
16877 17765 | #[::tracing_test::traced_test]
|
16878 17766 | async fn rest_json_query_short_malformed_value_rejected_case4_malformed_request() {
|
16879 17767 | {
|
16880 17768 | #[allow(unused_mut)]
|
16881 - | let mut http_request = http::Request::builder()
|
17769 + | let mut http_request = ::http_1x::Request::builder()
|
16882 17770 | .uri("/MalformedShort/1")
|
16883 17771 | .method("POST")
|
16884 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17772 + | .body(::aws_smithy_http_server::body::boxed(
|
17773 + | ::http_body_util::Empty::new(),
|
17774 + | ))
|
16885 17775 | .unwrap();
|
16886 17776 | *http_request.uri_mut() = "/MalformedShort/1?shortInQuery=Infinity".parse().unwrap();
|
16887 17777 | #[allow(unused_mut)]
|
16888 17778 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16889 17779 | let config = crate::service::RestJsonConfig::builder().build();
|
16890 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17780 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16891 17781 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16892 17782 | let sender = sender.clone();
|
16893 17783 | async move {
|
16894 17784 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16895 17785 | sender.send(()).await.expect("receiver dropped early");
|
16896 17786 | result
|
16897 17787 | }
|
16898 17788 | })
|
16899 17789 | .build_unchecked();
|
16900 17790 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16901 17791 | .await
|
16902 17792 | .expect("unable to make an HTTP request");
|
16903 17793 | ::pretty_assertions::assert_eq!(
|
16904 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17794 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16905 17795 | http_response.status()
|
16906 17796 | );
|
16907 17797 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16908 17798 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16909 17799 | http_response.headers(),
|
16910 17800 | expected_headers,
|
16911 17801 | ));
|
16912 17802 | }
|
16913 17803 | }
|
16914 17804 |
|
16915 17805 | /// Malformed values in query parameters should be rejected
|
16916 17806 | /// Test ID: RestJsonQueryShortMalformedValueRejected_case5
|
16917 17807 | #[::tokio::test]
|
16918 17808 | #[::tracing_test::traced_test]
|
16919 17809 | async fn rest_json_query_short_malformed_value_rejected_case5_malformed_request() {
|
16920 17810 | {
|
16921 17811 | #[allow(unused_mut)]
|
16922 - | let mut http_request = http::Request::builder()
|
17812 + | let mut http_request = ::http_1x::Request::builder()
|
16923 17813 | .uri("/MalformedShort/1")
|
16924 17814 | .method("POST")
|
16925 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17815 + | .body(::aws_smithy_http_server::body::boxed(
|
17816 + | ::http_body_util::Empty::new(),
|
17817 + | ))
|
16926 17818 | .unwrap();
|
16927 17819 | *http_request.uri_mut() = "/MalformedShort/1?shortInQuery=-Infinity".parse().unwrap();
|
16928 17820 | #[allow(unused_mut)]
|
16929 17821 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16930 17822 | let config = crate::service::RestJsonConfig::builder().build();
|
16931 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17823 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16932 17824 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16933 17825 | let sender = sender.clone();
|
16934 17826 | async move {
|
16935 17827 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16936 17828 | sender.send(()).await.expect("receiver dropped early");
|
16937 17829 | result
|
16938 17830 | }
|
16939 17831 | })
|
16940 17832 | .build_unchecked();
|
16941 17833 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16942 17834 | .await
|
16943 17835 | .expect("unable to make an HTTP request");
|
16944 17836 | ::pretty_assertions::assert_eq!(
|
16945 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17837 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16946 17838 | http_response.status()
|
16947 17839 | );
|
16948 17840 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16949 17841 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16950 17842 | http_response.headers(),
|
16951 17843 | expected_headers,
|
16952 17844 | ));
|
16953 17845 | }
|
16954 17846 | }
|
16955 17847 |
|
16956 17848 | /// Malformed values in query parameters should be rejected
|
16957 17849 | /// Test ID: RestJsonQueryShortMalformedValueRejected_case6
|
16958 17850 | #[::tokio::test]
|
16959 17851 | #[::tracing_test::traced_test]
|
16960 17852 | async fn rest_json_query_short_malformed_value_rejected_case6_malformed_request() {
|
16961 17853 | {
|
16962 17854 | #[allow(unused_mut)]
|
16963 - | let mut http_request = http::Request::builder()
|
17855 + | let mut http_request = ::http_1x::Request::builder()
|
16964 17856 | .uri("/MalformedShort/1")
|
16965 17857 | .method("POST")
|
16966 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17858 + | .body(::aws_smithy_http_server::body::boxed(
|
17859 + | ::http_body_util::Empty::new(),
|
17860 + | ))
|
16967 17861 | .unwrap();
|
16968 17862 | *http_request.uri_mut() = "/MalformedShort/1?shortInQuery=NaN".parse().unwrap();
|
16969 17863 | #[allow(unused_mut)]
|
16970 17864 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
16971 17865 | let config = crate::service::RestJsonConfig::builder().build();
|
16972 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17866 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
16973 17867 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
16974 17868 | let sender = sender.clone();
|
16975 17869 | async move {
|
16976 17870 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
16977 17871 | sender.send(()).await.expect("receiver dropped early");
|
16978 17872 | result
|
16979 17873 | }
|
16980 17874 | })
|
16981 17875 | .build_unchecked();
|
16982 17876 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
16983 17877 | .await
|
16984 17878 | .expect("unable to make an HTTP request");
|
16985 17879 | ::pretty_assertions::assert_eq!(
|
16986 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17880 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
16987 17881 | http_response.status()
|
16988 17882 | );
|
16989 17883 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
16990 17884 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
16991 17885 | http_response.headers(),
|
16992 17886 | expected_headers,
|
16993 17887 | ));
|
16994 17888 | }
|
16995 17889 | }
|
16996 17890 |
|
16997 17891 | /// Malformed values in headers should be rejected
|
16998 17892 | /// Test ID: RestJsonHeaderShortMalformedValueRejected_case0
|
16999 17893 | #[::tokio::test]
|
17000 17894 | #[::tracing_test::traced_test]
|
17001 17895 | async fn rest_json_header_short_malformed_value_rejected_case0_malformed_request() {
|
17002 17896 | {
|
17003 17897 | #[allow(unused_mut)]
|
17004 - | let mut http_request = http::Request::builder()
|
17898 + | let mut http_request = ::http_1x::Request::builder()
|
17005 17899 | .uri("/MalformedShort/1")
|
17006 17900 | .method("POST")
|
17007 17901 | .header("shortInHeader", "true")
|
17008 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17902 + | .body(::aws_smithy_http_server::body::boxed(
|
17903 + | ::http_body_util::Empty::new(),
|
17904 + | ))
|
17009 17905 | .unwrap();
|
17010 17906 | #[allow(unused_mut)]
|
17011 17907 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17012 17908 | let config = crate::service::RestJsonConfig::builder().build();
|
17013 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17909 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17014 17910 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
17015 17911 | let sender = sender.clone();
|
17016 17912 | async move {
|
17017 17913 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
17018 17914 | sender.send(()).await.expect("receiver dropped early");
|
17019 17915 | result
|
17020 17916 | }
|
17021 17917 | })
|
17022 17918 | .build_unchecked();
|
17023 17919 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17024 17920 | .await
|
17025 17921 | .expect("unable to make an HTTP request");
|
17026 17922 | ::pretty_assertions::assert_eq!(
|
17027 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17923 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17028 17924 | http_response.status()
|
17029 17925 | );
|
17030 17926 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17031 17927 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17032 17928 | http_response.headers(),
|
17033 17929 | expected_headers,
|
17034 17930 | ));
|
17035 17931 | }
|
17036 17932 | }
|
17037 17933 |
|
17038 17934 | /// Malformed values in headers should be rejected
|
17039 17935 | /// Test ID: RestJsonHeaderShortMalformedValueRejected_case1
|
17040 17936 | #[::tokio::test]
|
17041 17937 | #[::tracing_test::traced_test]
|
17042 17938 | async fn rest_json_header_short_malformed_value_rejected_case1_malformed_request() {
|
17043 17939 | {
|
17044 17940 | #[allow(unused_mut)]
|
17045 - | let mut http_request = http::Request::builder()
|
17941 + | let mut http_request = ::http_1x::Request::builder()
|
17046 17942 | .uri("/MalformedShort/1")
|
17047 17943 | .method("POST")
|
17048 17944 | .header("shortInHeader", "1.001")
|
17049 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17945 + | .body(::aws_smithy_http_server::body::boxed(
|
17946 + | ::http_body_util::Empty::new(),
|
17947 + | ))
|
17050 17948 | .unwrap();
|
17051 17949 | #[allow(unused_mut)]
|
17052 17950 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17053 17951 | let config = crate::service::RestJsonConfig::builder().build();
|
17054 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17952 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17055 17953 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
17056 17954 | let sender = sender.clone();
|
17057 17955 | async move {
|
17058 17956 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
17059 17957 | sender.send(()).await.expect("receiver dropped early");
|
17060 17958 | result
|
17061 17959 | }
|
17062 17960 | })
|
17063 17961 | .build_unchecked();
|
17064 17962 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17065 17963 | .await
|
17066 17964 | .expect("unable to make an HTTP request");
|
17067 17965 | ::pretty_assertions::assert_eq!(
|
17068 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17966 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17069 17967 | http_response.status()
|
17070 17968 | );
|
17071 17969 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17072 17970 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17073 17971 | http_response.headers(),
|
17074 17972 | expected_headers,
|
17075 17973 | ));
|
17076 17974 | }
|
17077 17975 | }
|
17078 17976 |
|
17079 17977 | /// Malformed values in headers should be rejected
|
17080 17978 | /// Test ID: RestJsonHeaderShortMalformedValueRejected_case2
|
17081 17979 | #[::tokio::test]
|
17082 17980 | #[::tracing_test::traced_test]
|
17083 17981 | async fn rest_json_header_short_malformed_value_rejected_case2_malformed_request() {
|
17084 17982 | {
|
17085 17983 | #[allow(unused_mut)]
|
17086 - | let mut http_request = http::Request::builder()
|
17984 + | let mut http_request = ::http_1x::Request::builder()
|
17087 17985 | .uri("/MalformedShort/1")
|
17088 17986 | .method("POST")
|
17089 17987 | .header("shortInHeader", "2ABC")
|
17090 - | .body(::aws_smithy_http_server::body::Body::empty())
|
17988 + | .body(::aws_smithy_http_server::body::boxed(
|
17989 + | ::http_body_util::Empty::new(),
|
17990 + | ))
|
17091 17991 | .unwrap();
|
17092 17992 | #[allow(unused_mut)]
|
17093 17993 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17094 17994 | let config = crate::service::RestJsonConfig::builder().build();
|
17095 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
17995 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17096 17996 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
17097 17997 | let sender = sender.clone();
|
17098 17998 | async move {
|
17099 17999 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
17100 18000 | sender.send(()).await.expect("receiver dropped early");
|
17101 18001 | result
|
17102 18002 | }
|
17103 18003 | })
|
17104 18004 | .build_unchecked();
|
17105 18005 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17106 18006 | .await
|
17107 18007 | .expect("unable to make an HTTP request");
|
17108 18008 | ::pretty_assertions::assert_eq!(
|
17109 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18009 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17110 18010 | http_response.status()
|
17111 18011 | );
|
17112 18012 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17113 18013 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17114 18014 | http_response.headers(),
|
17115 18015 | expected_headers,
|
17116 18016 | ));
|
17117 18017 | }
|
17118 18018 | }
|
17119 18019 |
|
17120 18020 | /// Malformed values in headers should be rejected
|
17121 18021 | /// Test ID: RestJsonHeaderShortMalformedValueRejected_case3
|
17122 18022 | #[::tokio::test]
|
17123 18023 | #[::tracing_test::traced_test]
|
17124 18024 | async fn rest_json_header_short_malformed_value_rejected_case3_malformed_request() {
|
17125 18025 | {
|
17126 18026 | #[allow(unused_mut)]
|
17127 - | let mut http_request = http::Request::builder()
|
18027 + | let mut http_request = ::http_1x::Request::builder()
|
17128 18028 | .uri("/MalformedShort/1")
|
17129 18029 | .method("POST")
|
17130 18030 | .header("shortInHeader", "0x42")
|
17131 - | .body(::aws_smithy_http_server::body::Body::empty())
|
18031 + | .body(::aws_smithy_http_server::body::boxed(
|
18032 + | ::http_body_util::Empty::new(),
|
18033 + | ))
|
17132 18034 | .unwrap();
|
17133 18035 | #[allow(unused_mut)]
|
17134 18036 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17135 18037 | let config = crate::service::RestJsonConfig::builder().build();
|
17136 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18038 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17137 18039 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
17138 18040 | let sender = sender.clone();
|
17139 18041 | async move {
|
17140 18042 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
17141 18043 | sender.send(()).await.expect("receiver dropped early");
|
17142 18044 | result
|
17143 18045 | }
|
17144 18046 | })
|
17145 18047 | .build_unchecked();
|
17146 18048 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17147 18049 | .await
|
17148 18050 | .expect("unable to make an HTTP request");
|
17149 18051 | ::pretty_assertions::assert_eq!(
|
17150 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18052 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17151 18053 | http_response.status()
|
17152 18054 | );
|
17153 18055 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17154 18056 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17155 18057 | http_response.headers(),
|
17156 18058 | expected_headers,
|
17157 18059 | ));
|
17158 18060 | }
|
17159 18061 | }
|
17160 18062 |
|
17161 18063 | /// Malformed values in headers should be rejected
|
17162 18064 | /// Test ID: RestJsonHeaderShortMalformedValueRejected_case4
|
17163 18065 | #[::tokio::test]
|
17164 18066 | #[::tracing_test::traced_test]
|
17165 18067 | async fn rest_json_header_short_malformed_value_rejected_case4_malformed_request() {
|
17166 18068 | {
|
17167 18069 | #[allow(unused_mut)]
|
17168 - | let mut http_request = http::Request::builder()
|
18070 + | let mut http_request = ::http_1x::Request::builder()
|
17169 18071 | .uri("/MalformedShort/1")
|
17170 18072 | .method("POST")
|
17171 18073 | .header("shortInHeader", "Infinity")
|
17172 - | .body(::aws_smithy_http_server::body::Body::empty())
|
18074 + | .body(::aws_smithy_http_server::body::boxed(
|
18075 + | ::http_body_util::Empty::new(),
|
18076 + | ))
|
17173 18077 | .unwrap();
|
17174 18078 | #[allow(unused_mut)]
|
17175 18079 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17176 18080 | let config = crate::service::RestJsonConfig::builder().build();
|
17177 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18081 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17178 18082 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
17179 18083 | let sender = sender.clone();
|
17180 18084 | async move {
|
17181 18085 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
17182 18086 | sender.send(()).await.expect("receiver dropped early");
|
17183 18087 | result
|
17184 18088 | }
|
17185 18089 | })
|
17186 18090 | .build_unchecked();
|
17187 18091 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17188 18092 | .await
|
17189 18093 | .expect("unable to make an HTTP request");
|
17190 18094 | ::pretty_assertions::assert_eq!(
|
17191 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18095 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17192 18096 | http_response.status()
|
17193 18097 | );
|
17194 18098 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17195 18099 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17196 18100 | http_response.headers(),
|
17197 18101 | expected_headers,
|
17198 18102 | ));
|
17199 18103 | }
|
17200 18104 | }
|
17201 18105 |
|
17202 18106 | /// Malformed values in headers should be rejected
|
17203 18107 | /// Test ID: RestJsonHeaderShortMalformedValueRejected_case5
|
17204 18108 | #[::tokio::test]
|
17205 18109 | #[::tracing_test::traced_test]
|
17206 18110 | async fn rest_json_header_short_malformed_value_rejected_case5_malformed_request() {
|
17207 18111 | {
|
17208 18112 | #[allow(unused_mut)]
|
17209 - | let mut http_request = http::Request::builder()
|
18113 + | let mut http_request = ::http_1x::Request::builder()
|
17210 18114 | .uri("/MalformedShort/1")
|
17211 18115 | .method("POST")
|
17212 18116 | .header("shortInHeader", "-Infinity")
|
17213 - | .body(::aws_smithy_http_server::body::Body::empty())
|
18117 + | .body(::aws_smithy_http_server::body::boxed(
|
18118 + | ::http_body_util::Empty::new(),
|
18119 + | ))
|
17214 18120 | .unwrap();
|
17215 18121 | #[allow(unused_mut)]
|
17216 18122 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17217 18123 | let config = crate::service::RestJsonConfig::builder().build();
|
17218 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18124 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17219 18125 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
17220 18126 | let sender = sender.clone();
|
17221 18127 | async move {
|
17222 18128 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
17223 18129 | sender.send(()).await.expect("receiver dropped early");
|
17224 18130 | result
|
17225 18131 | }
|
17226 18132 | })
|
17227 18133 | .build_unchecked();
|
17228 18134 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17229 18135 | .await
|
17230 18136 | .expect("unable to make an HTTP request");
|
17231 18137 | ::pretty_assertions::assert_eq!(
|
17232 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18138 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17233 18139 | http_response.status()
|
17234 18140 | );
|
17235 18141 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17236 18142 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17237 18143 | http_response.headers(),
|
17238 18144 | expected_headers,
|
17239 18145 | ));
|
17240 18146 | }
|
17241 18147 | }
|
17242 18148 |
|
17243 18149 | /// Malformed values in headers should be rejected
|
17244 18150 | /// Test ID: RestJsonHeaderShortMalformedValueRejected_case6
|
17245 18151 | #[::tokio::test]
|
17246 18152 | #[::tracing_test::traced_test]
|
17247 18153 | async fn rest_json_header_short_malformed_value_rejected_case6_malformed_request() {
|
17248 18154 | {
|
17249 18155 | #[allow(unused_mut)]
|
17250 - | let mut http_request = http::Request::builder()
|
18156 + | let mut http_request = ::http_1x::Request::builder()
|
17251 18157 | .uri("/MalformedShort/1")
|
17252 18158 | .method("POST")
|
17253 18159 | .header("shortInHeader", "NaN")
|
17254 - | .body(::aws_smithy_http_server::body::Body::empty())
|
18160 + | .body(::aws_smithy_http_server::body::boxed(
|
18161 + | ::http_body_util::Empty::new(),
|
18162 + | ))
|
17255 18163 | .unwrap();
|
17256 18164 | #[allow(unused_mut)]
|
17257 18165 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17258 18166 | let config = crate::service::RestJsonConfig::builder().build();
|
17259 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18167 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17260 18168 | .malformed_short(move |input: crate::input::MalformedShortInput| {
|
17261 18169 | let sender = sender.clone();
|
17262 18170 | async move {
|
17263 18171 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedShortOutput, crate::error::MalformedShortError> };
|
17264 18172 | sender.send(()).await.expect("receiver dropped early");
|
17265 18173 | result
|
17266 18174 | }
|
17267 18175 | })
|
17268 18176 | .build_unchecked();
|
17269 18177 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17270 18178 | .await
|
17271 18179 | .expect("unable to make an HTTP request");
|
17272 18180 | ::pretty_assertions::assert_eq!(
|
17273 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18181 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17274 18182 | http_response.status()
|
17275 18183 | );
|
17276 18184 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17277 18185 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17278 18186 | http_response.headers(),
|
17279 18187 | expected_headers,
|
17280 18188 | ));
|
17281 18189 | }
|
17282 18190 | }
|
18191 + |
|
18192 + | /* ProtocolTestGenerator.kt:98 */
|
17283 18193 | }
|
17284 18194 |
|
18195 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
17285 18196 | ::pin_project_lite::pin_project! {
|
17286 18197 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
17287 18198 | /// [`MalformedByteInput`](crate::input::MalformedByteInput) using modelled bindings.
|
17288 18199 | pub struct MalformedByteInputFuture {
|
17289 18200 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedByteInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
17290 18201 | }
|
17291 18202 | }
|
17292 18203 |
|
17293 18204 | impl std::future::Future for MalformedByteInputFuture {
|
17294 18205 | type Output = Result<
|
17295 18206 | crate::input::MalformedByteInput,
|
17296 18207 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
17297 18208 | >;
|
17298 18209 |
|
17299 18210 | fn poll(
|
17300 18211 | self: std::pin::Pin<&mut Self>,
|
17301 18212 | cx: &mut std::task::Context<'_>,
|
17302 18213 | ) -> std::task::Poll<Self::Output> {
|
17303 18214 | let this = self.project();
|
17304 18215 | this.inner.as_mut().poll(cx)
|
17305 18216 | }
|
17306 18217 | }
|
17307 18218 |
|
17308 18219 | impl<B>
|
17309 18220 | ::aws_smithy_http_server::request::FromRequest<
|
17310 18221 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
17311 18222 | B,
|
17312 18223 | > for crate::input::MalformedByteInput
|
17313 18224 | where
|
17314 18225 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
17315 18226 | B: 'static,
|
17316 18227 |
|
17317 18228 | B::Data: Send,
|
17318 18229 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
17319 18230 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
17320 18231 | {
|
17321 18232 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
17322 18233 | type Future = MalformedByteInputFuture;
|
17323 18234 |
|
17324 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
18235 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
17325 18236 | let fut = async move {
|
17326 18237 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
17327 18238 | request.headers(),
|
17328 18239 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
17329 18240 | ) {
|
17330 18241 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
17331 18242 | }
|
17332 18243 | crate::protocol_serde::shape_malformed_byte::de_malformed_byte_http_request(request)
|
17333 18244 | .await
|
17334 18245 | };
|
17335 18246 | use ::futures_util::future::TryFutureExt;
|
17336 18247 | let fut = fut.map_err(
|
17337 18248 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
17338 18249 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
17339 18250 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
17340 18251 | e,
|
17341 18252 | )
|
17342 18253 | },
|
17343 18254 | );
|
17344 18255 | MalformedByteInputFuture {
|
17345 18256 | inner: Box::pin(fut),
|
17346 18257 | }
|
17347 18258 | }
|
17348 18259 | }
|
18260 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
17349 18261 | impl
|
17350 18262 | ::aws_smithy_http_server::response::IntoResponse<
|
17351 18263 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
17352 18264 | > for crate::output::MalformedByteOutput
|
17353 18265 | {
|
17354 18266 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
17355 18267 | match crate::protocol_serde::shape_malformed_byte::ser_malformed_byte_http_response(self) {
|
17356 18268 | Ok(response) => response,
|
17357 18269 | Err(e) => {
|
17358 18270 | ::tracing::error!(error = %e, "failed to serialize response");
|
17359 18271 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
17360 18272 | }
|
17361 18273 | }
|
17362 18274 | }
|
17363 18275 | }
|
18276 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
17364 18277 | impl
|
17365 18278 | ::aws_smithy_http_server::response::IntoResponse<
|
17366 18279 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
17367 18280 | > for crate::error::MalformedByteError
|
17368 18281 | {
|
17369 18282 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
17370 18283 | match crate::protocol_serde::shape_malformed_byte::ser_malformed_byte_http_error(&self) {
|
17371 18284 | Ok(mut response) => {
|
17372 18285 | response.extensions_mut().insert(
|
17373 18286 | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
17374 18287 | );
|
17375 18288 | response
|
17376 18289 | }
|
17377 18290 | Err(e) => {
|
17378 18291 | ::tracing::error!(error = %e, "failed to serialize response");
|
17379 18292 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
17380 18293 | }
|
17381 18294 | }
|
17382 18295 | }
|
17383 18296 | }
|
17384 18297 |
|
18298 + | /* RustType.kt:534 */
|
17385 18299 | #[allow(unreachable_code, unused_variables)]
|
18300 + | /* RustType.kt:534 */
|
17386 18301 | #[cfg(test)]
|
18302 + | /* ProtocolTestGenerator.kt:98 */
|
17387 18303 | mod malformed_byte_test {
|
17388 18304 |
|
17389 18305 | /// Underflow or overflow should result in SerializationException
|
17390 18306 | /// Test ID: RestJsonBodyByteUnderflowOverflow_case0
|
17391 18307 | #[::tokio::test]
|
17392 18308 | #[::tracing_test::traced_test]
|
17393 18309 | async fn rest_json_body_byte_underflow_overflow_case0_malformed_request() {
|
17394 18310 | {
|
17395 18311 | #[allow(unused_mut)]
|
17396 - | let mut http_request = http::Request::builder()
|
18312 + | let mut http_request = ::http_1x::Request::builder()
|
17397 18313 | .uri("/MalformedByte/1")
|
17398 18314 | .method("POST")
|
17399 18315 | .header("content-type", "application/json")
|
17400 - | .body(::aws_smithy_http_server::body::Body::from(
|
17401 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
17402 - | "{ \"byteInBody\" : 256 }".as_bytes(),
|
17403 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
18316 + | .body(::aws_smithy_http_server::body::boxed(
|
18317 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
18318 + | &::aws_smithy_protocol_test::decode_body_data(
|
18319 + | "{ \"byteInBody\" : 256 }".as_bytes(),
|
18320 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
18321 + | ),
|
17404 18322 | )),
|
17405 18323 | ))
|
17406 18324 | .unwrap();
|
17407 18325 | #[allow(unused_mut)]
|
17408 18326 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17409 18327 | let config = crate::service::RestJsonConfig::builder().build();
|
17410 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18328 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17411 18329 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
17412 18330 | let sender = sender.clone();
|
17413 18331 | async move {
|
17414 18332 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
17415 18333 | sender.send(()).await.expect("receiver dropped early");
|
17416 18334 | result
|
17417 18335 | }
|
17418 18336 | })
|
17419 18337 | .build_unchecked();
|
17420 18338 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17421 18339 | .await
|
17422 18340 | .expect("unable to make an HTTP request");
|
17423 18341 | ::pretty_assertions::assert_eq!(
|
17424 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18342 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17425 18343 | http_response.status()
|
17426 18344 | );
|
17427 18345 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17428 18346 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17429 18347 | http_response.headers(),
|
17430 18348 | expected_headers,
|
17431 18349 | ));
|
17432 18350 | }
|
17433 18351 | }
|
17434 18352 |
|
17435 18353 | /// Underflow or overflow should result in SerializationException
|
17436 18354 | /// Test ID: RestJsonBodyByteUnderflowOverflow_case1
|
17437 18355 | #[::tokio::test]
|
17438 18356 | #[::tracing_test::traced_test]
|
17439 18357 | async fn rest_json_body_byte_underflow_overflow_case1_malformed_request() {
|
17440 18358 | {
|
17441 18359 | #[allow(unused_mut)]
|
17442 - | let mut http_request = http::Request::builder()
|
18360 + | let mut http_request = ::http_1x::Request::builder()
|
17443 18361 | .uri("/MalformedByte/1")
|
17444 18362 | .method("POST")
|
17445 18363 | .header("content-type", "application/json")
|
17446 - | .body(::aws_smithy_http_server::body::Body::from(
|
17447 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
17448 - | "{ \"byteInBody\" : -256 }".as_bytes(),
|
17449 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
18364 + | .body(::aws_smithy_http_server::body::boxed(
|
18365 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
18366 + | &::aws_smithy_protocol_test::decode_body_data(
|
18367 + | "{ \"byteInBody\" : -256 }".as_bytes(),
|
18368 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
18369 + | ),
|
17450 18370 | )),
|
17451 18371 | ))
|
17452 18372 | .unwrap();
|
17453 18373 | #[allow(unused_mut)]
|
17454 18374 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17455 18375 | let config = crate::service::RestJsonConfig::builder().build();
|
17456 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18376 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17457 18377 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
17458 18378 | let sender = sender.clone();
|
17459 18379 | async move {
|
17460 18380 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
17461 18381 | sender.send(()).await.expect("receiver dropped early");
|
17462 18382 | result
|
17463 18383 | }
|
17464 18384 | })
|
17465 18385 | .build_unchecked();
|
17466 18386 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17467 18387 | .await
|
17468 18388 | .expect("unable to make an HTTP request");
|
17469 18389 | ::pretty_assertions::assert_eq!(
|
17470 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18390 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17471 18391 | http_response.status()
|
17472 18392 | );
|
17473 18393 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17474 18394 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17475 18395 | http_response.headers(),
|
17476 18396 | expected_headers,
|
17477 18397 | ));
|
17478 18398 | }
|
17479 18399 | }
|
17480 18400 |
|
17481 18401 | /// Underflow or overflow should result in SerializationException
|
17482 18402 | /// Test ID: RestJsonBodyByteUnderflowOverflow_case2
|
17483 18403 | #[::tokio::test]
|
17484 18404 | #[::tracing_test::traced_test]
|
17485 18405 | async fn rest_json_body_byte_underflow_overflow_case2_malformed_request() {
|
17486 18406 | {
|
17487 18407 | #[allow(unused_mut)]
|
17488 - | let mut http_request = http::Request::builder()
|
18408 + | let mut http_request = ::http_1x::Request::builder()
|
17489 18409 | .uri("/MalformedByte/1")
|
17490 18410 | .method("POST")
|
17491 18411 | .header("content-type", "application/json")
|
17492 - | .body(::aws_smithy_http_server::body::Body::from(
|
17493 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
17494 - | "{ \"byteInBody\" : -9223372000000000000 }".as_bytes(),
|
17495 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
18412 + | .body(::aws_smithy_http_server::body::boxed(
|
18413 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
18414 + | &::aws_smithy_protocol_test::decode_body_data(
|
18415 + | "{ \"byteInBody\" : -9223372000000000000 }".as_bytes(),
|
18416 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
18417 + | ),
|
17496 18418 | )),
|
17497 18419 | ))
|
17498 18420 | .unwrap();
|
17499 18421 | #[allow(unused_mut)]
|
17500 18422 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17501 18423 | let config = crate::service::RestJsonConfig::builder().build();
|
17502 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18424 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17503 18425 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
17504 18426 | let sender = sender.clone();
|
17505 18427 | async move {
|
17506 18428 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
17507 18429 | sender.send(()).await.expect("receiver dropped early");
|
17508 18430 | result
|
17509 18431 | }
|
17510 18432 | })
|
17511 18433 | .build_unchecked();
|
17512 18434 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17513 18435 | .await
|
17514 18436 | .expect("unable to make an HTTP request");
|
17515 18437 | ::pretty_assertions::assert_eq!(
|
17516 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18438 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17517 18439 | http_response.status()
|
17518 18440 | );
|
17519 18441 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17520 18442 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17521 18443 | http_response.headers(),
|
17522 18444 | expected_headers,
|
17523 18445 | ));
|
17524 18446 | }
|
17525 18447 | }
|
17526 18448 |
|
17527 18449 | /// Underflow or overflow should result in SerializationException
|
17528 18450 | /// Test ID: RestJsonBodyByteUnderflowOverflow_case3
|
17529 18451 | #[::tokio::test]
|
17530 18452 | #[::tracing_test::traced_test]
|
17531 18453 | async fn rest_json_body_byte_underflow_overflow_case3_malformed_request() {
|
17532 18454 | {
|
17533 18455 | #[allow(unused_mut)]
|
17534 - | let mut http_request = http::Request::builder()
|
18456 + | let mut http_request = ::http_1x::Request::builder()
|
17535 18457 | .uri("/MalformedByte/1")
|
17536 18458 | .method("POST")
|
17537 18459 | .header("content-type", "application/json")
|
17538 - | .body(::aws_smithy_http_server::body::Body::from(
|
17539 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
17540 - | "{ \"byteInBody\" : 9223372000000000000 }".as_bytes(),
|
17541 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
18460 + | .body(::aws_smithy_http_server::body::boxed(
|
18461 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
18462 + | &::aws_smithy_protocol_test::decode_body_data(
|
18463 + | "{ \"byteInBody\" : 9223372000000000000 }".as_bytes(),
|
18464 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
18465 + | ),
|
17542 18466 | )),
|
17543 18467 | ))
|
17544 18468 | .unwrap();
|
17545 18469 | #[allow(unused_mut)]
|
17546 18470 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17547 18471 | let config = crate::service::RestJsonConfig::builder().build();
|
17548 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18472 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17549 18473 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
17550 18474 | let sender = sender.clone();
|
17551 18475 | async move {
|
17552 18476 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
17553 18477 | sender.send(()).await.expect("receiver dropped early");
|
17554 18478 | result
|
17555 18479 | }
|
17556 18480 | })
|
17557 18481 | .build_unchecked();
|
17558 18482 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17559 18483 | .await
|
17560 18484 | .expect("unable to make an HTTP request");
|
17561 18485 | ::pretty_assertions::assert_eq!(
|
17562 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18486 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17563 18487 | http_response.status()
|
17564 18488 | );
|
17565 18489 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17566 18490 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17567 18491 | http_response.headers(),
|
17568 18492 | expected_headers,
|
17569 18493 | ));
|
17570 18494 | }
|
17571 18495 | }
|
17572 18496 |
|
17573 18497 | /// Underflow or overflow should result in SerializationException
|
17574 18498 | /// Test ID: RestJsonBodyByteUnderflowOverflow_case4
|
17575 18499 | #[::tokio::test]
|
17576 18500 | #[::tracing_test::traced_test]
|
17577 18501 | async fn rest_json_body_byte_underflow_overflow_case4_malformed_request() {
|
17578 18502 | {
|
17579 18503 | #[allow(unused_mut)]
|
17580 - | let mut http_request = http::Request::builder()
|
18504 + | let mut http_request = ::http_1x::Request::builder()
|
17581 18505 | .uri("/MalformedByte/1")
|
17582 18506 | .method("POST")
|
17583 18507 | .header("content-type", "application/json")
|
17584 - | .body(::aws_smithy_http_server::body::Body::from(
|
17585 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
17586 - | "{ \"byteInBody\" : 123000000000000000000000 }".as_bytes(),
|
17587 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
18508 + | .body(::aws_smithy_http_server::body::boxed(
|
18509 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
18510 + | &::aws_smithy_protocol_test::decode_body_data(
|
18511 + | "{ \"byteInBody\" : 123000000000000000000000 }".as_bytes(),
|
18512 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
18513 + | ),
|
17588 18514 | )),
|
17589 18515 | ))
|
17590 18516 | .unwrap();
|
17591 18517 | #[allow(unused_mut)]
|
17592 18518 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17593 18519 | let config = crate::service::RestJsonConfig::builder().build();
|
17594 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18520 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17595 18521 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
17596 18522 | let sender = sender.clone();
|
17597 18523 | async move {
|
17598 18524 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
17599 18525 | sender.send(()).await.expect("receiver dropped early");
|
17600 18526 | result
|
17601 18527 | }
|
17602 18528 | })
|
17603 18529 | .build_unchecked();
|
17604 18530 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17605 18531 | .await
|
17606 18532 | .expect("unable to make an HTTP request");
|
17607 18533 | ::pretty_assertions::assert_eq!(
|
17608 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18534 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17609 18535 | http_response.status()
|
17610 18536 | );
|
17611 18537 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17612 18538 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17613 18539 | http_response.headers(),
|
17614 18540 | expected_headers,
|
17615 18541 | ));
|
17616 18542 | }
|
17617 18543 | }
|
17618 18544 |
|
17619 18545 | /// Underflow or overflow should result in SerializationException
|
17620 18546 | /// Test ID: RestJsonPathByteUnderflowOverflow_case0
|
17621 18547 | #[::tokio::test]
|
17622 18548 | #[::tracing_test::traced_test]
|
17623 18549 | async fn rest_json_path_byte_underflow_overflow_case0_malformed_request() {
|
17624 18550 | {
|
17625 18551 | #[allow(unused_mut)]
|
17626 - | let mut http_request = http::Request::builder()
|
18552 + | let mut http_request = ::http_1x::Request::builder()
|
17627 18553 | .uri("/MalformedByte/256")
|
17628 18554 | .method("POST")
|
17629 - | .body(::aws_smithy_http_server::body::Body::empty())
|
18555 + | .body(::aws_smithy_http_server::body::boxed(
|
18556 + | ::http_body_util::Empty::new(),
|
18557 + | ))
|
17630 18558 | .unwrap();
|
17631 18559 | #[allow(unused_mut)]
|
17632 18560 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17633 18561 | let config = crate::service::RestJsonConfig::builder().build();
|
17634 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18562 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17635 18563 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
17636 18564 | let sender = sender.clone();
|
17637 18565 | async move {
|
17638 18566 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
17639 18567 | sender.send(()).await.expect("receiver dropped early");
|
17640 18568 | result
|
17641 18569 | }
|
17642 18570 | })
|
17643 18571 | .build_unchecked();
|
17644 18572 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17645 18573 | .await
|
17646 18574 | .expect("unable to make an HTTP request");
|
17647 18575 | ::pretty_assertions::assert_eq!(
|
17648 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18576 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17649 18577 | http_response.status()
|
17650 18578 | );
|
17651 18579 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17652 18580 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17653 18581 | http_response.headers(),
|
17654 18582 | expected_headers,
|
17655 18583 | ));
|
17656 18584 | }
|
17657 18585 | }
|
17658 18586 |
|
17659 18587 | /// Underflow or overflow should result in SerializationException
|
17660 18588 | /// Test ID: RestJsonPathByteUnderflowOverflow_case1
|
17661 18589 | #[::tokio::test]
|
17662 18590 | #[::tracing_test::traced_test]
|
17663 18591 | async fn rest_json_path_byte_underflow_overflow_case1_malformed_request() {
|
17664 18592 | {
|
17665 18593 | #[allow(unused_mut)]
|
17666 - | let mut http_request = http::Request::builder()
|
18594 + | let mut http_request = ::http_1x::Request::builder()
|
17667 18595 | .uri("/MalformedByte/-256")
|
17668 18596 | .method("POST")
|
17669 - | .body(::aws_smithy_http_server::body::Body::empty())
|
18597 + | .body(::aws_smithy_http_server::body::boxed(
|
18598 + | ::http_body_util::Empty::new(),
|
18599 + | ))
|
17670 18600 | .unwrap();
|
17671 18601 | #[allow(unused_mut)]
|
17672 18602 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17673 18603 | let config = crate::service::RestJsonConfig::builder().build();
|
17674 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18604 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17675 18605 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
17676 18606 | let sender = sender.clone();
|
17677 18607 | async move {
|
17678 18608 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
17679 18609 | sender.send(()).await.expect("receiver dropped early");
|
17680 18610 | result
|
17681 18611 | }
|
17682 18612 | })
|
17683 18613 | .build_unchecked();
|
17684 18614 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17685 18615 | .await
|
17686 18616 | .expect("unable to make an HTTP request");
|
17687 18617 | ::pretty_assertions::assert_eq!(
|
17688 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18618 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17689 18619 | http_response.status()
|
17690 18620 | );
|
17691 18621 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17692 18622 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17693 18623 | http_response.headers(),
|
17694 18624 | expected_headers,
|
17695 18625 | ));
|
17696 18626 | }
|
17697 18627 | }
|
17698 18628 |
|
17699 18629 | /// Underflow or overflow should result in SerializationException
|
17700 18630 | /// Test ID: RestJsonPathByteUnderflowOverflow_case2
|
17701 18631 | #[::tokio::test]
|
17702 18632 | #[::tracing_test::traced_test]
|
17703 18633 | async fn rest_json_path_byte_underflow_overflow_case2_malformed_request() {
|
17704 18634 | {
|
17705 18635 | #[allow(unused_mut)]
|
17706 - | let mut http_request = http::Request::builder()
|
18636 + | let mut http_request = ::http_1x::Request::builder()
|
17707 18637 | .uri("/MalformedByte/-9223372000000000000")
|
17708 18638 | .method("POST")
|
17709 - | .body(::aws_smithy_http_server::body::Body::empty())
|
18639 + | .body(::aws_smithy_http_server::body::boxed(
|
18640 + | ::http_body_util::Empty::new(),
|
18641 + | ))
|
17710 18642 | .unwrap();
|
17711 18643 | #[allow(unused_mut)]
|
17712 18644 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17713 18645 | let config = crate::service::RestJsonConfig::builder().build();
|
17714 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18646 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17715 18647 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
17716 18648 | let sender = sender.clone();
|
17717 18649 | async move {
|
17718 18650 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
17719 18651 | sender.send(()).await.expect("receiver dropped early");
|
17720 18652 | result
|
17721 18653 | }
|
17722 18654 | })
|
17723 18655 | .build_unchecked();
|
17724 18656 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17725 18657 | .await
|
17726 18658 | .expect("unable to make an HTTP request");
|
17727 18659 | ::pretty_assertions::assert_eq!(
|
17728 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18660 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17729 18661 | http_response.status()
|
17730 18662 | );
|
17731 18663 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17732 18664 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17733 18665 | http_response.headers(),
|
17734 18666 | expected_headers,
|
17735 18667 | ));
|
17736 18668 | }
|
17737 18669 | }
|
17738 18670 |
|
17739 18671 | /// Underflow or overflow should result in SerializationException
|
17740 18672 | /// Test ID: RestJsonPathByteUnderflowOverflow_case3
|
17741 18673 | #[::tokio::test]
|
17742 18674 | #[::tracing_test::traced_test]
|
17743 18675 | async fn rest_json_path_byte_underflow_overflow_case3_malformed_request() {
|
17744 18676 | {
|
17745 18677 | #[allow(unused_mut)]
|
17746 - | let mut http_request = http::Request::builder()
|
18678 + | let mut http_request = ::http_1x::Request::builder()
|
17747 18679 | .uri("/MalformedByte/9223372000000000000")
|
17748 18680 | .method("POST")
|
17749 - | .body(::aws_smithy_http_server::body::Body::empty())
|
18681 + | .body(::aws_smithy_http_server::body::boxed(
|
18682 + | ::http_body_util::Empty::new(),
|
18683 + | ))
|
17750 18684 | .unwrap();
|
17751 18685 | #[allow(unused_mut)]
|
17752 18686 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17753 18687 | let config = crate::service::RestJsonConfig::builder().build();
|
17754 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18688 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17755 18689 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
17756 18690 | let sender = sender.clone();
|
17757 18691 | async move {
|
17758 18692 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
17759 18693 | sender.send(()).await.expect("receiver dropped early");
|
17760 18694 | result
|
17761 18695 | }
|
17762 18696 | })
|
17763 18697 | .build_unchecked();
|
17764 18698 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17765 18699 | .await
|
17766 18700 | .expect("unable to make an HTTP request");
|
17767 18701 | ::pretty_assertions::assert_eq!(
|
17768 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18702 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17769 18703 | http_response.status()
|
17770 18704 | );
|
17771 18705 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17772 18706 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17773 18707 | http_response.headers(),
|
17774 18708 | expected_headers,
|
17775 18709 | ));
|
17776 18710 | }
|
17777 18711 | }
|
17778 18712 |
|
17779 18713 | /// Underflow or overflow should result in SerializationException
|
17780 18714 | /// Test ID: RestJsonPathByteUnderflowOverflow_case4
|
17781 18715 | #[::tokio::test]
|
17782 18716 | #[::tracing_test::traced_test]
|
17783 18717 | async fn rest_json_path_byte_underflow_overflow_case4_malformed_request() {
|
17784 18718 | {
|
17785 18719 | #[allow(unused_mut)]
|
17786 - | let mut http_request = http::Request::builder()
|
18720 + | let mut http_request = ::http_1x::Request::builder()
|
17787 18721 | .uri("/MalformedByte/123000000000000000000000")
|
17788 18722 | .method("POST")
|
17789 - | .body(::aws_smithy_http_server::body::Body::empty())
|
18723 + | .body(::aws_smithy_http_server::body::boxed(
|
18724 + | ::http_body_util::Empty::new(),
|
18725 + | ))
|
17790 18726 | .unwrap();
|
17791 18727 | #[allow(unused_mut)]
|
17792 18728 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17793 18729 | let config = crate::service::RestJsonConfig::builder().build();
|
17794 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18730 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17795 18731 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
17796 18732 | let sender = sender.clone();
|
17797 18733 | async move {
|
17798 18734 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
17799 18735 | sender.send(()).await.expect("receiver dropped early");
|
17800 18736 | result
|
17801 18737 | }
|
17802 18738 | })
|
17803 18739 | .build_unchecked();
|
17804 18740 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17805 18741 | .await
|
17806 18742 | .expect("unable to make an HTTP request");
|
17807 18743 | ::pretty_assertions::assert_eq!(
|
17808 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18744 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17809 18745 | http_response.status()
|
17810 18746 | );
|
17811 18747 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17812 18748 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17813 18749 | http_response.headers(),
|
17814 18750 | expected_headers,
|
17815 18751 | ));
|
17816 18752 | }
|
17817 18753 | }
|
17818 18754 |
|
17819 18755 | /// Underflow or overflow should result in SerializationException
|
17820 18756 | /// Test ID: RestJsonQueryByteUnderflowOverflow_case0
|
17821 18757 | #[::tokio::test]
|
17822 18758 | #[::tracing_test::traced_test]
|
17823 18759 | async fn rest_json_query_byte_underflow_overflow_case0_malformed_request() {
|
17824 18760 | {
|
17825 18761 | #[allow(unused_mut)]
|
17826 - | let mut http_request = http::Request::builder()
|
18762 + | let mut http_request = ::http_1x::Request::builder()
|
17827 18763 | .uri("/MalformedByte/1")
|
17828 18764 | .method("POST")
|
17829 - | .body(::aws_smithy_http_server::body::Body::empty())
|
18765 + | .body(::aws_smithy_http_server::body::boxed(
|
18766 + | ::http_body_util::Empty::new(),
|
18767 + | ))
|
17830 18768 | .unwrap();
|
17831 18769 | *http_request.uri_mut() = "/MalformedByte/1?byteInQuery=256".parse().unwrap();
|
17832 18770 | #[allow(unused_mut)]
|
17833 18771 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17834 18772 | let config = crate::service::RestJsonConfig::builder().build();
|
17835 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18773 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17836 18774 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
17837 18775 | let sender = sender.clone();
|
17838 18776 | async move {
|
17839 18777 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
17840 18778 | sender.send(()).await.expect("receiver dropped early");
|
17841 18779 | result
|
17842 18780 | }
|
17843 18781 | })
|
17844 18782 | .build_unchecked();
|
17845 18783 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17846 18784 | .await
|
17847 18785 | .expect("unable to make an HTTP request");
|
17848 18786 | ::pretty_assertions::assert_eq!(
|
17849 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18787 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17850 18788 | http_response.status()
|
17851 18789 | );
|
17852 18790 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17853 18791 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17854 18792 | http_response.headers(),
|
17855 18793 | expected_headers,
|
17856 18794 | ));
|
17857 18795 | }
|
17858 18796 | }
|
17859 18797 |
|
17860 18798 | /// Underflow or overflow should result in SerializationException
|
17861 18799 | /// Test ID: RestJsonQueryByteUnderflowOverflow_case1
|
17862 18800 | #[::tokio::test]
|
17863 18801 | #[::tracing_test::traced_test]
|
17864 18802 | async fn rest_json_query_byte_underflow_overflow_case1_malformed_request() {
|
17865 18803 | {
|
17866 18804 | #[allow(unused_mut)]
|
17867 - | let mut http_request = http::Request::builder()
|
18805 + | let mut http_request = ::http_1x::Request::builder()
|
17868 18806 | .uri("/MalformedByte/1")
|
17869 18807 | .method("POST")
|
17870 - | .body(::aws_smithy_http_server::body::Body::empty())
|
18808 + | .body(::aws_smithy_http_server::body::boxed(
|
18809 + | ::http_body_util::Empty::new(),
|
18810 + | ))
|
17871 18811 | .unwrap();
|
17872 18812 | *http_request.uri_mut() = "/MalformedByte/1?byteInQuery=-256".parse().unwrap();
|
17873 18813 | #[allow(unused_mut)]
|
17874 18814 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17875 18815 | let config = crate::service::RestJsonConfig::builder().build();
|
17876 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18816 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17877 18817 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
17878 18818 | let sender = sender.clone();
|
17879 18819 | async move {
|
17880 18820 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
17881 18821 | sender.send(()).await.expect("receiver dropped early");
|
17882 18822 | result
|
17883 18823 | }
|
17884 18824 | })
|
17885 18825 | .build_unchecked();
|
17886 18826 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17887 18827 | .await
|
17888 18828 | .expect("unable to make an HTTP request");
|
17889 18829 | ::pretty_assertions::assert_eq!(
|
17890 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18830 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17891 18831 | http_response.status()
|
17892 18832 | );
|
17893 18833 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17894 18834 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17895 18835 | http_response.headers(),
|
17896 18836 | expected_headers,
|
17897 18837 | ));
|
17898 18838 | }
|
17899 18839 | }
|
17900 18840 |
|
17901 18841 | /// Underflow or overflow should result in SerializationException
|
17902 18842 | /// Test ID: RestJsonQueryByteUnderflowOverflow_case2
|
17903 18843 | #[::tokio::test]
|
17904 18844 | #[::tracing_test::traced_test]
|
17905 18845 | async fn rest_json_query_byte_underflow_overflow_case2_malformed_request() {
|
17906 18846 | {
|
17907 18847 | #[allow(unused_mut)]
|
17908 - | let mut http_request = http::Request::builder()
|
18848 + | let mut http_request = ::http_1x::Request::builder()
|
17909 18849 | .uri("/MalformedByte/1")
|
17910 18850 | .method("POST")
|
17911 - | .body(::aws_smithy_http_server::body::Body::empty())
|
18851 + | .body(::aws_smithy_http_server::body::boxed(
|
18852 + | ::http_body_util::Empty::new(),
|
18853 + | ))
|
17912 18854 | .unwrap();
|
17913 18855 | *http_request.uri_mut() = "/MalformedByte/1?byteInQuery=-9223372000000000000"
|
17914 18856 | .parse()
|
17915 18857 | .unwrap();
|
17916 18858 | #[allow(unused_mut)]
|
17917 18859 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17918 18860 | let config = crate::service::RestJsonConfig::builder().build();
|
17919 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18861 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17920 18862 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
17921 18863 | let sender = sender.clone();
|
17922 18864 | async move {
|
17923 18865 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
17924 18866 | sender.send(()).await.expect("receiver dropped early");
|
17925 18867 | result
|
17926 18868 | }
|
17927 18869 | })
|
17928 18870 | .build_unchecked();
|
17929 18871 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17930 18872 | .await
|
17931 18873 | .expect("unable to make an HTTP request");
|
17932 18874 | ::pretty_assertions::assert_eq!(
|
17933 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18875 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17934 18876 | http_response.status()
|
17935 18877 | );
|
17936 18878 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17937 18879 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17938 18880 | http_response.headers(),
|
17939 18881 | expected_headers,
|
17940 18882 | ));
|
17941 18883 | }
|
17942 18884 | }
|
17943 18885 |
|
17944 18886 | /// Underflow or overflow should result in SerializationException
|
17945 18887 | /// Test ID: RestJsonQueryByteUnderflowOverflow_case3
|
17946 18888 | #[::tokio::test]
|
17947 18889 | #[::tracing_test::traced_test]
|
17948 18890 | async fn rest_json_query_byte_underflow_overflow_case3_malformed_request() {
|
17949 18891 | {
|
17950 18892 | #[allow(unused_mut)]
|
17951 - | let mut http_request = http::Request::builder()
|
18893 + | let mut http_request = ::http_1x::Request::builder()
|
17952 18894 | .uri("/MalformedByte/1")
|
17953 18895 | .method("POST")
|
17954 - | .body(::aws_smithy_http_server::body::Body::empty())
|
18896 + | .body(::aws_smithy_http_server::body::boxed(
|
18897 + | ::http_body_util::Empty::new(),
|
18898 + | ))
|
17955 18899 | .unwrap();
|
17956 18900 | *http_request.uri_mut() = "/MalformedByte/1?byteInQuery=9223372000000000000"
|
17957 18901 | .parse()
|
17958 18902 | .unwrap();
|
17959 18903 | #[allow(unused_mut)]
|
17960 18904 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
17961 18905 | let config = crate::service::RestJsonConfig::builder().build();
|
17962 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18906 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
17963 18907 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
17964 18908 | let sender = sender.clone();
|
17965 18909 | async move {
|
17966 18910 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
17967 18911 | sender.send(()).await.expect("receiver dropped early");
|
17968 18912 | result
|
17969 18913 | }
|
17970 18914 | })
|
17971 18915 | .build_unchecked();
|
17972 18916 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
17973 18917 | .await
|
17974 18918 | .expect("unable to make an HTTP request");
|
17975 18919 | ::pretty_assertions::assert_eq!(
|
17976 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18920 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
17977 18921 | http_response.status()
|
17978 18922 | );
|
17979 18923 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
17980 18924 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
17981 18925 | http_response.headers(),
|
17982 18926 | expected_headers,
|
17983 18927 | ));
|
17984 18928 | }
|
17985 18929 | }
|
17986 18930 |
|
17987 18931 | /// Underflow or overflow should result in SerializationException
|
17988 18932 | /// Test ID: RestJsonQueryByteUnderflowOverflow_case4
|
17989 18933 | #[::tokio::test]
|
17990 18934 | #[::tracing_test::traced_test]
|
17991 18935 | async fn rest_json_query_byte_underflow_overflow_case4_malformed_request() {
|
17992 18936 | {
|
17993 18937 | #[allow(unused_mut)]
|
17994 - | let mut http_request = http::Request::builder()
|
18938 + | let mut http_request = ::http_1x::Request::builder()
|
17995 18939 | .uri("/MalformedByte/1")
|
17996 18940 | .method("POST")
|
17997 - | .body(::aws_smithy_http_server::body::Body::empty())
|
18941 + | .body(::aws_smithy_http_server::body::boxed(
|
18942 + | ::http_body_util::Empty::new(),
|
18943 + | ))
|
17998 18944 | .unwrap();
|
17999 18945 | *http_request.uri_mut() = "/MalformedByte/1?byteInQuery=123000000000000000000000"
|
18000 18946 | .parse()
|
18001 18947 | .unwrap();
|
18002 18948 | #[allow(unused_mut)]
|
18003 18949 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18004 18950 | let config = crate::service::RestJsonConfig::builder().build();
|
18005 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18951 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18006 18952 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18007 18953 | let sender = sender.clone();
|
18008 18954 | async move {
|
18009 18955 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18010 18956 | sender.send(()).await.expect("receiver dropped early");
|
18011 18957 | result
|
18012 18958 | }
|
18013 18959 | })
|
18014 18960 | .build_unchecked();
|
18015 18961 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18016 18962 | .await
|
18017 18963 | .expect("unable to make an HTTP request");
|
18018 18964 | ::pretty_assertions::assert_eq!(
|
18019 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18965 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18020 18966 | http_response.status()
|
18021 18967 | );
|
18022 18968 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18023 18969 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18024 18970 | http_response.headers(),
|
18025 18971 | expected_headers,
|
18026 18972 | ));
|
18027 18973 | }
|
18028 18974 | }
|
18029 18975 |
|
18030 18976 | /// Underflow or overflow should result in SerializationException
|
18031 18977 | /// Test ID: RestJsonHeaderByteUnderflowOverflow_case0
|
18032 18978 | #[::tokio::test]
|
18033 18979 | #[::tracing_test::traced_test]
|
18034 18980 | async fn rest_json_header_byte_underflow_overflow_case0_malformed_request() {
|
18035 18981 | {
|
18036 18982 | #[allow(unused_mut)]
|
18037 - | let mut http_request = http::Request::builder()
|
18983 + | let mut http_request = ::http_1x::Request::builder()
|
18038 18984 | .uri("/MalformedByte/1")
|
18039 18985 | .method("POST")
|
18040 18986 | .header("byteInHeader", "256")
|
18041 - | .body(::aws_smithy_http_server::body::Body::empty())
|
18987 + | .body(::aws_smithy_http_server::body::boxed(
|
18988 + | ::http_body_util::Empty::new(),
|
18989 + | ))
|
18042 18990 | .unwrap();
|
18043 18991 | #[allow(unused_mut)]
|
18044 18992 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18045 18993 | let config = crate::service::RestJsonConfig::builder().build();
|
18046 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
18994 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18047 18995 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18048 18996 | let sender = sender.clone();
|
18049 18997 | async move {
|
18050 18998 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18051 18999 | sender.send(()).await.expect("receiver dropped early");
|
18052 19000 | result
|
18053 19001 | }
|
18054 19002 | })
|
18055 19003 | .build_unchecked();
|
18056 19004 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18057 19005 | .await
|
18058 19006 | .expect("unable to make an HTTP request");
|
18059 19007 | ::pretty_assertions::assert_eq!(
|
18060 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19008 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18061 19009 | http_response.status()
|
18062 19010 | );
|
18063 19011 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18064 19012 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18065 19013 | http_response.headers(),
|
18066 19014 | expected_headers,
|
18067 19015 | ));
|
18068 19016 | }
|
18069 19017 | }
|
18070 19018 |
|
18071 19019 | /// Underflow or overflow should result in SerializationException
|
18072 19020 | /// Test ID: RestJsonHeaderByteUnderflowOverflow_case1
|
18073 19021 | #[::tokio::test]
|
18074 19022 | #[::tracing_test::traced_test]
|
18075 19023 | async fn rest_json_header_byte_underflow_overflow_case1_malformed_request() {
|
18076 19024 | {
|
18077 19025 | #[allow(unused_mut)]
|
18078 - | let mut http_request = http::Request::builder()
|
19026 + | let mut http_request = ::http_1x::Request::builder()
|
18079 19027 | .uri("/MalformedByte/1")
|
18080 19028 | .method("POST")
|
18081 19029 | .header("byteInHeader", "-256")
|
18082 - | .body(::aws_smithy_http_server::body::Body::empty())
|
19030 + | .body(::aws_smithy_http_server::body::boxed(
|
19031 + | ::http_body_util::Empty::new(),
|
19032 + | ))
|
18083 19033 | .unwrap();
|
18084 19034 | #[allow(unused_mut)]
|
18085 19035 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18086 19036 | let config = crate::service::RestJsonConfig::builder().build();
|
18087 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19037 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18088 19038 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18089 19039 | let sender = sender.clone();
|
18090 19040 | async move {
|
18091 19041 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18092 19042 | sender.send(()).await.expect("receiver dropped early");
|
18093 19043 | result
|
18094 19044 | }
|
18095 19045 | })
|
18096 19046 | .build_unchecked();
|
18097 19047 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18098 19048 | .await
|
18099 19049 | .expect("unable to make an HTTP request");
|
18100 19050 | ::pretty_assertions::assert_eq!(
|
18101 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19051 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18102 19052 | http_response.status()
|
18103 19053 | );
|
18104 19054 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18105 19055 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18106 19056 | http_response.headers(),
|
18107 19057 | expected_headers,
|
18108 19058 | ));
|
18109 19059 | }
|
18110 19060 | }
|
18111 19061 |
|
18112 19062 | /// Underflow or overflow should result in SerializationException
|
18113 19063 | /// Test ID: RestJsonHeaderByteUnderflowOverflow_case2
|
18114 19064 | #[::tokio::test]
|
18115 19065 | #[::tracing_test::traced_test]
|
18116 19066 | async fn rest_json_header_byte_underflow_overflow_case2_malformed_request() {
|
18117 19067 | {
|
18118 19068 | #[allow(unused_mut)]
|
18119 - | let mut http_request = http::Request::builder()
|
19069 + | let mut http_request = ::http_1x::Request::builder()
|
18120 19070 | .uri("/MalformedByte/1")
|
18121 19071 | .method("POST")
|
18122 19072 | .header("byteInHeader", "-9223372000000000000")
|
18123 - | .body(::aws_smithy_http_server::body::Body::empty())
|
19073 + | .body(::aws_smithy_http_server::body::boxed(
|
19074 + | ::http_body_util::Empty::new(),
|
19075 + | ))
|
18124 19076 | .unwrap();
|
18125 19077 | #[allow(unused_mut)]
|
18126 19078 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18127 19079 | let config = crate::service::RestJsonConfig::builder().build();
|
18128 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19080 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18129 19081 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18130 19082 | let sender = sender.clone();
|
18131 19083 | async move {
|
18132 19084 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18133 19085 | sender.send(()).await.expect("receiver dropped early");
|
18134 19086 | result
|
18135 19087 | }
|
18136 19088 | })
|
18137 19089 | .build_unchecked();
|
18138 19090 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18139 19091 | .await
|
18140 19092 | .expect("unable to make an HTTP request");
|
18141 19093 | ::pretty_assertions::assert_eq!(
|
18142 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19094 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18143 19095 | http_response.status()
|
18144 19096 | );
|
18145 19097 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18146 19098 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18147 19099 | http_response.headers(),
|
18148 19100 | expected_headers,
|
18149 19101 | ));
|
18150 19102 | }
|
18151 19103 | }
|
18152 19104 |
|
18153 19105 | /// Underflow or overflow should result in SerializationException
|
18154 19106 | /// Test ID: RestJsonHeaderByteUnderflowOverflow_case3
|
18155 19107 | #[::tokio::test]
|
18156 19108 | #[::tracing_test::traced_test]
|
18157 19109 | async fn rest_json_header_byte_underflow_overflow_case3_malformed_request() {
|
18158 19110 | {
|
18159 19111 | #[allow(unused_mut)]
|
18160 - | let mut http_request = http::Request::builder()
|
19112 + | let mut http_request = ::http_1x::Request::builder()
|
18161 19113 | .uri("/MalformedByte/1")
|
18162 19114 | .method("POST")
|
18163 19115 | .header("byteInHeader", "9223372000000000000")
|
18164 - | .body(::aws_smithy_http_server::body::Body::empty())
|
19116 + | .body(::aws_smithy_http_server::body::boxed(
|
19117 + | ::http_body_util::Empty::new(),
|
19118 + | ))
|
18165 19119 | .unwrap();
|
18166 19120 | #[allow(unused_mut)]
|
18167 19121 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18168 19122 | let config = crate::service::RestJsonConfig::builder().build();
|
18169 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19123 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18170 19124 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18171 19125 | let sender = sender.clone();
|
18172 19126 | async move {
|
18173 19127 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18174 19128 | sender.send(()).await.expect("receiver dropped early");
|
18175 19129 | result
|
18176 19130 | }
|
18177 19131 | })
|
18178 19132 | .build_unchecked();
|
18179 19133 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18180 19134 | .await
|
18181 19135 | .expect("unable to make an HTTP request");
|
18182 19136 | ::pretty_assertions::assert_eq!(
|
18183 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19137 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18184 19138 | http_response.status()
|
18185 19139 | );
|
18186 19140 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18187 19141 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18188 19142 | http_response.headers(),
|
18189 19143 | expected_headers,
|
18190 19144 | ));
|
18191 19145 | }
|
18192 19146 | }
|
18193 19147 |
|
18194 19148 | /// Underflow or overflow should result in SerializationException
|
18195 19149 | /// Test ID: RestJsonHeaderByteUnderflowOverflow_case4
|
18196 19150 | #[::tokio::test]
|
18197 19151 | #[::tracing_test::traced_test]
|
18198 19152 | async fn rest_json_header_byte_underflow_overflow_case4_malformed_request() {
|
18199 19153 | {
|
18200 19154 | #[allow(unused_mut)]
|
18201 - | let mut http_request = http::Request::builder()
|
19155 + | let mut http_request = ::http_1x::Request::builder()
|
18202 19156 | .uri("/MalformedByte/1")
|
18203 19157 | .method("POST")
|
18204 19158 | .header("byteInHeader", "123000000000000000000000")
|
18205 - | .body(::aws_smithy_http_server::body::Body::empty())
|
19159 + | .body(::aws_smithy_http_server::body::boxed(
|
19160 + | ::http_body_util::Empty::new(),
|
19161 + | ))
|
18206 19162 | .unwrap();
|
18207 19163 | #[allow(unused_mut)]
|
18208 19164 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18209 19165 | let config = crate::service::RestJsonConfig::builder().build();
|
18210 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19166 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18211 19167 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18212 19168 | let sender = sender.clone();
|
18213 19169 | async move {
|
18214 19170 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18215 19171 | sender.send(()).await.expect("receiver dropped early");
|
18216 19172 | result
|
18217 19173 | }
|
18218 19174 | })
|
18219 19175 | .build_unchecked();
|
18220 19176 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18221 19177 | .await
|
18222 19178 | .expect("unable to make an HTTP request");
|
18223 19179 | ::pretty_assertions::assert_eq!(
|
18224 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19180 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18225 19181 | http_response.status()
|
18226 19182 | );
|
18227 19183 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18228 19184 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18229 19185 | http_response.headers(),
|
18230 19186 | expected_headers,
|
18231 19187 | ));
|
18232 19188 | }
|
18233 19189 | }
|
18234 19190 |
|
18235 19191 | /// Malformed values in the body should be rejected
|
18236 19192 | /// Test ID: RestJsonBodyByteMalformedValueRejected_case0
|
18237 19193 | #[::tokio::test]
|
18238 19194 | #[::tracing_test::traced_test]
|
18239 19195 | async fn rest_json_body_byte_malformed_value_rejected_case0_malformed_request() {
|
18240 19196 | {
|
18241 19197 | #[allow(unused_mut)]
|
18242 - | let mut http_request = http::Request::builder()
|
19198 + | let mut http_request = ::http_1x::Request::builder()
|
18243 19199 | .uri("/MalformedByte/1")
|
18244 19200 | .method("POST")
|
18245 19201 | .header("content-type", "application/json")
|
18246 - | .body(::aws_smithy_http_server::body::Body::from(
|
18247 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
18248 - | "{ \"byteInBody\" : \"123\" }".as_bytes(),
|
18249 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19202 + | .body(::aws_smithy_http_server::body::boxed(
|
19203 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
19204 + | &::aws_smithy_protocol_test::decode_body_data(
|
19205 + | "{ \"byteInBody\" : \"123\" }".as_bytes(),
|
19206 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19207 + | ),
|
18250 19208 | )),
|
18251 19209 | ))
|
18252 19210 | .unwrap();
|
18253 19211 | #[allow(unused_mut)]
|
18254 19212 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18255 19213 | let config = crate::service::RestJsonConfig::builder().build();
|
18256 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19214 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18257 19215 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18258 19216 | let sender = sender.clone();
|
18259 19217 | async move {
|
18260 19218 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18261 19219 | sender.send(()).await.expect("receiver dropped early");
|
18262 19220 | result
|
18263 19221 | }
|
18264 19222 | })
|
18265 19223 | .build_unchecked();
|
18266 19224 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18267 19225 | .await
|
18268 19226 | .expect("unable to make an HTTP request");
|
18269 19227 | ::pretty_assertions::assert_eq!(
|
18270 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19228 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18271 19229 | http_response.status()
|
18272 19230 | );
|
18273 19231 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18274 19232 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18275 19233 | http_response.headers(),
|
18276 19234 | expected_headers,
|
18277 19235 | ));
|
18278 19236 | }
|
18279 19237 | }
|
18280 19238 |
|
18281 19239 | /// Malformed values in the body should be rejected
|
18282 19240 | /// Test ID: RestJsonBodyByteMalformedValueRejected_case1
|
18283 19241 | #[::tokio::test]
|
18284 19242 | #[::tracing_test::traced_test]
|
18285 19243 | async fn rest_json_body_byte_malformed_value_rejected_case1_malformed_request() {
|
18286 19244 | {
|
18287 19245 | #[allow(unused_mut)]
|
18288 - | let mut http_request = http::Request::builder()
|
19246 + | let mut http_request = ::http_1x::Request::builder()
|
18289 19247 | .uri("/MalformedByte/1")
|
18290 19248 | .method("POST")
|
18291 19249 | .header("content-type", "application/json")
|
18292 - | .body(::aws_smithy_http_server::body::Body::from(
|
18293 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
18294 - | "{ \"byteInBody\" : true }".as_bytes(),
|
18295 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19250 + | .body(::aws_smithy_http_server::body::boxed(
|
19251 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
19252 + | &::aws_smithy_protocol_test::decode_body_data(
|
19253 + | "{ \"byteInBody\" : true }".as_bytes(),
|
19254 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19255 + | ),
|
18296 19256 | )),
|
18297 19257 | ))
|
18298 19258 | .unwrap();
|
18299 19259 | #[allow(unused_mut)]
|
18300 19260 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18301 19261 | let config = crate::service::RestJsonConfig::builder().build();
|
18302 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19262 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18303 19263 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18304 19264 | let sender = sender.clone();
|
18305 19265 | async move {
|
18306 19266 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18307 19267 | sender.send(()).await.expect("receiver dropped early");
|
18308 19268 | result
|
18309 19269 | }
|
18310 19270 | })
|
18311 19271 | .build_unchecked();
|
18312 19272 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18313 19273 | .await
|
18314 19274 | .expect("unable to make an HTTP request");
|
18315 19275 | ::pretty_assertions::assert_eq!(
|
18316 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19276 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18317 19277 | http_response.status()
|
18318 19278 | );
|
18319 19279 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18320 19280 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18321 19281 | http_response.headers(),
|
18322 19282 | expected_headers,
|
18323 19283 | ));
|
18324 19284 | }
|
18325 19285 | }
|
18326 19286 |
|
18327 19287 | /// Malformed values in the body should be rejected
|
18328 19288 | /// Test ID: RestJsonBodyByteMalformedValueRejected_case2
|
18329 19289 | #[::tokio::test]
|
18330 19290 | #[::tracing_test::traced_test]
|
18331 19291 | async fn rest_json_body_byte_malformed_value_rejected_case2_malformed_request() {
|
18332 19292 | {
|
18333 19293 | #[allow(unused_mut)]
|
18334 - | let mut http_request = http::Request::builder()
|
19294 + | let mut http_request = ::http_1x::Request::builder()
|
18335 19295 | .uri("/MalformedByte/1")
|
18336 19296 | .method("POST")
|
18337 19297 | .header("content-type", "application/json")
|
18338 - | .body(::aws_smithy_http_server::body::Body::from(
|
18339 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
18340 - | "{ \"byteInBody\" : 1.001 }".as_bytes(),
|
18341 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19298 + | .body(::aws_smithy_http_server::body::boxed(
|
19299 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
19300 + | &::aws_smithy_protocol_test::decode_body_data(
|
19301 + | "{ \"byteInBody\" : 1.001 }".as_bytes(),
|
19302 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19303 + | ),
|
18342 19304 | )),
|
18343 19305 | ))
|
18344 19306 | .unwrap();
|
18345 19307 | #[allow(unused_mut)]
|
18346 19308 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18347 19309 | let config = crate::service::RestJsonConfig::builder().build();
|
18348 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19310 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18349 19311 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18350 19312 | let sender = sender.clone();
|
18351 19313 | async move {
|
18352 19314 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18353 19315 | sender.send(()).await.expect("receiver dropped early");
|
18354 19316 | result
|
18355 19317 | }
|
18356 19318 | })
|
18357 19319 | .build_unchecked();
|
18358 19320 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18359 19321 | .await
|
18360 19322 | .expect("unable to make an HTTP request");
|
18361 19323 | ::pretty_assertions::assert_eq!(
|
18362 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19324 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18363 19325 | http_response.status()
|
18364 19326 | );
|
18365 19327 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18366 19328 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18367 19329 | http_response.headers(),
|
18368 19330 | expected_headers,
|
18369 19331 | ));
|
18370 19332 | }
|
18371 19333 | }
|
18372 19334 |
|
18373 19335 | /// Malformed values in the body should be rejected
|
18374 19336 | /// Test ID: RestJsonBodyByteMalformedValueRejected_case3
|
18375 19337 | #[::tokio::test]
|
18376 19338 | #[::tracing_test::traced_test]
|
18377 19339 | async fn rest_json_body_byte_malformed_value_rejected_case3_malformed_request() {
|
18378 19340 | {
|
18379 19341 | #[allow(unused_mut)]
|
18380 - | let mut http_request = http::Request::builder()
|
19342 + | let mut http_request = ::http_1x::Request::builder()
|
18381 19343 | .uri("/MalformedByte/1")
|
18382 19344 | .method("POST")
|
18383 19345 | .header("content-type", "application/json")
|
18384 - | .body(::aws_smithy_http_server::body::Body::from(
|
18385 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
18386 - | "{ \"byteInBody\" : 2ABC }".as_bytes(),
|
18387 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19346 + | .body(::aws_smithy_http_server::body::boxed(
|
19347 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
19348 + | &::aws_smithy_protocol_test::decode_body_data(
|
19349 + | "{ \"byteInBody\" : 2ABC }".as_bytes(),
|
19350 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19351 + | ),
|
18388 19352 | )),
|
18389 19353 | ))
|
18390 19354 | .unwrap();
|
18391 19355 | #[allow(unused_mut)]
|
18392 19356 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18393 19357 | let config = crate::service::RestJsonConfig::builder().build();
|
18394 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19358 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18395 19359 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18396 19360 | let sender = sender.clone();
|
18397 19361 | async move {
|
18398 19362 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18399 19363 | sender.send(()).await.expect("receiver dropped early");
|
18400 19364 | result
|
18401 19365 | }
|
18402 19366 | })
|
18403 19367 | .build_unchecked();
|
18404 19368 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18405 19369 | .await
|
18406 19370 | .expect("unable to make an HTTP request");
|
18407 19371 | ::pretty_assertions::assert_eq!(
|
18408 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19372 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18409 19373 | http_response.status()
|
18410 19374 | );
|
18411 19375 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18412 19376 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18413 19377 | http_response.headers(),
|
18414 19378 | expected_headers,
|
18415 19379 | ));
|
18416 19380 | }
|
18417 19381 | }
|
18418 19382 |
|
18419 19383 | /// Malformed values in the body should be rejected
|
18420 19384 | /// Test ID: RestJsonBodyByteMalformedValueRejected_case4
|
18421 19385 | #[::tokio::test]
|
18422 19386 | #[::tracing_test::traced_test]
|
18423 19387 | async fn rest_json_body_byte_malformed_value_rejected_case4_malformed_request() {
|
18424 19388 | {
|
18425 19389 | #[allow(unused_mut)]
|
18426 - | let mut http_request = http::Request::builder()
|
19390 + | let mut http_request = ::http_1x::Request::builder()
|
18427 19391 | .uri("/MalformedByte/1")
|
18428 19392 | .method("POST")
|
18429 19393 | .header("content-type", "application/json")
|
18430 - | .body(::aws_smithy_http_server::body::Body::from(
|
18431 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
18432 - | "{ \"byteInBody\" : 0x42 }".as_bytes(),
|
18433 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19394 + | .body(::aws_smithy_http_server::body::boxed(
|
19395 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
19396 + | &::aws_smithy_protocol_test::decode_body_data(
|
19397 + | "{ \"byteInBody\" : 0x42 }".as_bytes(),
|
19398 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19399 + | ),
|
18434 19400 | )),
|
18435 19401 | ))
|
18436 19402 | .unwrap();
|
18437 19403 | #[allow(unused_mut)]
|
18438 19404 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18439 19405 | let config = crate::service::RestJsonConfig::builder().build();
|
18440 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19406 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18441 19407 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18442 19408 | let sender = sender.clone();
|
18443 19409 | async move {
|
18444 19410 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18445 19411 | sender.send(()).await.expect("receiver dropped early");
|
18446 19412 | result
|
18447 19413 | }
|
18448 19414 | })
|
18449 19415 | .build_unchecked();
|
18450 19416 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18451 19417 | .await
|
18452 19418 | .expect("unable to make an HTTP request");
|
18453 19419 | ::pretty_assertions::assert_eq!(
|
18454 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19420 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18455 19421 | http_response.status()
|
18456 19422 | );
|
18457 19423 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18458 19424 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18459 19425 | http_response.headers(),
|
18460 19426 | expected_headers,
|
18461 19427 | ));
|
18462 19428 | }
|
18463 19429 | }
|
18464 19430 |
|
18465 19431 | /// Malformed values in the body should be rejected
|
18466 19432 | /// Test ID: RestJsonBodyByteMalformedValueRejected_case5
|
18467 19433 | #[::tokio::test]
|
18468 19434 | #[::tracing_test::traced_test]
|
18469 19435 | async fn rest_json_body_byte_malformed_value_rejected_case5_malformed_request() {
|
18470 19436 | {
|
18471 19437 | #[allow(unused_mut)]
|
18472 - | let mut http_request = http::Request::builder()
|
19438 + | let mut http_request = ::http_1x::Request::builder()
|
18473 19439 | .uri("/MalformedByte/1")
|
18474 19440 | .method("POST")
|
18475 19441 | .header("content-type", "application/json")
|
18476 - | .body(::aws_smithy_http_server::body::Body::from(
|
18477 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
18478 - | "{ \"byteInBody\" : Infinity }".as_bytes(),
|
18479 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19442 + | .body(::aws_smithy_http_server::body::boxed(
|
19443 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
19444 + | &::aws_smithy_protocol_test::decode_body_data(
|
19445 + | "{ \"byteInBody\" : Infinity }".as_bytes(),
|
19446 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19447 + | ),
|
18480 19448 | )),
|
18481 19449 | ))
|
18482 19450 | .unwrap();
|
18483 19451 | #[allow(unused_mut)]
|
18484 19452 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18485 19453 | let config = crate::service::RestJsonConfig::builder().build();
|
18486 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19454 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18487 19455 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18488 19456 | let sender = sender.clone();
|
18489 19457 | async move {
|
18490 19458 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18491 19459 | sender.send(()).await.expect("receiver dropped early");
|
18492 19460 | result
|
18493 19461 | }
|
18494 19462 | })
|
18495 19463 | .build_unchecked();
|
18496 19464 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18497 19465 | .await
|
18498 19466 | .expect("unable to make an HTTP request");
|
18499 19467 | ::pretty_assertions::assert_eq!(
|
18500 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19468 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18501 19469 | http_response.status()
|
18502 19470 | );
|
18503 19471 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18504 19472 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18505 19473 | http_response.headers(),
|
18506 19474 | expected_headers,
|
18507 19475 | ));
|
18508 19476 | }
|
18509 19477 | }
|
18510 19478 |
|
18511 19479 | /// Malformed values in the body should be rejected
|
18512 19480 | /// Test ID: RestJsonBodyByteMalformedValueRejected_case6
|
18513 19481 | #[::tokio::test]
|
18514 19482 | #[::tracing_test::traced_test]
|
18515 19483 | async fn rest_json_body_byte_malformed_value_rejected_case6_malformed_request() {
|
18516 19484 | {
|
18517 19485 | #[allow(unused_mut)]
|
18518 - | let mut http_request = http::Request::builder()
|
19486 + | let mut http_request = ::http_1x::Request::builder()
|
18519 19487 | .uri("/MalformedByte/1")
|
18520 19488 | .method("POST")
|
18521 19489 | .header("content-type", "application/json")
|
18522 - | .body(::aws_smithy_http_server::body::Body::from(
|
18523 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
18524 - | "{ \"byteInBody\" : \"Infinity\" }".as_bytes(),
|
18525 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19490 + | .body(::aws_smithy_http_server::body::boxed(
|
19491 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
19492 + | &::aws_smithy_protocol_test::decode_body_data(
|
19493 + | "{ \"byteInBody\" : \"Infinity\" }".as_bytes(),
|
19494 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19495 + | ),
|
18526 19496 | )),
|
18527 19497 | ))
|
18528 19498 | .unwrap();
|
18529 19499 | #[allow(unused_mut)]
|
18530 19500 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18531 19501 | let config = crate::service::RestJsonConfig::builder().build();
|
18532 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19502 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18533 19503 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18534 19504 | let sender = sender.clone();
|
18535 19505 | async move {
|
18536 19506 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18537 19507 | sender.send(()).await.expect("receiver dropped early");
|
18538 19508 | result
|
18539 19509 | }
|
18540 19510 | })
|
18541 19511 | .build_unchecked();
|
18542 19512 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18543 19513 | .await
|
18544 19514 | .expect("unable to make an HTTP request");
|
18545 19515 | ::pretty_assertions::assert_eq!(
|
18546 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19516 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18547 19517 | http_response.status()
|
18548 19518 | );
|
18549 19519 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18550 19520 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18551 19521 | http_response.headers(),
|
18552 19522 | expected_headers,
|
18553 19523 | ));
|
18554 19524 | }
|
18555 19525 | }
|
18556 19526 |
|
18557 19527 | /// Malformed values in the body should be rejected
|
18558 19528 | /// Test ID: RestJsonBodyByteMalformedValueRejected_case7
|
18559 19529 | #[::tokio::test]
|
18560 19530 | #[::tracing_test::traced_test]
|
18561 19531 | async fn rest_json_body_byte_malformed_value_rejected_case7_malformed_request() {
|
18562 19532 | {
|
18563 19533 | #[allow(unused_mut)]
|
18564 - | let mut http_request = http::Request::builder()
|
19534 + | let mut http_request = ::http_1x::Request::builder()
|
18565 19535 | .uri("/MalformedByte/1")
|
18566 19536 | .method("POST")
|
18567 19537 | .header("content-type", "application/json")
|
18568 - | .body(::aws_smithy_http_server::body::Body::from(
|
18569 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
18570 - | "{ \"byteInBody\" : -Infinity }".as_bytes(),
|
18571 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19538 + | .body(::aws_smithy_http_server::body::boxed(
|
19539 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
19540 + | &::aws_smithy_protocol_test::decode_body_data(
|
19541 + | "{ \"byteInBody\" : -Infinity }".as_bytes(),
|
19542 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19543 + | ),
|
18572 19544 | )),
|
18573 19545 | ))
|
18574 19546 | .unwrap();
|
18575 19547 | #[allow(unused_mut)]
|
18576 19548 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18577 19549 | let config = crate::service::RestJsonConfig::builder().build();
|
18578 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19550 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18579 19551 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18580 19552 | let sender = sender.clone();
|
18581 19553 | async move {
|
18582 19554 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18583 19555 | sender.send(()).await.expect("receiver dropped early");
|
18584 19556 | result
|
18585 19557 | }
|
18586 19558 | })
|
18587 19559 | .build_unchecked();
|
18588 19560 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18589 19561 | .await
|
18590 19562 | .expect("unable to make an HTTP request");
|
18591 19563 | ::pretty_assertions::assert_eq!(
|
18592 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19564 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18593 19565 | http_response.status()
|
18594 19566 | );
|
18595 19567 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18596 19568 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18597 19569 | http_response.headers(),
|
18598 19570 | expected_headers,
|
18599 19571 | ));
|
18600 19572 | }
|
18601 19573 | }
|
18602 19574 |
|
18603 19575 | /// Malformed values in the body should be rejected
|
18604 19576 | /// Test ID: RestJsonBodyByteMalformedValueRejected_case8
|
18605 19577 | #[::tokio::test]
|
18606 19578 | #[::tracing_test::traced_test]
|
18607 19579 | async fn rest_json_body_byte_malformed_value_rejected_case8_malformed_request() {
|
18608 19580 | {
|
18609 19581 | #[allow(unused_mut)]
|
18610 - | let mut http_request = http::Request::builder()
|
19582 + | let mut http_request = ::http_1x::Request::builder()
|
18611 19583 | .uri("/MalformedByte/1")
|
18612 19584 | .method("POST")
|
18613 19585 | .header("content-type", "application/json")
|
18614 - | .body(::aws_smithy_http_server::body::Body::from(
|
18615 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
18616 - | "{ \"byteInBody\" : \"-Infinity\" }".as_bytes(),
|
18617 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19586 + | .body(::aws_smithy_http_server::body::boxed(
|
19587 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
19588 + | &::aws_smithy_protocol_test::decode_body_data(
|
19589 + | "{ \"byteInBody\" : \"-Infinity\" }".as_bytes(),
|
19590 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19591 + | ),
|
18618 19592 | )),
|
18619 19593 | ))
|
18620 19594 | .unwrap();
|
18621 19595 | #[allow(unused_mut)]
|
18622 19596 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18623 19597 | let config = crate::service::RestJsonConfig::builder().build();
|
18624 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19598 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18625 19599 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18626 19600 | let sender = sender.clone();
|
18627 19601 | async move {
|
18628 19602 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18629 19603 | sender.send(()).await.expect("receiver dropped early");
|
18630 19604 | result
|
18631 19605 | }
|
18632 19606 | })
|
18633 19607 | .build_unchecked();
|
18634 19608 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18635 19609 | .await
|
18636 19610 | .expect("unable to make an HTTP request");
|
18637 19611 | ::pretty_assertions::assert_eq!(
|
18638 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19612 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18639 19613 | http_response.status()
|
18640 19614 | );
|
18641 19615 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18642 19616 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18643 19617 | http_response.headers(),
|
18644 19618 | expected_headers,
|
18645 19619 | ));
|
18646 19620 | }
|
18647 19621 | }
|
18648 19622 |
|
18649 19623 | /// Malformed values in the body should be rejected
|
18650 19624 | /// Test ID: RestJsonBodyByteMalformedValueRejected_case9
|
18651 19625 | #[::tokio::test]
|
18652 19626 | #[::tracing_test::traced_test]
|
18653 19627 | async fn rest_json_body_byte_malformed_value_rejected_case9_malformed_request() {
|
18654 19628 | {
|
18655 19629 | #[allow(unused_mut)]
|
18656 - | let mut http_request = http::Request::builder()
|
19630 + | let mut http_request = ::http_1x::Request::builder()
|
18657 19631 | .uri("/MalformedByte/1")
|
18658 19632 | .method("POST")
|
18659 19633 | .header("content-type", "application/json")
|
18660 - | .body(::aws_smithy_http_server::body::Body::from(
|
18661 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
18662 - | "{ \"byteInBody\" : NaN }".as_bytes(),
|
18663 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19634 + | .body(::aws_smithy_http_server::body::boxed(
|
19635 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
19636 + | &::aws_smithy_protocol_test::decode_body_data(
|
19637 + | "{ \"byteInBody\" : NaN }".as_bytes(),
|
19638 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19639 + | ),
|
18664 19640 | )),
|
18665 19641 | ))
|
18666 19642 | .unwrap();
|
18667 19643 | #[allow(unused_mut)]
|
18668 19644 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18669 19645 | let config = crate::service::RestJsonConfig::builder().build();
|
18670 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19646 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18671 19647 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18672 19648 | let sender = sender.clone();
|
18673 19649 | async move {
|
18674 19650 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18675 19651 | sender.send(()).await.expect("receiver dropped early");
|
18676 19652 | result
|
18677 19653 | }
|
18678 19654 | })
|
18679 19655 | .build_unchecked();
|
18680 19656 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18681 19657 | .await
|
18682 19658 | .expect("unable to make an HTTP request");
|
18683 19659 | ::pretty_assertions::assert_eq!(
|
18684 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19660 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18685 19661 | http_response.status()
|
18686 19662 | );
|
18687 19663 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18688 19664 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18689 19665 | http_response.headers(),
|
18690 19666 | expected_headers,
|
18691 19667 | ));
|
18692 19668 | }
|
18693 19669 | }
|
18694 19670 |
|
18695 19671 | /// Malformed values in the body should be rejected
|
18696 19672 | /// Test ID: RestJsonBodyByteMalformedValueRejected_case10
|
18697 19673 | #[::tokio::test]
|
18698 19674 | #[::tracing_test::traced_test]
|
18699 19675 | async fn rest_json_body_byte_malformed_value_rejected_case10_malformed_request() {
|
18700 19676 | {
|
18701 19677 | #[allow(unused_mut)]
|
18702 - | let mut http_request = http::Request::builder()
|
19678 + | let mut http_request = ::http_1x::Request::builder()
|
18703 19679 | .uri("/MalformedByte/1")
|
18704 19680 | .method("POST")
|
18705 19681 | .header("content-type", "application/json")
|
18706 - | .body(::aws_smithy_http_server::body::Body::from(
|
18707 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
18708 - | "{ \"byteInBody\" : \"NaN\" }".as_bytes(),
|
18709 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19682 + | .body(::aws_smithy_http_server::body::boxed(
|
19683 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
19684 + | &::aws_smithy_protocol_test::decode_body_data(
|
19685 + | "{ \"byteInBody\" : \"NaN\" }".as_bytes(),
|
19686 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
19687 + | ),
|
18710 19688 | )),
|
18711 19689 | ))
|
18712 19690 | .unwrap();
|
18713 19691 | #[allow(unused_mut)]
|
18714 19692 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18715 19693 | let config = crate::service::RestJsonConfig::builder().build();
|
18716 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19694 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18717 19695 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18718 19696 | let sender = sender.clone();
|
18719 19697 | async move {
|
18720 19698 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18721 19699 | sender.send(()).await.expect("receiver dropped early");
|
18722 19700 | result
|
18723 19701 | }
|
18724 19702 | })
|
18725 19703 | .build_unchecked();
|
18726 19704 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18727 19705 | .await
|
18728 19706 | .expect("unable to make an HTTP request");
|
18729 19707 | ::pretty_assertions::assert_eq!(
|
18730 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19708 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18731 19709 | http_response.status()
|
18732 19710 | );
|
18733 19711 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18734 19712 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18735 19713 | http_response.headers(),
|
18736 19714 | expected_headers,
|
18737 19715 | ));
|
18738 19716 | }
|
18739 19717 | }
|
18740 19718 |
|
18741 19719 | /// Malformed values in the path should be rejected
|
18742 19720 | /// Test ID: RestJsonPathByteMalformedValueRejected_case0
|
18743 19721 | #[::tokio::test]
|
18744 19722 | #[::tracing_test::traced_test]
|
18745 19723 | async fn rest_json_path_byte_malformed_value_rejected_case0_malformed_request() {
|
18746 19724 | {
|
18747 19725 | #[allow(unused_mut)]
|
18748 - | let mut http_request = http::Request::builder()
|
19726 + | let mut http_request = ::http_1x::Request::builder()
|
18749 19727 | .uri("/MalformedByte/true")
|
18750 19728 | .method("POST")
|
18751 - | .body(::aws_smithy_http_server::body::Body::empty())
|
19729 + | .body(::aws_smithy_http_server::body::boxed(
|
19730 + | ::http_body_util::Empty::new(),
|
19731 + | ))
|
18752 19732 | .unwrap();
|
18753 19733 | #[allow(unused_mut)]
|
18754 19734 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18755 19735 | let config = crate::service::RestJsonConfig::builder().build();
|
18756 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19736 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18757 19737 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18758 19738 | let sender = sender.clone();
|
18759 19739 | async move {
|
18760 19740 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18761 19741 | sender.send(()).await.expect("receiver dropped early");
|
18762 19742 | result
|
18763 19743 | }
|
18764 19744 | })
|
18765 19745 | .build_unchecked();
|
18766 19746 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18767 19747 | .await
|
18768 19748 | .expect("unable to make an HTTP request");
|
18769 19749 | ::pretty_assertions::assert_eq!(
|
18770 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19750 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18771 19751 | http_response.status()
|
18772 19752 | );
|
18773 19753 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18774 19754 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18775 19755 | http_response.headers(),
|
18776 19756 | expected_headers,
|
18777 19757 | ));
|
18778 19758 | }
|
18779 19759 | }
|
18780 19760 |
|
18781 19761 | /// Malformed values in the path should be rejected
|
18782 19762 | /// Test ID: RestJsonPathByteMalformedValueRejected_case1
|
18783 19763 | #[::tokio::test]
|
18784 19764 | #[::tracing_test::traced_test]
|
18785 19765 | async fn rest_json_path_byte_malformed_value_rejected_case1_malformed_request() {
|
18786 19766 | {
|
18787 19767 | #[allow(unused_mut)]
|
18788 - | let mut http_request = http::Request::builder()
|
19768 + | let mut http_request = ::http_1x::Request::builder()
|
18789 19769 | .uri("/MalformedByte/1.001")
|
18790 19770 | .method("POST")
|
18791 - | .body(::aws_smithy_http_server::body::Body::empty())
|
19771 + | .body(::aws_smithy_http_server::body::boxed(
|
19772 + | ::http_body_util::Empty::new(),
|
19773 + | ))
|
18792 19774 | .unwrap();
|
18793 19775 | #[allow(unused_mut)]
|
18794 19776 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18795 19777 | let config = crate::service::RestJsonConfig::builder().build();
|
18796 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19778 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18797 19779 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18798 19780 | let sender = sender.clone();
|
18799 19781 | async move {
|
18800 19782 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18801 19783 | sender.send(()).await.expect("receiver dropped early");
|
18802 19784 | result
|
18803 19785 | }
|
18804 19786 | })
|
18805 19787 | .build_unchecked();
|
18806 19788 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18807 19789 | .await
|
18808 19790 | .expect("unable to make an HTTP request");
|
18809 19791 | ::pretty_assertions::assert_eq!(
|
18810 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19792 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18811 19793 | http_response.status()
|
18812 19794 | );
|
18813 19795 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18814 19796 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18815 19797 | http_response.headers(),
|
18816 19798 | expected_headers,
|
18817 19799 | ));
|
18818 19800 | }
|
18819 19801 | }
|
18820 19802 |
|
18821 19803 | /// Malformed values in the path should be rejected
|
18822 19804 | /// Test ID: RestJsonPathByteMalformedValueRejected_case2
|
18823 19805 | #[::tokio::test]
|
18824 19806 | #[::tracing_test::traced_test]
|
18825 19807 | async fn rest_json_path_byte_malformed_value_rejected_case2_malformed_request() {
|
18826 19808 | {
|
18827 19809 | #[allow(unused_mut)]
|
18828 - | let mut http_request = http::Request::builder()
|
19810 + | let mut http_request = ::http_1x::Request::builder()
|
18829 19811 | .uri("/MalformedByte/2ABC")
|
18830 19812 | .method("POST")
|
18831 - | .body(::aws_smithy_http_server::body::Body::empty())
|
19813 + | .body(::aws_smithy_http_server::body::boxed(
|
19814 + | ::http_body_util::Empty::new(),
|
19815 + | ))
|
18832 19816 | .unwrap();
|
18833 19817 | #[allow(unused_mut)]
|
18834 19818 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18835 19819 | let config = crate::service::RestJsonConfig::builder().build();
|
18836 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19820 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18837 19821 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18838 19822 | let sender = sender.clone();
|
18839 19823 | async move {
|
18840 19824 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18841 19825 | sender.send(()).await.expect("receiver dropped early");
|
18842 19826 | result
|
18843 19827 | }
|
18844 19828 | })
|
18845 19829 | .build_unchecked();
|
18846 19830 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18847 19831 | .await
|
18848 19832 | .expect("unable to make an HTTP request");
|
18849 19833 | ::pretty_assertions::assert_eq!(
|
18850 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19834 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18851 19835 | http_response.status()
|
18852 19836 | );
|
18853 19837 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18854 19838 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18855 19839 | http_response.headers(),
|
18856 19840 | expected_headers,
|
18857 19841 | ));
|
18858 19842 | }
|
18859 19843 | }
|
18860 19844 |
|
18861 19845 | /// Malformed values in the path should be rejected
|
18862 19846 | /// Test ID: RestJsonPathByteMalformedValueRejected_case3
|
18863 19847 | #[::tokio::test]
|
18864 19848 | #[::tracing_test::traced_test]
|
18865 19849 | async fn rest_json_path_byte_malformed_value_rejected_case3_malformed_request() {
|
18866 19850 | {
|
18867 19851 | #[allow(unused_mut)]
|
18868 - | let mut http_request = http::Request::builder()
|
19852 + | let mut http_request = ::http_1x::Request::builder()
|
18869 19853 | .uri("/MalformedByte/0x42")
|
18870 19854 | .method("POST")
|
18871 - | .body(::aws_smithy_http_server::body::Body::empty())
|
19855 + | .body(::aws_smithy_http_server::body::boxed(
|
19856 + | ::http_body_util::Empty::new(),
|
19857 + | ))
|
18872 19858 | .unwrap();
|
18873 19859 | #[allow(unused_mut)]
|
18874 19860 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18875 19861 | let config = crate::service::RestJsonConfig::builder().build();
|
18876 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19862 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18877 19863 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18878 19864 | let sender = sender.clone();
|
18879 19865 | async move {
|
18880 19866 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18881 19867 | sender.send(()).await.expect("receiver dropped early");
|
18882 19868 | result
|
18883 19869 | }
|
18884 19870 | })
|
18885 19871 | .build_unchecked();
|
18886 19872 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18887 19873 | .await
|
18888 19874 | .expect("unable to make an HTTP request");
|
18889 19875 | ::pretty_assertions::assert_eq!(
|
18890 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19876 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18891 19877 | http_response.status()
|
18892 19878 | );
|
18893 19879 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18894 19880 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18895 19881 | http_response.headers(),
|
18896 19882 | expected_headers,
|
18897 19883 | ));
|
18898 19884 | }
|
18899 19885 | }
|
18900 19886 |
|
18901 19887 | /// Malformed values in the path should be rejected
|
18902 19888 | /// Test ID: RestJsonPathByteMalformedValueRejected_case4
|
18903 19889 | #[::tokio::test]
|
18904 19890 | #[::tracing_test::traced_test]
|
18905 19891 | async fn rest_json_path_byte_malformed_value_rejected_case4_malformed_request() {
|
18906 19892 | {
|
18907 19893 | #[allow(unused_mut)]
|
18908 - | let mut http_request = http::Request::builder()
|
19894 + | let mut http_request = ::http_1x::Request::builder()
|
18909 19895 | .uri("/MalformedByte/Infinity")
|
18910 19896 | .method("POST")
|
18911 - | .body(::aws_smithy_http_server::body::Body::empty())
|
19897 + | .body(::aws_smithy_http_server::body::boxed(
|
19898 + | ::http_body_util::Empty::new(),
|
19899 + | ))
|
18912 19900 | .unwrap();
|
18913 19901 | #[allow(unused_mut)]
|
18914 19902 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18915 19903 | let config = crate::service::RestJsonConfig::builder().build();
|
18916 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19904 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18917 19905 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18918 19906 | let sender = sender.clone();
|
18919 19907 | async move {
|
18920 19908 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18921 19909 | sender.send(()).await.expect("receiver dropped early");
|
18922 19910 | result
|
18923 19911 | }
|
18924 19912 | })
|
18925 19913 | .build_unchecked();
|
18926 19914 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18927 19915 | .await
|
18928 19916 | .expect("unable to make an HTTP request");
|
18929 19917 | ::pretty_assertions::assert_eq!(
|
18930 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19918 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18931 19919 | http_response.status()
|
18932 19920 | );
|
18933 19921 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18934 19922 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18935 19923 | http_response.headers(),
|
18936 19924 | expected_headers,
|
18937 19925 | ));
|
18938 19926 | }
|
18939 19927 | }
|
18940 19928 |
|
18941 19929 | /// Malformed values in the path should be rejected
|
18942 19930 | /// Test ID: RestJsonPathByteMalformedValueRejected_case5
|
18943 19931 | #[::tokio::test]
|
18944 19932 | #[::tracing_test::traced_test]
|
18945 19933 | async fn rest_json_path_byte_malformed_value_rejected_case5_malformed_request() {
|
18946 19934 | {
|
18947 19935 | #[allow(unused_mut)]
|
18948 - | let mut http_request = http::Request::builder()
|
19936 + | let mut http_request = ::http_1x::Request::builder()
|
18949 19937 | .uri("/MalformedByte/-Infinity")
|
18950 19938 | .method("POST")
|
18951 - | .body(::aws_smithy_http_server::body::Body::empty())
|
19939 + | .body(::aws_smithy_http_server::body::boxed(
|
19940 + | ::http_body_util::Empty::new(),
|
19941 + | ))
|
18952 19942 | .unwrap();
|
18953 19943 | #[allow(unused_mut)]
|
18954 19944 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18955 19945 | let config = crate::service::RestJsonConfig::builder().build();
|
18956 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19946 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18957 19947 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18958 19948 | let sender = sender.clone();
|
18959 19949 | async move {
|
18960 19950 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
18961 19951 | sender.send(()).await.expect("receiver dropped early");
|
18962 19952 | result
|
18963 19953 | }
|
18964 19954 | })
|
18965 19955 | .build_unchecked();
|
18966 19956 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
18967 19957 | .await
|
18968 19958 | .expect("unable to make an HTTP request");
|
18969 19959 | ::pretty_assertions::assert_eq!(
|
18970 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19960 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
18971 19961 | http_response.status()
|
18972 19962 | );
|
18973 19963 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
18974 19964 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
18975 19965 | http_response.headers(),
|
18976 19966 | expected_headers,
|
18977 19967 | ));
|
18978 19968 | }
|
18979 19969 | }
|
18980 19970 |
|
18981 19971 | /// Malformed values in the path should be rejected
|
18982 19972 | /// Test ID: RestJsonPathByteMalformedValueRejected_case6
|
18983 19973 | #[::tokio::test]
|
18984 19974 | #[::tracing_test::traced_test]
|
18985 19975 | async fn rest_json_path_byte_malformed_value_rejected_case6_malformed_request() {
|
18986 19976 | {
|
18987 19977 | #[allow(unused_mut)]
|
18988 - | let mut http_request = http::Request::builder()
|
19978 + | let mut http_request = ::http_1x::Request::builder()
|
18989 19979 | .uri("/MalformedByte/NaN")
|
18990 19980 | .method("POST")
|
18991 - | .body(::aws_smithy_http_server::body::Body::empty())
|
19981 + | .body(::aws_smithy_http_server::body::boxed(
|
19982 + | ::http_body_util::Empty::new(),
|
19983 + | ))
|
18992 19984 | .unwrap();
|
18993 19985 | #[allow(unused_mut)]
|
18994 19986 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
18995 19987 | let config = crate::service::RestJsonConfig::builder().build();
|
18996 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
19988 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
18997 19989 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
18998 19990 | let sender = sender.clone();
|
18999 19991 | async move {
|
19000 19992 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
19001 19993 | sender.send(()).await.expect("receiver dropped early");
|
19002 19994 | result
|
19003 19995 | }
|
19004 19996 | })
|
19005 19997 | .build_unchecked();
|
19006 19998 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19007 19999 | .await
|
19008 20000 | .expect("unable to make an HTTP request");
|
19009 20001 | ::pretty_assertions::assert_eq!(
|
19010 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20002 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19011 20003 | http_response.status()
|
19012 20004 | );
|
19013 20005 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19014 20006 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19015 20007 | http_response.headers(),
|
19016 20008 | expected_headers,
|
19017 20009 | ));
|
19018 20010 | }
|
19019 20011 | }
|
19020 20012 |
|
19021 20013 | /// Malformed values in query parameters should be rejected
|
19022 20014 | /// Test ID: RestJsonQueryByteMalformedValueRejected_case0
|
19023 20015 | #[::tokio::test]
|
19024 20016 | #[::tracing_test::traced_test]
|
19025 20017 | async fn rest_json_query_byte_malformed_value_rejected_case0_malformed_request() {
|
19026 20018 | {
|
19027 20019 | #[allow(unused_mut)]
|
19028 - | let mut http_request = http::Request::builder()
|
20020 + | let mut http_request = ::http_1x::Request::builder()
|
19029 20021 | .uri("/MalformedByte/1")
|
19030 20022 | .method("POST")
|
19031 - | .body(::aws_smithy_http_server::body::Body::empty())
|
20023 + | .body(::aws_smithy_http_server::body::boxed(
|
20024 + | ::http_body_util::Empty::new(),
|
20025 + | ))
|
19032 20026 | .unwrap();
|
19033 20027 | *http_request.uri_mut() = "/MalformedByte/1?byteInQuery=true".parse().unwrap();
|
19034 20028 | #[allow(unused_mut)]
|
19035 20029 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19036 20030 | let config = crate::service::RestJsonConfig::builder().build();
|
19037 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20031 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19038 20032 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
19039 20033 | let sender = sender.clone();
|
19040 20034 | async move {
|
19041 20035 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
19042 20036 | sender.send(()).await.expect("receiver dropped early");
|
19043 20037 | result
|
19044 20038 | }
|
19045 20039 | })
|
19046 20040 | .build_unchecked();
|
19047 20041 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19048 20042 | .await
|
19049 20043 | .expect("unable to make an HTTP request");
|
19050 20044 | ::pretty_assertions::assert_eq!(
|
19051 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20045 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19052 20046 | http_response.status()
|
19053 20047 | );
|
19054 20048 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19055 20049 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19056 20050 | http_response.headers(),
|
19057 20051 | expected_headers,
|
19058 20052 | ));
|
19059 20053 | }
|
19060 20054 | }
|
19061 20055 |
|
19062 20056 | /// Malformed values in query parameters should be rejected
|
19063 20057 | /// Test ID: RestJsonQueryByteMalformedValueRejected_case1
|
19064 20058 | #[::tokio::test]
|
19065 20059 | #[::tracing_test::traced_test]
|
19066 20060 | async fn rest_json_query_byte_malformed_value_rejected_case1_malformed_request() {
|
19067 20061 | {
|
19068 20062 | #[allow(unused_mut)]
|
19069 - | let mut http_request = http::Request::builder()
|
20063 + | let mut http_request = ::http_1x::Request::builder()
|
19070 20064 | .uri("/MalformedByte/1")
|
19071 20065 | .method("POST")
|
19072 - | .body(::aws_smithy_http_server::body::Body::empty())
|
20066 + | .body(::aws_smithy_http_server::body::boxed(
|
20067 + | ::http_body_util::Empty::new(),
|
20068 + | ))
|
19073 20069 | .unwrap();
|
19074 20070 | *http_request.uri_mut() = "/MalformedByte/1?byteInQuery=1.001".parse().unwrap();
|
19075 20071 | #[allow(unused_mut)]
|
19076 20072 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19077 20073 | let config = crate::service::RestJsonConfig::builder().build();
|
19078 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20074 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19079 20075 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
19080 20076 | let sender = sender.clone();
|
19081 20077 | async move {
|
19082 20078 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
19083 20079 | sender.send(()).await.expect("receiver dropped early");
|
19084 20080 | result
|
19085 20081 | }
|
19086 20082 | })
|
19087 20083 | .build_unchecked();
|
19088 20084 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19089 20085 | .await
|
19090 20086 | .expect("unable to make an HTTP request");
|
19091 20087 | ::pretty_assertions::assert_eq!(
|
19092 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20088 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19093 20089 | http_response.status()
|
19094 20090 | );
|
19095 20091 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19096 20092 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19097 20093 | http_response.headers(),
|
19098 20094 | expected_headers,
|
19099 20095 | ));
|
19100 20096 | }
|
19101 20097 | }
|
19102 20098 |
|
19103 20099 | /// Malformed values in query parameters should be rejected
|
19104 20100 | /// Test ID: RestJsonQueryByteMalformedValueRejected_case2
|
19105 20101 | #[::tokio::test]
|
19106 20102 | #[::tracing_test::traced_test]
|
19107 20103 | async fn rest_json_query_byte_malformed_value_rejected_case2_malformed_request() {
|
19108 20104 | {
|
19109 20105 | #[allow(unused_mut)]
|
19110 - | let mut http_request = http::Request::builder()
|
20106 + | let mut http_request = ::http_1x::Request::builder()
|
19111 20107 | .uri("/MalformedByte/1")
|
19112 20108 | .method("POST")
|
19113 - | .body(::aws_smithy_http_server::body::Body::empty())
|
20109 + | .body(::aws_smithy_http_server::body::boxed(
|
20110 + | ::http_body_util::Empty::new(),
|
20111 + | ))
|
19114 20112 | .unwrap();
|
19115 20113 | *http_request.uri_mut() = "/MalformedByte/1?byteInQuery=2ABC".parse().unwrap();
|
19116 20114 | #[allow(unused_mut)]
|
19117 20115 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19118 20116 | let config = crate::service::RestJsonConfig::builder().build();
|
19119 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20117 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19120 20118 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
19121 20119 | let sender = sender.clone();
|
19122 20120 | async move {
|
19123 20121 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
19124 20122 | sender.send(()).await.expect("receiver dropped early");
|
19125 20123 | result
|
19126 20124 | }
|
19127 20125 | })
|
19128 20126 | .build_unchecked();
|
19129 20127 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19130 20128 | .await
|
19131 20129 | .expect("unable to make an HTTP request");
|
19132 20130 | ::pretty_assertions::assert_eq!(
|
19133 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20131 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19134 20132 | http_response.status()
|
19135 20133 | );
|
19136 20134 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19137 20135 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19138 20136 | http_response.headers(),
|
19139 20137 | expected_headers,
|
19140 20138 | ));
|
19141 20139 | }
|
19142 20140 | }
|
19143 20141 |
|
19144 20142 | /// Malformed values in query parameters should be rejected
|
19145 20143 | /// Test ID: RestJsonQueryByteMalformedValueRejected_case3
|
19146 20144 | #[::tokio::test]
|
19147 20145 | #[::tracing_test::traced_test]
|
19148 20146 | async fn rest_json_query_byte_malformed_value_rejected_case3_malformed_request() {
|
19149 20147 | {
|
19150 20148 | #[allow(unused_mut)]
|
19151 - | let mut http_request = http::Request::builder()
|
20149 + | let mut http_request = ::http_1x::Request::builder()
|
19152 20150 | .uri("/MalformedByte/1")
|
19153 20151 | .method("POST")
|
19154 - | .body(::aws_smithy_http_server::body::Body::empty())
|
20152 + | .body(::aws_smithy_http_server::body::boxed(
|
20153 + | ::http_body_util::Empty::new(),
|
20154 + | ))
|
19155 20155 | .unwrap();
|
19156 20156 | *http_request.uri_mut() = "/MalformedByte/1?byteInQuery=0x42".parse().unwrap();
|
19157 20157 | #[allow(unused_mut)]
|
19158 20158 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19159 20159 | let config = crate::service::RestJsonConfig::builder().build();
|
19160 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20160 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19161 20161 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
19162 20162 | let sender = sender.clone();
|
19163 20163 | async move {
|
19164 20164 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
19165 20165 | sender.send(()).await.expect("receiver dropped early");
|
19166 20166 | result
|
19167 20167 | }
|
19168 20168 | })
|
19169 20169 | .build_unchecked();
|
19170 20170 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19171 20171 | .await
|
19172 20172 | .expect("unable to make an HTTP request");
|
19173 20173 | ::pretty_assertions::assert_eq!(
|
19174 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20174 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19175 20175 | http_response.status()
|
19176 20176 | );
|
19177 20177 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19178 20178 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19179 20179 | http_response.headers(),
|
19180 20180 | expected_headers,
|
19181 20181 | ));
|
19182 20182 | }
|
19183 20183 | }
|
19184 20184 |
|
19185 20185 | /// Malformed values in query parameters should be rejected
|
19186 20186 | /// Test ID: RestJsonQueryByteMalformedValueRejected_case4
|
19187 20187 | #[::tokio::test]
|
19188 20188 | #[::tracing_test::traced_test]
|
19189 20189 | async fn rest_json_query_byte_malformed_value_rejected_case4_malformed_request() {
|
19190 20190 | {
|
19191 20191 | #[allow(unused_mut)]
|
19192 - | let mut http_request = http::Request::builder()
|
20192 + | let mut http_request = ::http_1x::Request::builder()
|
19193 20193 | .uri("/MalformedByte/1")
|
19194 20194 | .method("POST")
|
19195 - | .body(::aws_smithy_http_server::body::Body::empty())
|
20195 + | .body(::aws_smithy_http_server::body::boxed(
|
20196 + | ::http_body_util::Empty::new(),
|
20197 + | ))
|
19196 20198 | .unwrap();
|
19197 20199 | *http_request.uri_mut() = "/MalformedByte/1?byteInQuery=Infinity".parse().unwrap();
|
19198 20200 | #[allow(unused_mut)]
|
19199 20201 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19200 20202 | let config = crate::service::RestJsonConfig::builder().build();
|
19201 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20203 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19202 20204 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
19203 20205 | let sender = sender.clone();
|
19204 20206 | async move {
|
19205 20207 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
19206 20208 | sender.send(()).await.expect("receiver dropped early");
|
19207 20209 | result
|
19208 20210 | }
|
19209 20211 | })
|
19210 20212 | .build_unchecked();
|
19211 20213 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19212 20214 | .await
|
19213 20215 | .expect("unable to make an HTTP request");
|
19214 20216 | ::pretty_assertions::assert_eq!(
|
19215 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20217 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19216 20218 | http_response.status()
|
19217 20219 | );
|
19218 20220 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19219 20221 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19220 20222 | http_response.headers(),
|
19221 20223 | expected_headers,
|
19222 20224 | ));
|
19223 20225 | }
|
19224 20226 | }
|
19225 20227 |
|
19226 20228 | /// Malformed values in query parameters should be rejected
|
19227 20229 | /// Test ID: RestJsonQueryByteMalformedValueRejected_case5
|
19228 20230 | #[::tokio::test]
|
19229 20231 | #[::tracing_test::traced_test]
|
19230 20232 | async fn rest_json_query_byte_malformed_value_rejected_case5_malformed_request() {
|
19231 20233 | {
|
19232 20234 | #[allow(unused_mut)]
|
19233 - | let mut http_request = http::Request::builder()
|
20235 + | let mut http_request = ::http_1x::Request::builder()
|
19234 20236 | .uri("/MalformedByte/1")
|
19235 20237 | .method("POST")
|
19236 - | .body(::aws_smithy_http_server::body::Body::empty())
|
20238 + | .body(::aws_smithy_http_server::body::boxed(
|
20239 + | ::http_body_util::Empty::new(),
|
20240 + | ))
|
19237 20241 | .unwrap();
|
19238 20242 | *http_request.uri_mut() = "/MalformedByte/1?byteInQuery=-Infinity".parse().unwrap();
|
19239 20243 | #[allow(unused_mut)]
|
19240 20244 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19241 20245 | let config = crate::service::RestJsonConfig::builder().build();
|
19242 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20246 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19243 20247 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
19244 20248 | let sender = sender.clone();
|
19245 20249 | async move {
|
19246 20250 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
19247 20251 | sender.send(()).await.expect("receiver dropped early");
|
19248 20252 | result
|
19249 20253 | }
|
19250 20254 | })
|
19251 20255 | .build_unchecked();
|
19252 20256 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19253 20257 | .await
|
19254 20258 | .expect("unable to make an HTTP request");
|
19255 20259 | ::pretty_assertions::assert_eq!(
|
19256 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20260 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19257 20261 | http_response.status()
|
19258 20262 | );
|
19259 20263 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19260 20264 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19261 20265 | http_response.headers(),
|
19262 20266 | expected_headers,
|
19263 20267 | ));
|
19264 20268 | }
|
19265 20269 | }
|
19266 20270 |
|
19267 20271 | /// Malformed values in query parameters should be rejected
|
19268 20272 | /// Test ID: RestJsonQueryByteMalformedValueRejected_case6
|
19269 20273 | #[::tokio::test]
|
19270 20274 | #[::tracing_test::traced_test]
|
19271 20275 | async fn rest_json_query_byte_malformed_value_rejected_case6_malformed_request() {
|
19272 20276 | {
|
19273 20277 | #[allow(unused_mut)]
|
19274 - | let mut http_request = http::Request::builder()
|
20278 + | let mut http_request = ::http_1x::Request::builder()
|
19275 20279 | .uri("/MalformedByte/1")
|
19276 20280 | .method("POST")
|
19277 - | .body(::aws_smithy_http_server::body::Body::empty())
|
20281 + | .body(::aws_smithy_http_server::body::boxed(
|
20282 + | ::http_body_util::Empty::new(),
|
20283 + | ))
|
19278 20284 | .unwrap();
|
19279 20285 | *http_request.uri_mut() = "/MalformedByte/1?byteInQuery=NaN".parse().unwrap();
|
19280 20286 | #[allow(unused_mut)]
|
19281 20287 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19282 20288 | let config = crate::service::RestJsonConfig::builder().build();
|
19283 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20289 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19284 20290 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
19285 20291 | let sender = sender.clone();
|
19286 20292 | async move {
|
19287 20293 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
19288 20294 | sender.send(()).await.expect("receiver dropped early");
|
19289 20295 | result
|
19290 20296 | }
|
19291 20297 | })
|
19292 20298 | .build_unchecked();
|
19293 20299 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19294 20300 | .await
|
19295 20301 | .expect("unable to make an HTTP request");
|
19296 20302 | ::pretty_assertions::assert_eq!(
|
19297 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20303 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19298 20304 | http_response.status()
|
19299 20305 | );
|
19300 20306 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19301 20307 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19302 20308 | http_response.headers(),
|
19303 20309 | expected_headers,
|
19304 20310 | ));
|
19305 20311 | }
|
19306 20312 | }
|
19307 20313 |
|
19308 20314 | /// Malformed values in headers should be rejected
|
19309 20315 | /// Test ID: RestJsonHeaderByteMalformedValueRejected_case0
|
19310 20316 | #[::tokio::test]
|
19311 20317 | #[::tracing_test::traced_test]
|
19312 20318 | async fn rest_json_header_byte_malformed_value_rejected_case0_malformed_request() {
|
19313 20319 | {
|
19314 20320 | #[allow(unused_mut)]
|
19315 - | let mut http_request = http::Request::builder()
|
20321 + | let mut http_request = ::http_1x::Request::builder()
|
19316 20322 | .uri("/MalformedByte/1")
|
19317 20323 | .method("POST")
|
19318 20324 | .header("byteInHeader", "true")
|
19319 - | .body(::aws_smithy_http_server::body::Body::empty())
|
20325 + | .body(::aws_smithy_http_server::body::boxed(
|
20326 + | ::http_body_util::Empty::new(),
|
20327 + | ))
|
19320 20328 | .unwrap();
|
19321 20329 | #[allow(unused_mut)]
|
19322 20330 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19323 20331 | let config = crate::service::RestJsonConfig::builder().build();
|
19324 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20332 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19325 20333 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
19326 20334 | let sender = sender.clone();
|
19327 20335 | async move {
|
19328 20336 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
19329 20337 | sender.send(()).await.expect("receiver dropped early");
|
19330 20338 | result
|
19331 20339 | }
|
19332 20340 | })
|
19333 20341 | .build_unchecked();
|
19334 20342 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19335 20343 | .await
|
19336 20344 | .expect("unable to make an HTTP request");
|
19337 20345 | ::pretty_assertions::assert_eq!(
|
19338 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20346 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19339 20347 | http_response.status()
|
19340 20348 | );
|
19341 20349 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19342 20350 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19343 20351 | http_response.headers(),
|
19344 20352 | expected_headers,
|
19345 20353 | ));
|
19346 20354 | }
|
19347 20355 | }
|
19348 20356 |
|
19349 20357 | /// Malformed values in headers should be rejected
|
19350 20358 | /// Test ID: RestJsonHeaderByteMalformedValueRejected_case1
|
19351 20359 | #[::tokio::test]
|
19352 20360 | #[::tracing_test::traced_test]
|
19353 20361 | async fn rest_json_header_byte_malformed_value_rejected_case1_malformed_request() {
|
19354 20362 | {
|
19355 20363 | #[allow(unused_mut)]
|
19356 - | let mut http_request = http::Request::builder()
|
20364 + | let mut http_request = ::http_1x::Request::builder()
|
19357 20365 | .uri("/MalformedByte/1")
|
19358 20366 | .method("POST")
|
19359 20367 | .header("byteInHeader", "1.001")
|
19360 - | .body(::aws_smithy_http_server::body::Body::empty())
|
20368 + | .body(::aws_smithy_http_server::body::boxed(
|
20369 + | ::http_body_util::Empty::new(),
|
20370 + | ))
|
19361 20371 | .unwrap();
|
19362 20372 | #[allow(unused_mut)]
|
19363 20373 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19364 20374 | let config = crate::service::RestJsonConfig::builder().build();
|
19365 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20375 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19366 20376 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
19367 20377 | let sender = sender.clone();
|
19368 20378 | async move {
|
19369 20379 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
19370 20380 | sender.send(()).await.expect("receiver dropped early");
|
19371 20381 | result
|
19372 20382 | }
|
19373 20383 | })
|
19374 20384 | .build_unchecked();
|
19375 20385 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19376 20386 | .await
|
19377 20387 | .expect("unable to make an HTTP request");
|
19378 20388 | ::pretty_assertions::assert_eq!(
|
19379 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20389 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19380 20390 | http_response.status()
|
19381 20391 | );
|
19382 20392 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19383 20393 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19384 20394 | http_response.headers(),
|
19385 20395 | expected_headers,
|
19386 20396 | ));
|
19387 20397 | }
|
19388 20398 | }
|
19389 20399 |
|
19390 20400 | /// Malformed values in headers should be rejected
|
19391 20401 | /// Test ID: RestJsonHeaderByteMalformedValueRejected_case2
|
19392 20402 | #[::tokio::test]
|
19393 20403 | #[::tracing_test::traced_test]
|
19394 20404 | async fn rest_json_header_byte_malformed_value_rejected_case2_malformed_request() {
|
19395 20405 | {
|
19396 20406 | #[allow(unused_mut)]
|
19397 - | let mut http_request = http::Request::builder()
|
20407 + | let mut http_request = ::http_1x::Request::builder()
|
19398 20408 | .uri("/MalformedByte/1")
|
19399 20409 | .method("POST")
|
19400 20410 | .header("byteInHeader", "2ABC")
|
19401 - | .body(::aws_smithy_http_server::body::Body::empty())
|
20411 + | .body(::aws_smithy_http_server::body::boxed(
|
20412 + | ::http_body_util::Empty::new(),
|
20413 + | ))
|
19402 20414 | .unwrap();
|
19403 20415 | #[allow(unused_mut)]
|
19404 20416 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19405 20417 | let config = crate::service::RestJsonConfig::builder().build();
|
19406 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20418 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19407 20419 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
19408 20420 | let sender = sender.clone();
|
19409 20421 | async move {
|
19410 20422 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
19411 20423 | sender.send(()).await.expect("receiver dropped early");
|
19412 20424 | result
|
19413 20425 | }
|
19414 20426 | })
|
19415 20427 | .build_unchecked();
|
19416 20428 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19417 20429 | .await
|
19418 20430 | .expect("unable to make an HTTP request");
|
19419 20431 | ::pretty_assertions::assert_eq!(
|
19420 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20432 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19421 20433 | http_response.status()
|
19422 20434 | );
|
19423 20435 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19424 20436 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19425 20437 | http_response.headers(),
|
19426 20438 | expected_headers,
|
19427 20439 | ));
|
19428 20440 | }
|
19429 20441 | }
|
19430 20442 |
|
19431 20443 | /// Malformed values in headers should be rejected
|
19432 20444 | /// Test ID: RestJsonHeaderByteMalformedValueRejected_case3
|
19433 20445 | #[::tokio::test]
|
19434 20446 | #[::tracing_test::traced_test]
|
19435 20447 | async fn rest_json_header_byte_malformed_value_rejected_case3_malformed_request() {
|
19436 20448 | {
|
19437 20449 | #[allow(unused_mut)]
|
19438 - | let mut http_request = http::Request::builder()
|
20450 + | let mut http_request = ::http_1x::Request::builder()
|
19439 20451 | .uri("/MalformedByte/1")
|
19440 20452 | .method("POST")
|
19441 20453 | .header("byteInHeader", "0x42")
|
19442 - | .body(::aws_smithy_http_server::body::Body::empty())
|
20454 + | .body(::aws_smithy_http_server::body::boxed(
|
20455 + | ::http_body_util::Empty::new(),
|
20456 + | ))
|
19443 20457 | .unwrap();
|
19444 20458 | #[allow(unused_mut)]
|
19445 20459 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19446 20460 | let config = crate::service::RestJsonConfig::builder().build();
|
19447 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20461 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19448 20462 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
19449 20463 | let sender = sender.clone();
|
19450 20464 | async move {
|
19451 20465 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
19452 20466 | sender.send(()).await.expect("receiver dropped early");
|
19453 20467 | result
|
19454 20468 | }
|
19455 20469 | })
|
19456 20470 | .build_unchecked();
|
19457 20471 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19458 20472 | .await
|
19459 20473 | .expect("unable to make an HTTP request");
|
19460 20474 | ::pretty_assertions::assert_eq!(
|
19461 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20475 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19462 20476 | http_response.status()
|
19463 20477 | );
|
19464 20478 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19465 20479 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19466 20480 | http_response.headers(),
|
19467 20481 | expected_headers,
|
19468 20482 | ));
|
19469 20483 | }
|
19470 20484 | }
|
19471 20485 |
|
19472 20486 | /// Malformed values in headers should be rejected
|
19473 20487 | /// Test ID: RestJsonHeaderByteMalformedValueRejected_case4
|
19474 20488 | #[::tokio::test]
|
19475 20489 | #[::tracing_test::traced_test]
|
19476 20490 | async fn rest_json_header_byte_malformed_value_rejected_case4_malformed_request() {
|
19477 20491 | {
|
19478 20492 | #[allow(unused_mut)]
|
19479 - | let mut http_request = http::Request::builder()
|
20493 + | let mut http_request = ::http_1x::Request::builder()
|
19480 20494 | .uri("/MalformedByte/1")
|
19481 20495 | .method("POST")
|
19482 20496 | .header("byteInHeader", "Infinity")
|
19483 - | .body(::aws_smithy_http_server::body::Body::empty())
|
20497 + | .body(::aws_smithy_http_server::body::boxed(
|
20498 + | ::http_body_util::Empty::new(),
|
20499 + | ))
|
19484 20500 | .unwrap();
|
19485 20501 | #[allow(unused_mut)]
|
19486 20502 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19487 20503 | let config = crate::service::RestJsonConfig::builder().build();
|
19488 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20504 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19489 20505 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
19490 20506 | let sender = sender.clone();
|
19491 20507 | async move {
|
19492 20508 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
19493 20509 | sender.send(()).await.expect("receiver dropped early");
|
19494 20510 | result
|
19495 20511 | }
|
19496 20512 | })
|
19497 20513 | .build_unchecked();
|
19498 20514 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19499 20515 | .await
|
19500 20516 | .expect("unable to make an HTTP request");
|
19501 20517 | ::pretty_assertions::assert_eq!(
|
19502 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20518 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19503 20519 | http_response.status()
|
19504 20520 | );
|
19505 20521 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19506 20522 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19507 20523 | http_response.headers(),
|
19508 20524 | expected_headers,
|
19509 20525 | ));
|
19510 20526 | }
|
19511 20527 | }
|
19512 20528 |
|
19513 20529 | /// Malformed values in headers should be rejected
|
19514 20530 | /// Test ID: RestJsonHeaderByteMalformedValueRejected_case5
|
19515 20531 | #[::tokio::test]
|
19516 20532 | #[::tracing_test::traced_test]
|
19517 20533 | async fn rest_json_header_byte_malformed_value_rejected_case5_malformed_request() {
|
19518 20534 | {
|
19519 20535 | #[allow(unused_mut)]
|
19520 - | let mut http_request = http::Request::builder()
|
20536 + | let mut http_request = ::http_1x::Request::builder()
|
19521 20537 | .uri("/MalformedByte/1")
|
19522 20538 | .method("POST")
|
19523 20539 | .header("byteInHeader", "-Infinity")
|
19524 - | .body(::aws_smithy_http_server::body::Body::empty())
|
20540 + | .body(::aws_smithy_http_server::body::boxed(
|
20541 + | ::http_body_util::Empty::new(),
|
20542 + | ))
|
19525 20543 | .unwrap();
|
19526 20544 | #[allow(unused_mut)]
|
19527 20545 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19528 20546 | let config = crate::service::RestJsonConfig::builder().build();
|
19529 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20547 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19530 20548 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
19531 20549 | let sender = sender.clone();
|
19532 20550 | async move {
|
19533 20551 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
19534 20552 | sender.send(()).await.expect("receiver dropped early");
|
19535 20553 | result
|
19536 20554 | }
|
19537 20555 | })
|
19538 20556 | .build_unchecked();
|
19539 20557 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19540 20558 | .await
|
19541 20559 | .expect("unable to make an HTTP request");
|
19542 20560 | ::pretty_assertions::assert_eq!(
|
19543 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20561 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19544 20562 | http_response.status()
|
19545 20563 | );
|
19546 20564 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19547 20565 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19548 20566 | http_response.headers(),
|
19549 20567 | expected_headers,
|
19550 20568 | ));
|
19551 20569 | }
|
19552 20570 | }
|
19553 20571 |
|
19554 20572 | /// Malformed values in headers should be rejected
|
19555 20573 | /// Test ID: RestJsonHeaderByteMalformedValueRejected_case6
|
19556 20574 | #[::tokio::test]
|
19557 20575 | #[::tracing_test::traced_test]
|
19558 20576 | async fn rest_json_header_byte_malformed_value_rejected_case6_malformed_request() {
|
19559 20577 | {
|
19560 20578 | #[allow(unused_mut)]
|
19561 - | let mut http_request = http::Request::builder()
|
20579 + | let mut http_request = ::http_1x::Request::builder()
|
19562 20580 | .uri("/MalformedByte/1")
|
19563 20581 | .method("POST")
|
19564 20582 | .header("byteInHeader", "NaN")
|
19565 - | .body(::aws_smithy_http_server::body::Body::empty())
|
20583 + | .body(::aws_smithy_http_server::body::boxed(
|
20584 + | ::http_body_util::Empty::new(),
|
20585 + | ))
|
19566 20586 | .unwrap();
|
19567 20587 | #[allow(unused_mut)]
|
19568 20588 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19569 20589 | let config = crate::service::RestJsonConfig::builder().build();
|
19570 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20590 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19571 20591 | .malformed_byte(move |input: crate::input::MalformedByteInput| {
|
19572 20592 | let sender = sender.clone();
|
19573 20593 | async move {
|
19574 20594 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedByteOutput, crate::error::MalformedByteError> };
|
19575 20595 | sender.send(()).await.expect("receiver dropped early");
|
19576 20596 | result
|
19577 20597 | }
|
19578 20598 | })
|
19579 20599 | .build_unchecked();
|
19580 20600 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19581 20601 | .await
|
19582 20602 | .expect("unable to make an HTTP request");
|
19583 20603 | ::pretty_assertions::assert_eq!(
|
19584 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20604 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19585 20605 | http_response.status()
|
19586 20606 | );
|
19587 20607 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19588 20608 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19589 20609 | http_response.headers(),
|
19590 20610 | expected_headers,
|
19591 20611 | ));
|
19592 20612 | }
|
19593 20613 | }
|
20614 + |
|
20615 + | /* ProtocolTestGenerator.kt:98 */
|
19594 20616 | }
|
19595 20617 |
|
20618 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
19596 20619 | ::pin_project_lite::pin_project! {
|
19597 20620 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
19598 20621 | /// [`MalformedBlobInput`](crate::input::MalformedBlobInput) using modelled bindings.
|
19599 20622 | pub struct MalformedBlobInputFuture {
|
19600 20623 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedBlobInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
19601 20624 | }
|
19602 20625 | }
|
19603 20626 |
|
19604 20627 | impl std::future::Future for MalformedBlobInputFuture {
|
19605 20628 | type Output = Result<
|
19606 20629 | crate::input::MalformedBlobInput,
|
19607 20630 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
19608 20631 | >;
|
19609 20632 |
|
19610 20633 | fn poll(
|
19611 20634 | self: std::pin::Pin<&mut Self>,
|
19612 20635 | cx: &mut std::task::Context<'_>,
|
19613 20636 | ) -> std::task::Poll<Self::Output> {
|
19614 20637 | let this = self.project();
|
19615 20638 | this.inner.as_mut().poll(cx)
|
19616 20639 | }
|
19617 20640 | }
|
19618 20641 |
|
19619 20642 | impl<B>
|
19620 20643 | ::aws_smithy_http_server::request::FromRequest<
|
19621 20644 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
19622 20645 | B,
|
19623 20646 | > for crate::input::MalformedBlobInput
|
19624 20647 | where
|
19625 20648 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
19626 20649 | B: 'static,
|
19627 20650 |
|
19628 20651 | B::Data: Send,
|
19629 20652 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
19630 20653 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
19631 20654 | {
|
19632 20655 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
19633 20656 | type Future = MalformedBlobInputFuture;
|
19634 20657 |
|
19635 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
20658 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
19636 20659 | let fut = async move {
|
19637 20660 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
19638 20661 | request.headers(),
|
19639 20662 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
19640 20663 | ) {
|
19641 20664 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
19642 20665 | }
|
19643 20666 | crate::protocol_serde::shape_malformed_blob::de_malformed_blob_http_request(request)
|
19644 20667 | .await
|
19645 20668 | };
|
19646 20669 | use ::futures_util::future::TryFutureExt;
|
19647 20670 | let fut = fut.map_err(
|
19648 20671 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
19649 20672 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
19650 20673 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
19651 20674 | e,
|
19652 20675 | )
|
19653 20676 | },
|
19654 20677 | );
|
19655 20678 | MalformedBlobInputFuture {
|
19656 20679 | inner: Box::pin(fut),
|
19657 20680 | }
|
19658 20681 | }
|
19659 20682 | }
|
20683 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
19660 20684 | impl
|
19661 20685 | ::aws_smithy_http_server::response::IntoResponse<
|
19662 20686 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
19663 20687 | > for crate::output::MalformedBlobOutput
|
19664 20688 | {
|
19665 20689 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
19666 20690 | match crate::protocol_serde::shape_malformed_blob::ser_malformed_blob_http_response(self) {
|
19667 20691 | Ok(response) => response,
|
19668 20692 | Err(e) => {
|
19669 20693 | ::tracing::error!(error = %e, "failed to serialize response");
|
19670 20694 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
19671 20695 | }
|
19672 20696 | }
|
19673 20697 | }
|
19674 20698 | }
|
19675 20699 |
|
20700 + | /* RustType.kt:534 */
|
19676 20701 | #[allow(unreachable_code, unused_variables)]
|
20702 + | /* RustType.kt:534 */
|
19677 20703 | #[cfg(test)]
|
20704 + | /* ProtocolTestGenerator.kt:98 */
|
19678 20705 | mod malformed_blob_test {
|
19679 20706 |
|
19680 20707 | /// When a blob member is not properly base64 encoded, or not encoded at
|
19681 20708 | /// all, the response should be a 400 SerializationException.
|
19682 20709 | /// Test ID: RestJsonBodyMalformedBlobInvalidBase64_case0
|
19683 20710 | #[::tokio::test]
|
19684 20711 | #[::tracing_test::traced_test]
|
19685 20712 | async fn rest_json_body_malformed_blob_invalid_base64_case0_malformed_request() {
|
19686 20713 | {
|
19687 20714 | #[allow(unused_mut)]
|
19688 - | let mut http_request = http::Request::builder()
|
20715 + | let mut http_request = ::http_1x::Request::builder()
|
19689 20716 | .uri("/MalformedBlob")
|
19690 20717 | .method("POST")
|
19691 20718 | .header("content-type", "application/json")
|
19692 - | .body(::aws_smithy_http_server::body::Body::from(
|
19693 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
19694 - | "{ \"blob\" : blob }".as_bytes(),
|
19695 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
20719 + | .body(::aws_smithy_http_server::body::boxed(
|
20720 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
20721 + | &::aws_smithy_protocol_test::decode_body_data(
|
20722 + | "{ \"blob\" : blob }".as_bytes(),
|
20723 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
20724 + | ),
|
19696 20725 | )),
|
19697 20726 | ))
|
19698 20727 | .unwrap();
|
19699 20728 | #[allow(unused_mut)]
|
19700 20729 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19701 20730 | let config = crate::service::RestJsonConfig::builder().build();
|
19702 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20731 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19703 20732 | .malformed_blob(move |input: crate::input::MalformedBlobInput| {
|
19704 20733 | let sender = sender.clone();
|
19705 20734 | async move {
|
19706 20735 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedBlobOutput };
|
19707 20736 | sender.send(()).await.expect("receiver dropped early");
|
19708 20737 | result
|
19709 20738 | }
|
19710 20739 | })
|
19711 20740 | .build_unchecked();
|
19712 20741 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19713 20742 | .await
|
19714 20743 | .expect("unable to make an HTTP request");
|
19715 20744 | ::pretty_assertions::assert_eq!(
|
19716 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20745 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19717 20746 | http_response.status()
|
19718 20747 | );
|
19719 20748 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19720 20749 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19721 20750 | http_response.headers(),
|
19722 20751 | expected_headers,
|
19723 20752 | ));
|
19724 20753 | }
|
19725 20754 | }
|
19726 20755 |
|
19727 20756 | /// When a blob member is not properly base64 encoded, or not encoded at
|
19728 20757 | /// all, the response should be a 400 SerializationException.
|
19729 20758 | /// Test ID: RestJsonBodyMalformedBlobInvalidBase64_case1
|
19730 20759 | #[::tokio::test]
|
19731 20760 | #[::tracing_test::traced_test]
|
19732 20761 | async fn rest_json_body_malformed_blob_invalid_base64_case1_malformed_request() {
|
19733 20762 | {
|
19734 20763 | #[allow(unused_mut)]
|
19735 - | let mut http_request = http::Request::builder()
|
20764 + | let mut http_request = ::http_1x::Request::builder()
|
19736 20765 | .uri("/MalformedBlob")
|
19737 20766 | .method("POST")
|
19738 20767 | .header("content-type", "application/json")
|
19739 - | .body(::aws_smithy_http_server::body::Body::from(
|
19740 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
19741 - | "{ \"blob\" : \"xyz\" }".as_bytes(),
|
19742 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
20768 + | .body(::aws_smithy_http_server::body::boxed(
|
20769 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
20770 + | &::aws_smithy_protocol_test::decode_body_data(
|
20771 + | "{ \"blob\" : \"xyz\" }".as_bytes(),
|
20772 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
20773 + | ),
|
19743 20774 | )),
|
19744 20775 | ))
|
19745 20776 | .unwrap();
|
19746 20777 | #[allow(unused_mut)]
|
19747 20778 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19748 20779 | let config = crate::service::RestJsonConfig::builder().build();
|
19749 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20780 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19750 20781 | .malformed_blob(move |input: crate::input::MalformedBlobInput| {
|
19751 20782 | let sender = sender.clone();
|
19752 20783 | async move {
|
19753 20784 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedBlobOutput };
|
19754 20785 | sender.send(()).await.expect("receiver dropped early");
|
19755 20786 | result
|
19756 20787 | }
|
19757 20788 | })
|
19758 20789 | .build_unchecked();
|
19759 20790 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19760 20791 | .await
|
19761 20792 | .expect("unable to make an HTTP request");
|
19762 20793 | ::pretty_assertions::assert_eq!(
|
19763 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20794 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19764 20795 | http_response.status()
|
19765 20796 | );
|
19766 20797 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19767 20798 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19768 20799 | http_response.headers(),
|
19769 20800 | expected_headers,
|
19770 20801 | ));
|
19771 20802 | }
|
19772 20803 | }
|
19773 20804 |
|
19774 20805 | /// When a blob member is not properly base64 encoded, or not encoded at
|
19775 20806 | /// all, the response should be a 400 SerializationException.
|
19776 20807 | /// Test ID: RestJsonBodyMalformedBlobInvalidBase64_case2
|
19777 20808 | #[::tokio::test]
|
19778 20809 | #[::tracing_test::traced_test]
|
19779 20810 | async fn rest_json_body_malformed_blob_invalid_base64_case2_malformed_request() {
|
19780 20811 | {
|
19781 20812 | #[allow(unused_mut)]
|
19782 - | let mut http_request = http::Request::builder()
|
20813 + | let mut http_request = ::http_1x::Request::builder()
|
19783 20814 | .uri("/MalformedBlob")
|
19784 20815 | .method("POST")
|
19785 20816 | .header("content-type", "application/json")
|
19786 - | .body(::aws_smithy_http_server::body::Body::from(
|
19787 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
19788 - | "{ \"blob\" : \"YmxvYg=\" }".as_bytes(),
|
19789 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
20817 + | .body(::aws_smithy_http_server::body::boxed(
|
20818 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
20819 + | &::aws_smithy_protocol_test::decode_body_data(
|
20820 + | "{ \"blob\" : \"YmxvYg=\" }".as_bytes(),
|
20821 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
20822 + | ),
|
19790 20823 | )),
|
19791 20824 | ))
|
19792 20825 | .unwrap();
|
19793 20826 | #[allow(unused_mut)]
|
19794 20827 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19795 20828 | let config = crate::service::RestJsonConfig::builder().build();
|
19796 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20829 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19797 20830 | .malformed_blob(move |input: crate::input::MalformedBlobInput| {
|
19798 20831 | let sender = sender.clone();
|
19799 20832 | async move {
|
19800 20833 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedBlobOutput };
|
19801 20834 | sender.send(()).await.expect("receiver dropped early");
|
19802 20835 | result
|
19803 20836 | }
|
19804 20837 | })
|
19805 20838 | .build_unchecked();
|
19806 20839 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19807 20840 | .await
|
19808 20841 | .expect("unable to make an HTTP request");
|
19809 20842 | ::pretty_assertions::assert_eq!(
|
19810 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20843 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19811 20844 | http_response.status()
|
19812 20845 | );
|
19813 20846 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19814 20847 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19815 20848 | http_response.headers(),
|
19816 20849 | expected_headers,
|
19817 20850 | ));
|
19818 20851 | }
|
19819 20852 | }
|
19820 20853 |
|
19821 20854 | /// When a blob member is not properly base64 encoded, or not encoded at
|
19822 20855 | /// all, the response should be a 400 SerializationException.
|
19823 20856 | /// Test ID: RestJsonBodyMalformedBlobInvalidBase64_case3
|
19824 20857 | #[::tokio::test]
|
19825 20858 | #[::tracing_test::traced_test]
|
19826 20859 | async fn rest_json_body_malformed_blob_invalid_base64_case3_malformed_request() {
|
19827 20860 | {
|
19828 20861 | #[allow(unused_mut)]
|
19829 - | let mut http_request = http::Request::builder()
|
20862 + | let mut http_request = ::http_1x::Request::builder()
|
19830 20863 | .uri("/MalformedBlob")
|
19831 20864 | .method("POST")
|
19832 20865 | .header("content-type", "application/json")
|
19833 - | .body(::aws_smithy_http_server::body::Body::from(
|
19834 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
19835 - | "{ \"blob\" : [98, 108, 11, 98] }".as_bytes(),
|
19836 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
20866 + | .body(::aws_smithy_http_server::body::boxed(
|
20867 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
20868 + | &::aws_smithy_protocol_test::decode_body_data(
|
20869 + | "{ \"blob\" : [98, 108, 11, 98] }".as_bytes(),
|
20870 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
20871 + | ),
|
19837 20872 | )),
|
19838 20873 | ))
|
19839 20874 | .unwrap();
|
19840 20875 | #[allow(unused_mut)]
|
19841 20876 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19842 20877 | let config = crate::service::RestJsonConfig::builder().build();
|
19843 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20878 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19844 20879 | .malformed_blob(move |input: crate::input::MalformedBlobInput| {
|
19845 20880 | let sender = sender.clone();
|
19846 20881 | async move {
|
19847 20882 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedBlobOutput };
|
19848 20883 | sender.send(()).await.expect("receiver dropped early");
|
19849 20884 | result
|
19850 20885 | }
|
19851 20886 | })
|
19852 20887 | .build_unchecked();
|
19853 20888 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19854 20889 | .await
|
19855 20890 | .expect("unable to make an HTTP request");
|
19856 20891 | ::pretty_assertions::assert_eq!(
|
19857 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20892 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19858 20893 | http_response.status()
|
19859 20894 | );
|
19860 20895 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19861 20896 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19862 20897 | http_response.headers(),
|
19863 20898 | expected_headers,
|
19864 20899 | ));
|
19865 20900 | }
|
19866 20901 | }
|
19867 20902 |
|
19868 20903 | /// When a blob member is not properly base64 encoded, or not encoded at
|
19869 20904 | /// all, the response should be a 400 SerializationException.
|
19870 20905 | /// Test ID: RestJsonBodyMalformedBlobInvalidBase64_case4
|
19871 20906 | #[::tokio::test]
|
19872 20907 | #[::tracing_test::traced_test]
|
19873 20908 | async fn rest_json_body_malformed_blob_invalid_base64_case4_malformed_request() {
|
19874 20909 | {
|
19875 20910 | #[allow(unused_mut)]
|
19876 - | let mut http_request = http::Request::builder()
|
20911 + | let mut http_request = ::http_1x::Request::builder()
|
19877 20912 | .uri("/MalformedBlob")
|
19878 20913 | .method("POST")
|
19879 20914 | .header("content-type", "application/json")
|
19880 - | .body(::aws_smithy_http_server::body::Body::from(
|
19881 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
19882 - | "{ \"blob\" : [\"b\", \"l\",\"o\",\"b\"] }".as_bytes(),
|
19883 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
20915 + | .body(::aws_smithy_http_server::body::boxed(
|
20916 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
20917 + | &::aws_smithy_protocol_test::decode_body_data(
|
20918 + | "{ \"blob\" : [\"b\", \"l\",\"o\",\"b\"] }".as_bytes(),
|
20919 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
20920 + | ),
|
19884 20921 | )),
|
19885 20922 | ))
|
19886 20923 | .unwrap();
|
19887 20924 | #[allow(unused_mut)]
|
19888 20925 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19889 20926 | let config = crate::service::RestJsonConfig::builder().build();
|
19890 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20927 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19891 20928 | .malformed_blob(move |input: crate::input::MalformedBlobInput| {
|
19892 20929 | let sender = sender.clone();
|
19893 20930 | async move {
|
19894 20931 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedBlobOutput };
|
19895 20932 | sender.send(()).await.expect("receiver dropped early");
|
19896 20933 | result
|
19897 20934 | }
|
19898 20935 | })
|
19899 20936 | .build_unchecked();
|
19900 20937 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19901 20938 | .await
|
19902 20939 | .expect("unable to make an HTTP request");
|
19903 20940 | ::pretty_assertions::assert_eq!(
|
19904 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20941 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19905 20942 | http_response.status()
|
19906 20943 | );
|
19907 20944 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19908 20945 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19909 20946 | http_response.headers(),
|
19910 20947 | expected_headers,
|
19911 20948 | ));
|
19912 20949 | }
|
19913 20950 | }
|
19914 20951 |
|
19915 20952 | /// When a blob member is not properly base64 encoded, or not encoded at
|
19916 20953 | /// all, the response should be a 400 SerializationException.
|
19917 20954 | /// Test ID: RestJsonBodyMalformedBlobInvalidBase64_case5
|
19918 20955 | #[::tokio::test]
|
19919 20956 | #[::tracing_test::traced_test]
|
19920 20957 | async fn rest_json_body_malformed_blob_invalid_base64_case5_malformed_request() {
|
19921 20958 | {
|
19922 20959 | #[allow(unused_mut)]
|
19923 - | let mut http_request = http::Request::builder()
|
20960 + | let mut http_request = ::http_1x::Request::builder()
|
19924 20961 | .uri("/MalformedBlob")
|
19925 20962 | .method("POST")
|
19926 20963 | .header("content-type", "application/json")
|
19927 - | .body(::aws_smithy_http_server::body::Body::from(
|
19928 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
19929 - | "{ \"blob\" : 981081198 }".as_bytes(),
|
19930 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
20964 + | .body(::aws_smithy_http_server::body::boxed(
|
20965 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
20966 + | &::aws_smithy_protocol_test::decode_body_data(
|
20967 + | "{ \"blob\" : 981081198 }".as_bytes(),
|
20968 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
20969 + | ),
|
19931 20970 | )),
|
19932 20971 | ))
|
19933 20972 | .unwrap();
|
19934 20973 | #[allow(unused_mut)]
|
19935 20974 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19936 20975 | let config = crate::service::RestJsonConfig::builder().build();
|
19937 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
20976 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19938 20977 | .malformed_blob(move |input: crate::input::MalformedBlobInput| {
|
19939 20978 | let sender = sender.clone();
|
19940 20979 | async move {
|
19941 20980 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedBlobOutput };
|
19942 20981 | sender.send(()).await.expect("receiver dropped early");
|
19943 20982 | result
|
19944 20983 | }
|
19945 20984 | })
|
19946 20985 | .build_unchecked();
|
19947 20986 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19948 20987 | .await
|
19949 20988 | .expect("unable to make an HTTP request");
|
19950 20989 | ::pretty_assertions::assert_eq!(
|
19951 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20990 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19952 20991 | http_response.status()
|
19953 20992 | );
|
19954 20993 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
19955 20994 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
19956 20995 | http_response.headers(),
|
19957 20996 | expected_headers,
|
19958 20997 | ));
|
19959 20998 | }
|
19960 20999 | }
|
19961 21000 |
|
19962 21001 | /// When a blob member is not properly base64 encoded, or not encoded at
|
19963 21002 | /// all, the response should be a 400 SerializationException.
|
19964 21003 | /// Test ID: RestJsonBodyMalformedBlobInvalidBase64_case6
|
19965 21004 | #[::tokio::test]
|
19966 21005 | #[::tracing_test::traced_test]
|
19967 21006 | async fn rest_json_body_malformed_blob_invalid_base64_case6_malformed_request() {
|
19968 21007 | {
|
19969 21008 | #[allow(unused_mut)]
|
19970 - | let mut http_request = http::Request::builder()
|
21009 + | let mut http_request = ::http_1x::Request::builder()
|
19971 21010 | .uri("/MalformedBlob")
|
19972 21011 | .method("POST")
|
19973 21012 | .header("content-type", "application/json")
|
19974 - | .body(::aws_smithy_http_server::body::Body::from(
|
19975 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
19976 - | "{ \"blob\" : true }".as_bytes(),
|
19977 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21013 + | .body(::aws_smithy_http_server::body::boxed(
|
21014 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
21015 + | &::aws_smithy_protocol_test::decode_body_data(
|
21016 + | "{ \"blob\" : true }".as_bytes(),
|
21017 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21018 + | ),
|
19978 21019 | )),
|
19979 21020 | ))
|
19980 21021 | .unwrap();
|
19981 21022 | #[allow(unused_mut)]
|
19982 21023 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
19983 21024 | let config = crate::service::RestJsonConfig::builder().build();
|
19984 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
21025 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
19985 21026 | .malformed_blob(move |input: crate::input::MalformedBlobInput| {
|
19986 21027 | let sender = sender.clone();
|
19987 21028 | async move {
|
19988 21029 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedBlobOutput };
|
19989 21030 | sender.send(()).await.expect("receiver dropped early");
|
19990 21031 | result
|
19991 21032 | }
|
19992 21033 | })
|
19993 21034 | .build_unchecked();
|
19994 21035 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
19995 21036 | .await
|
19996 21037 | .expect("unable to make an HTTP request");
|
19997 21038 | ::pretty_assertions::assert_eq!(
|
19998 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21039 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
19999 21040 | http_response.status()
|
20000 21041 | );
|
20001 21042 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
20002 21043 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
20003 21044 | http_response.headers(),
|
20004 21045 | expected_headers,
|
20005 21046 | ));
|
20006 21047 | }
|
20007 21048 | }
|
20008 21049 |
|
20009 21050 | /// When a blob member is not properly base64 encoded, or not encoded at
|
20010 21051 | /// all, the response should be a 400 SerializationException.
|
20011 21052 | /// Test ID: RestJsonBodyMalformedBlobInvalidBase64_case7
|
20012 21053 | #[::tokio::test]
|
20013 21054 | #[::tracing_test::traced_test]
|
20014 21055 | async fn rest_json_body_malformed_blob_invalid_base64_case7_malformed_request() {
|
20015 21056 | {
|
20016 21057 | #[allow(unused_mut)]
|
20017 - | let mut http_request = http::Request::builder()
|
21058 + | let mut http_request = ::http_1x::Request::builder()
|
20018 21059 | .uri("/MalformedBlob")
|
20019 21060 | .method("POST")
|
20020 21061 | .header("content-type", "application/json")
|
20021 - | .body(::aws_smithy_http_server::body::Body::from(
|
20022 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
20023 - | "{ \"blob\" : [][] }".as_bytes(),
|
20024 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21062 + | .body(::aws_smithy_http_server::body::boxed(
|
21063 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
21064 + | &::aws_smithy_protocol_test::decode_body_data(
|
21065 + | "{ \"blob\" : [][] }".as_bytes(),
|
21066 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21067 + | ),
|
20025 21068 | )),
|
20026 21069 | ))
|
20027 21070 | .unwrap();
|
20028 21071 | #[allow(unused_mut)]
|
20029 21072 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
20030 21073 | let config = crate::service::RestJsonConfig::builder().build();
|
20031 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
21074 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
20032 21075 | .malformed_blob(move |input: crate::input::MalformedBlobInput| {
|
20033 21076 | let sender = sender.clone();
|
20034 21077 | async move {
|
20035 21078 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedBlobOutput };
|
20036 21079 | sender.send(()).await.expect("receiver dropped early");
|
20037 21080 | result
|
20038 21081 | }
|
20039 21082 | })
|
20040 21083 | .build_unchecked();
|
20041 21084 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
20042 21085 | .await
|
20043 21086 | .expect("unable to make an HTTP request");
|
20044 21087 | ::pretty_assertions::assert_eq!(
|
20045 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21088 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20046 21089 | http_response.status()
|
20047 21090 | );
|
20048 21091 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
20049 21092 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
20050 21093 | http_response.headers(),
|
20051 21094 | expected_headers,
|
20052 21095 | ));
|
20053 21096 | }
|
20054 21097 | }
|
20055 21098 |
|
20056 21099 | /// When a blob member is not properly base64 encoded, or not encoded at
|
20057 21100 | /// all, the response should be a 400 SerializationException.
|
20058 21101 | /// Test ID: RestJsonBodyMalformedBlobInvalidBase64_case8
|
20059 21102 | #[::tokio::test]
|
20060 21103 | #[::tracing_test::traced_test]
|
20061 21104 | async fn rest_json_body_malformed_blob_invalid_base64_case8_malformed_request() {
|
20062 21105 | {
|
20063 21106 | #[allow(unused_mut)]
|
20064 - | let mut http_request = http::Request::builder()
|
21107 + | let mut http_request = ::http_1x::Request::builder()
|
20065 21108 | .uri("/MalformedBlob")
|
20066 21109 | .method("POST")
|
20067 21110 | .header("content-type", "application/json")
|
20068 - | .body(::aws_smithy_http_server::body::Body::from(
|
20069 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
20070 - | "{ \"blob\" : -_== }".as_bytes(),
|
20071 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21111 + | .body(::aws_smithy_http_server::body::boxed(
|
21112 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
21113 + | &::aws_smithy_protocol_test::decode_body_data(
|
21114 + | "{ \"blob\" : -_== }".as_bytes(),
|
21115 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21116 + | ),
|
20072 21117 | )),
|
20073 21118 | ))
|
20074 21119 | .unwrap();
|
20075 21120 | #[allow(unused_mut)]
|
20076 21121 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
20077 21122 | let config = crate::service::RestJsonConfig::builder().build();
|
20078 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
21123 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
20079 21124 | .malformed_blob(move |input: crate::input::MalformedBlobInput| {
|
20080 21125 | let sender = sender.clone();
|
20081 21126 | async move {
|
20082 21127 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedBlobOutput };
|
20083 21128 | sender.send(()).await.expect("receiver dropped early");
|
20084 21129 | result
|
20085 21130 | }
|
20086 21131 | })
|
20087 21132 | .build_unchecked();
|
20088 21133 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
20089 21134 | .await
|
20090 21135 | .expect("unable to make an HTTP request");
|
20091 21136 | ::pretty_assertions::assert_eq!(
|
20092 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21137 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20093 21138 | http_response.status()
|
20094 21139 | );
|
20095 21140 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
20096 21141 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
20097 21142 | http_response.headers(),
|
20098 21143 | expected_headers,
|
20099 21144 | ));
|
20100 21145 | }
|
20101 21146 | }
|
21147 + |
|
21148 + | /* ProtocolTestGenerator.kt:98 */
|
20102 21149 | }
|
20103 21150 |
|
21151 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
20104 21152 | ::pin_project_lite::pin_project! {
|
20105 21153 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
20106 21154 | /// [`MalformedMapInput`](crate::input::MalformedMapInput) using modelled bindings.
|
20107 21155 | pub struct MalformedMapInputFuture {
|
20108 21156 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedMapInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
20109 21157 | }
|
20110 21158 | }
|
20111 21159 |
|
20112 21160 | impl std::future::Future for MalformedMapInputFuture {
|
20113 21161 | type Output = Result<
|
20114 21162 | crate::input::MalformedMapInput,
|
20115 21163 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
20116 21164 | >;
|
20117 21165 |
|
20118 21166 | fn poll(
|
20119 21167 | self: std::pin::Pin<&mut Self>,
|
20120 21168 | cx: &mut std::task::Context<'_>,
|
20121 21169 | ) -> std::task::Poll<Self::Output> {
|
20122 21170 | let this = self.project();
|
20123 21171 | this.inner.as_mut().poll(cx)
|
20124 21172 | }
|
20125 21173 | }
|
20126 21174 |
|
20127 21175 | impl<B>
|
20128 21176 | ::aws_smithy_http_server::request::FromRequest<
|
20129 21177 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
20130 21178 | B,
|
20131 21179 | > for crate::input::MalformedMapInput
|
20132 21180 | where
|
20133 21181 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
20134 21182 | B: 'static,
|
20135 21183 |
|
20136 21184 | B::Data: Send,
|
20137 21185 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
20138 21186 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
20139 21187 | {
|
20140 21188 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
20141 21189 | type Future = MalformedMapInputFuture;
|
20142 21190 |
|
20143 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
21191 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
20144 21192 | let fut = async move {
|
20145 21193 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
20146 21194 | request.headers(),
|
20147 21195 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
20148 21196 | ) {
|
20149 21197 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
20150 21198 | }
|
20151 21199 | crate::protocol_serde::shape_malformed_map::de_malformed_map_http_request(request).await
|
20152 21200 | };
|
20153 21201 | use ::futures_util::future::TryFutureExt;
|
20154 21202 | let fut = fut.map_err(
|
20155 21203 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
20156 21204 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
20157 21205 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
20158 21206 | e,
|
20159 21207 | )
|
20160 21208 | },
|
20161 21209 | );
|
20162 21210 | MalformedMapInputFuture {
|
20163 21211 | inner: Box::pin(fut),
|
20164 21212 | }
|
20165 21213 | }
|
20166 21214 | }
|
21215 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
20167 21216 | impl
|
20168 21217 | ::aws_smithy_http_server::response::IntoResponse<
|
20169 21218 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
20170 21219 | > for crate::output::MalformedMapOutput
|
20171 21220 | {
|
20172 21221 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
20173 21222 | match crate::protocol_serde::shape_malformed_map::ser_malformed_map_http_response(self) {
|
20174 21223 | Ok(response) => response,
|
20175 21224 | Err(e) => {
|
20176 21225 | ::tracing::error!(error = %e, "failed to serialize response");
|
20177 21226 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
20178 21227 | }
|
20179 21228 | }
|
20180 21229 | }
|
20181 21230 | }
|
20182 21231 |
|
21232 + | /* RustType.kt:534 */
|
20183 21233 | #[allow(unreachable_code, unused_variables)]
|
21234 + | /* RustType.kt:534 */
|
20184 21235 | #[cfg(test)]
|
21236 + | /* ProtocolTestGenerator.kt:98 */
|
20185 21237 | mod malformed_map_test {
|
20186 21238 |
|
20187 21239 | /// When a map contains a null key, the response should be a 400
|
20188 21240 | /// SerializationException.
|
20189 21241 | /// Test ID: RestJsonBodyMalformedMapNullKey
|
20190 21242 | #[::tokio::test]
|
20191 21243 | #[::tracing_test::traced_test]
|
20192 21244 | async fn rest_json_body_malformed_map_null_key_malformed_request() {
|
20193 21245 | {
|
20194 21246 | #[allow(unused_mut)]
|
20195 - | let mut http_request = http::Request::builder()
|
21247 + | let mut http_request = ::http_1x::Request::builder()
|
20196 21248 | .uri("/MalformedMap")
|
20197 21249 | .method("POST")
|
20198 21250 | .header("content-type", "application/json")
|
20199 - | .body(::aws_smithy_http_server::body::Body::from(
|
20200 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
20201 - | "{ \"bodyMap\" : { null: \"abc\" } }".as_bytes(),
|
20202 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21251 + | .body(::aws_smithy_http_server::body::boxed(
|
21252 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
21253 + | &::aws_smithy_protocol_test::decode_body_data(
|
21254 + | "{ \"bodyMap\" : { null: \"abc\" } }".as_bytes(),
|
21255 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21256 + | ),
|
20203 21257 | )),
|
20204 21258 | ))
|
20205 21259 | .unwrap();
|
20206 21260 | #[allow(unused_mut)]
|
20207 21261 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
20208 21262 | let config = crate::service::RestJsonConfig::builder().build();
|
20209 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
21263 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
20210 21264 | .malformed_map(move |input: crate::input::MalformedMapInput| {
|
20211 21265 | let sender = sender.clone();
|
20212 21266 | async move {
|
20213 21267 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedMapOutput };
|
20214 21268 | sender.send(()).await.expect("receiver dropped early");
|
20215 21269 | result
|
20216 21270 | }
|
20217 21271 | })
|
20218 21272 | .build_unchecked();
|
20219 21273 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
20220 21274 | .await
|
20221 21275 | .expect("unable to make an HTTP request");
|
20222 21276 | ::pretty_assertions::assert_eq!(
|
20223 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21277 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20224 21278 | http_response.status()
|
20225 21279 | );
|
20226 21280 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
20227 21281 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
20228 21282 | http_response.headers(),
|
20229 21283 | expected_headers,
|
20230 21284 | ));
|
20231 21285 | }
|
20232 21286 | }
|
20233 21287 |
|
20234 21288 | /// When a dense map contains a null value, the response should be a 400
|
20235 21289 | /// SerializationException.
|
20236 21290 | /// Test ID: RestJsonBodyMalformedMapNullValue
|
20237 21291 | #[::tokio::test]
|
20238 21292 | #[::tracing_test::traced_test]
|
20239 21293 | async fn rest_json_body_malformed_map_null_value_malformed_request() {
|
20240 21294 | {
|
20241 21295 | #[allow(unused_mut)]
|
20242 - | let mut http_request = http::Request::builder()
|
21296 + | let mut http_request = ::http_1x::Request::builder()
|
20243 21297 | .uri("/MalformedMap")
|
20244 21298 | .method("POST")
|
20245 21299 | .header("content-type", "application/json")
|
20246 - | .body(::aws_smithy_http_server::body::Body::from(
|
20247 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
20248 - | "{ \"bodyMap\" : { \"abc\": null } }".as_bytes(),
|
20249 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21300 + | .body(::aws_smithy_http_server::body::boxed(
|
21301 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
21302 + | &::aws_smithy_protocol_test::decode_body_data(
|
21303 + | "{ \"bodyMap\" : { \"abc\": null } }".as_bytes(),
|
21304 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21305 + | ),
|
20250 21306 | )),
|
20251 21307 | ))
|
20252 21308 | .unwrap();
|
20253 21309 | #[allow(unused_mut)]
|
20254 21310 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
20255 21311 | let config = crate::service::RestJsonConfig::builder().build();
|
20256 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
21312 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
20257 21313 | .malformed_map(move |input: crate::input::MalformedMapInput| {
|
20258 21314 | let sender = sender.clone();
|
20259 21315 | async move {
|
20260 21316 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedMapOutput };
|
20261 21317 | sender.send(()).await.expect("receiver dropped early");
|
20262 21318 | result
|
20263 21319 | }
|
20264 21320 | })
|
20265 21321 | .build_unchecked();
|
20266 21322 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
20267 21323 | .await
|
20268 21324 | .expect("unable to make an HTTP request");
|
20269 21325 | ::pretty_assertions::assert_eq!(
|
20270 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21326 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20271 21327 | http_response.status()
|
20272 21328 | );
|
20273 21329 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
20274 21330 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
20275 21331 | http_response.headers(),
|
20276 21332 | expected_headers,
|
20277 21333 | ));
|
20278 21334 | }
|
20279 21335 | }
|
21336 + |
|
21337 + | /* ProtocolTestGenerator.kt:98 */
|
20280 21338 | }
|
20281 21339 |
|
21340 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
20282 21341 | ::pin_project_lite::pin_project! {
|
20283 21342 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
20284 21343 | /// [`MalformedListInput`](crate::input::MalformedListInput) using modelled bindings.
|
20285 21344 | pub struct MalformedListInputFuture {
|
20286 21345 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedListInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
20287 21346 | }
|
20288 21347 | }
|
20289 21348 |
|
20290 21349 | impl std::future::Future for MalformedListInputFuture {
|
20291 21350 | type Output = Result<
|
20292 21351 | crate::input::MalformedListInput,
|
20293 21352 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
20294 21353 | >;
|
20295 21354 |
|
20296 21355 | fn poll(
|
20297 21356 | self: std::pin::Pin<&mut Self>,
|
20298 21357 | cx: &mut std::task::Context<'_>,
|
20299 21358 | ) -> std::task::Poll<Self::Output> {
|
20300 21359 | let this = self.project();
|
20301 21360 | this.inner.as_mut().poll(cx)
|
20302 21361 | }
|
20303 21362 | }
|
20304 21363 |
|
20305 21364 | impl<B>
|
20306 21365 | ::aws_smithy_http_server::request::FromRequest<
|
20307 21366 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
20308 21367 | B,
|
20309 21368 | > for crate::input::MalformedListInput
|
20310 21369 | where
|
20311 21370 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
20312 21371 | B: 'static,
|
20313 21372 |
|
20314 21373 | B::Data: Send,
|
20315 21374 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
20316 21375 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
20317 21376 | {
|
20318 21377 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
20319 21378 | type Future = MalformedListInputFuture;
|
20320 21379 |
|
20321 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
21380 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
20322 21381 | let fut = async move {
|
20323 21382 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
20324 21383 | request.headers(),
|
20325 21384 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
20326 21385 | ) {
|
20327 21386 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
20328 21387 | }
|
20329 21388 | crate::protocol_serde::shape_malformed_list::de_malformed_list_http_request(request)
|
20330 21389 | .await
|
20331 21390 | };
|
20332 21391 | use ::futures_util::future::TryFutureExt;
|
20333 21392 | let fut = fut.map_err(
|
20334 21393 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
20335 21394 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
20336 21395 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
20337 21396 | e,
|
20338 21397 | )
|
20339 21398 | },
|
20340 21399 | );
|
20341 21400 | MalformedListInputFuture {
|
20342 21401 | inner: Box::pin(fut),
|
20343 21402 | }
|
20344 21403 | }
|
20345 21404 | }
|
21405 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
20346 21406 | impl
|
20347 21407 | ::aws_smithy_http_server::response::IntoResponse<
|
20348 21408 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
20349 21409 | > for crate::output::MalformedListOutput
|
20350 21410 | {
|
20351 21411 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
20352 21412 | match crate::protocol_serde::shape_malformed_list::ser_malformed_list_http_response(self) {
|
20353 21413 | Ok(response) => response,
|
20354 21414 | Err(e) => {
|
20355 21415 | ::tracing::error!(error = %e, "failed to serialize response");
|
20356 21416 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
20357 21417 | }
|
20358 21418 | }
|
20359 21419 | }
|
20360 21420 | }
|
20361 21421 |
|
21422 + | /* RustType.kt:534 */
|
20362 21423 | #[allow(unreachable_code, unused_variables)]
|
21424 + | /* RustType.kt:534 */
|
20363 21425 | #[cfg(test)]
|
21426 + | /* ProtocolTestGenerator.kt:98 */
|
20364 21427 | mod malformed_list_test {
|
20365 21428 |
|
20366 21429 | /// When a dense list contains null, the response should be a 400
|
20367 21430 | /// SerializationException.
|
20368 21431 | /// Test ID: RestJsonBodyMalformedListNullItem
|
20369 21432 | #[::tokio::test]
|
20370 21433 | #[::tracing_test::traced_test]
|
20371 21434 | async fn rest_json_body_malformed_list_null_item_malformed_request() {
|
20372 21435 | {
|
20373 21436 | #[allow(unused_mut)]
|
20374 - | let mut http_request = http::Request::builder()
|
21437 + | let mut http_request = ::http_1x::Request::builder()
|
20375 21438 | .uri("/MalformedList")
|
20376 21439 | .method("POST")
|
20377 21440 | .header("content-type", "application/json")
|
20378 - | .body(::aws_smithy_http_server::body::Body::from(
|
20379 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
20380 - | "{ \"bodyList\" : [\"a\", null, \"b\", \"c\"] }".as_bytes(),
|
20381 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21441 + | .body(::aws_smithy_http_server::body::boxed(
|
21442 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
21443 + | &::aws_smithy_protocol_test::decode_body_data(
|
21444 + | "{ \"bodyList\" : [\"a\", null, \"b\", \"c\"] }".as_bytes(),
|
21445 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21446 + | ),
|
20382 21447 | )),
|
20383 21448 | ))
|
20384 21449 | .unwrap();
|
20385 21450 | #[allow(unused_mut)]
|
20386 21451 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
20387 21452 | let config = crate::service::RestJsonConfig::builder().build();
|
20388 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
21453 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
20389 21454 | .malformed_list(move |input: crate::input::MalformedListInput| {
|
20390 21455 | let sender = sender.clone();
|
20391 21456 | async move {
|
20392 21457 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedListOutput };
|
20393 21458 | sender.send(()).await.expect("receiver dropped early");
|
20394 21459 | result
|
20395 21460 | }
|
20396 21461 | })
|
20397 21462 | .build_unchecked();
|
20398 21463 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
20399 21464 | .await
|
20400 21465 | .expect("unable to make an HTTP request");
|
20401 21466 | ::pretty_assertions::assert_eq!(
|
20402 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21467 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20403 21468 | http_response.status()
|
20404 21469 | );
|
20405 21470 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
20406 21471 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
20407 21472 | http_response.headers(),
|
20408 21473 | expected_headers,
|
20409 21474 | ));
|
20410 21475 | }
|
20411 21476 | }
|
20412 21477 |
|
20413 21478 | /// When a list does not have a closing bracket, the response should be
|
20414 21479 | /// a 400 SerializationException.
|
20415 21480 | /// Test ID: RestJsonBodyMalformedListUnclosed
|
20416 21481 | #[::tokio::test]
|
20417 21482 | #[::tracing_test::traced_test]
|
20418 21483 | async fn rest_json_body_malformed_list_unclosed_malformed_request() {
|
20419 21484 | {
|
20420 21485 | #[allow(unused_mut)]
|
20421 - | let mut http_request = http::Request::builder()
|
21486 + | let mut http_request = ::http_1x::Request::builder()
|
20422 21487 | .uri("/MalformedList")
|
20423 21488 | .method("POST")
|
20424 21489 | .header("content-type", "application/json")
|
20425 - | .body(::aws_smithy_http_server::body::Body::from(
|
20426 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
20427 - | "{ \"bodyList\" : [\"a\", \"b\", \"c\" }".as_bytes(),
|
20428 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21490 + | .body(::aws_smithy_http_server::body::boxed(
|
21491 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
21492 + | &::aws_smithy_protocol_test::decode_body_data(
|
21493 + | "{ \"bodyList\" : [\"a\", \"b\", \"c\" }".as_bytes(),
|
21494 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21495 + | ),
|
20429 21496 | )),
|
20430 21497 | ))
|
20431 21498 | .unwrap();
|
20432 21499 | #[allow(unused_mut)]
|
20433 21500 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
20434 21501 | let config = crate::service::RestJsonConfig::builder().build();
|
20435 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
21502 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
20436 21503 | .malformed_list(move |input: crate::input::MalformedListInput| {
|
20437 21504 | let sender = sender.clone();
|
20438 21505 | async move {
|
20439 21506 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedListOutput };
|
20440 21507 | sender.send(()).await.expect("receiver dropped early");
|
20441 21508 | result
|
20442 21509 | }
|
20443 21510 | })
|
20444 21511 | .build_unchecked();
|
20445 21512 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
20446 21513 | .await
|
20447 21514 | .expect("unable to make an HTTP request");
|
20448 21515 | ::pretty_assertions::assert_eq!(
|
20449 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21516 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20450 21517 | http_response.status()
|
20451 21518 | );
|
20452 21519 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
20453 21520 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
20454 21521 | http_response.headers(),
|
20455 21522 | expected_headers,
|
20456 21523 | ));
|
20457 21524 | }
|
20458 21525 | }
|
21526 + |
|
21527 + | /* ProtocolTestGenerator.kt:98 */
|
20459 21528 | }
|
20460 21529 |
|
21530 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
20461 21531 | ::pin_project_lite::pin_project! {
|
20462 21532 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
20463 21533 | /// [`MalformedBooleanInput`](crate::input::MalformedBooleanInput) using modelled bindings.
|
20464 21534 | pub struct MalformedBooleanInputFuture {
|
20465 21535 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedBooleanInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
20466 21536 | }
|
20467 21537 | }
|
20468 21538 |
|
20469 21539 | impl std::future::Future for MalformedBooleanInputFuture {
|
20470 21540 | type Output = Result<
|
20471 21541 | crate::input::MalformedBooleanInput,
|
20472 21542 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
20473 21543 | >;
|
20474 21544 |
|
20475 21545 | fn poll(
|
20476 21546 | self: std::pin::Pin<&mut Self>,
|
20477 21547 | cx: &mut std::task::Context<'_>,
|
20478 21548 | ) -> std::task::Poll<Self::Output> {
|
20479 21549 | let this = self.project();
|
20480 21550 | this.inner.as_mut().poll(cx)
|
20481 21551 | }
|
20482 21552 | }
|
20483 21553 |
|
20484 21554 | impl<B>
|
20485 21555 | ::aws_smithy_http_server::request::FromRequest<
|
20486 21556 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
20487 21557 | B,
|
20488 21558 | > for crate::input::MalformedBooleanInput
|
20489 21559 | where
|
20490 21560 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
20491 21561 | B: 'static,
|
20492 21562 |
|
20493 21563 | B::Data: Send,
|
20494 21564 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
20495 21565 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
20496 21566 | {
|
20497 21567 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
20498 21568 | type Future = MalformedBooleanInputFuture;
|
20499 21569 |
|
20500 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
21570 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
20501 21571 | let fut = async move {
|
20502 21572 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
20503 21573 | request.headers(),
|
20504 21574 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
20505 21575 | ) {
|
20506 21576 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
20507 21577 | }
|
20508 21578 | crate::protocol_serde::shape_malformed_boolean::de_malformed_boolean_http_request(
|
20509 21579 | request,
|
20510 21580 | )
|
20511 21581 | .await
|
20512 21582 | };
|
20513 21583 | use ::futures_util::future::TryFutureExt;
|
20514 21584 | let fut = fut.map_err(
|
20515 21585 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
20516 21586 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
20517 21587 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
20518 21588 | e,
|
20519 21589 | )
|
20520 21590 | },
|
20521 21591 | );
|
20522 21592 | MalformedBooleanInputFuture {
|
20523 21593 | inner: Box::pin(fut),
|
20524 21594 | }
|
20525 21595 | }
|
20526 21596 | }
|
21597 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
20527 21598 | impl
|
20528 21599 | ::aws_smithy_http_server::response::IntoResponse<
|
20529 21600 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
20530 21601 | > for crate::output::MalformedBooleanOutput
|
20531 21602 | {
|
20532 21603 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
20533 21604 | match crate::protocol_serde::shape_malformed_boolean::ser_malformed_boolean_http_response(
|
20534 21605 | self,
|
20535 21606 | ) {
|
20536 21607 | Ok(response) => response,
|
20537 21608 | Err(e) => {
|
20538 21609 | ::tracing::error!(error = %e, "failed to serialize response");
|
20539 21610 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
20540 21611 | }
|
20541 21612 | }
|
20542 21613 | }
|
20543 21614 | }
|
21615 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
20544 21616 | impl
|
20545 21617 | ::aws_smithy_http_server::response::IntoResponse<
|
20546 21618 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
20547 21619 | > for crate::error::MalformedBooleanError
|
20548 21620 | {
|
20549 21621 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
20550 21622 | match crate::protocol_serde::shape_malformed_boolean::ser_malformed_boolean_http_error(
|
20551 21623 | &self,
|
20552 21624 | ) {
|
20553 21625 | Ok(mut response) => {
|
20554 21626 | response.extensions_mut().insert(
|
20555 21627 | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
20556 21628 | );
|
20557 21629 | response
|
20558 21630 | }
|
20559 21631 | Err(e) => {
|
20560 21632 | ::tracing::error!(error = %e, "failed to serialize response");
|
20561 21633 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
20562 21634 | }
|
20563 21635 | }
|
20564 21636 | }
|
20565 21637 | }
|
20566 21638 |
|
21639 + | /* RustType.kt:534 */
|
20567 21640 | #[allow(unreachable_code, unused_variables)]
|
21641 + | /* RustType.kt:534 */
|
20568 21642 | #[cfg(test)]
|
21643 + | /* ProtocolTestGenerator.kt:98 */
|
20569 21644 | mod malformed_boolean_test {
|
20570 21645 |
|
20571 21646 | /// Attempted string coercion should result in SerializationException
|
20572 21647 | /// Test ID: RestJsonBodyBooleanStringCoercion_case0
|
20573 21648 | #[::tokio::test]
|
20574 21649 | #[::tracing_test::traced_test]
|
20575 21650 | async fn rest_json_body_boolean_string_coercion_case0_malformed_request() {
|
20576 21651 | {
|
20577 21652 | #[allow(unused_mut)]
|
20578 - | let mut http_request = http::Request::builder()
|
21653 + | let mut http_request = ::http_1x::Request::builder()
|
20579 21654 | .uri("/MalformedBoolean/true")
|
20580 21655 | .method("POST")
|
20581 21656 | .header("content-type", "application/json")
|
20582 - | .body(::aws_smithy_http_server::body::Body::from(
|
20583 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
20584 - | "{ \"booleanInBody\" : \"true\" }".as_bytes(),
|
20585 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21657 + | .body(::aws_smithy_http_server::body::boxed(
|
21658 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
21659 + | &::aws_smithy_protocol_test::decode_body_data(
|
21660 + | "{ \"booleanInBody\" : \"true\" }".as_bytes(),
|
21661 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21662 + | ),
|
20586 21663 | )),
|
20587 21664 | ))
|
20588 21665 | .unwrap();
|
20589 21666 | #[allow(unused_mut)]
|
20590 21667 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
20591 21668 | let config = crate::service::RestJsonConfig::builder().build();
|
20592 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
21669 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
20593 21670 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
20594 21671 | let sender = sender.clone();
|
20595 21672 | async move {
|
20596 21673 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
20597 21674 | sender.send(()).await.expect("receiver dropped early");
|
20598 21675 | result
|
20599 21676 | }
|
20600 21677 | })
|
20601 21678 | .build_unchecked();
|
20602 21679 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
20603 21680 | .await
|
20604 21681 | .expect("unable to make an HTTP request");
|
20605 21682 | ::pretty_assertions::assert_eq!(
|
20606 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21683 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20607 21684 | http_response.status()
|
20608 21685 | );
|
20609 21686 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
20610 21687 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
20611 21688 | http_response.headers(),
|
20612 21689 | expected_headers,
|
20613 21690 | ));
|
20614 21691 | }
|
20615 21692 | }
|
20616 21693 |
|
20617 21694 | /// Attempted string coercion should result in SerializationException
|
20618 21695 | /// Test ID: RestJsonBodyBooleanStringCoercion_case1
|
20619 21696 | #[::tokio::test]
|
20620 21697 | #[::tracing_test::traced_test]
|
20621 21698 | async fn rest_json_body_boolean_string_coercion_case1_malformed_request() {
|
20622 21699 | {
|
20623 21700 | #[allow(unused_mut)]
|
20624 - | let mut http_request = http::Request::builder()
|
21701 + | let mut http_request = ::http_1x::Request::builder()
|
20625 21702 | .uri("/MalformedBoolean/true")
|
20626 21703 | .method("POST")
|
20627 21704 | .header("content-type", "application/json")
|
20628 - | .body(::aws_smithy_http_server::body::Body::from(
|
20629 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
20630 - | "{ \"booleanInBody\" : \"True\" }".as_bytes(),
|
20631 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21705 + | .body(::aws_smithy_http_server::body::boxed(
|
21706 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
21707 + | &::aws_smithy_protocol_test::decode_body_data(
|
21708 + | "{ \"booleanInBody\" : \"True\" }".as_bytes(),
|
21709 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21710 + | ),
|
20632 21711 | )),
|
20633 21712 | ))
|
20634 21713 | .unwrap();
|
20635 21714 | #[allow(unused_mut)]
|
20636 21715 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
20637 21716 | let config = crate::service::RestJsonConfig::builder().build();
|
20638 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
21717 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
20639 21718 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
20640 21719 | let sender = sender.clone();
|
20641 21720 | async move {
|
20642 21721 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
20643 21722 | sender.send(()).await.expect("receiver dropped early");
|
20644 21723 | result
|
20645 21724 | }
|
20646 21725 | })
|
20647 21726 | .build_unchecked();
|
20648 21727 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
20649 21728 | .await
|
20650 21729 | .expect("unable to make an HTTP request");
|
20651 21730 | ::pretty_assertions::assert_eq!(
|
20652 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21731 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20653 21732 | http_response.status()
|
20654 21733 | );
|
20655 21734 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
20656 21735 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
20657 21736 | http_response.headers(),
|
20658 21737 | expected_headers,
|
20659 21738 | ));
|
20660 21739 | }
|
20661 21740 | }
|
20662 21741 |
|
20663 21742 | /// Attempted string coercion should result in SerializationException
|
20664 21743 | /// Test ID: RestJsonBodyBooleanStringCoercion_case2
|
20665 21744 | #[::tokio::test]
|
20666 21745 | #[::tracing_test::traced_test]
|
20667 21746 | async fn rest_json_body_boolean_string_coercion_case2_malformed_request() {
|
20668 21747 | {
|
20669 21748 | #[allow(unused_mut)]
|
20670 - | let mut http_request = http::Request::builder()
|
21749 + | let mut http_request = ::http_1x::Request::builder()
|
20671 21750 | .uri("/MalformedBoolean/true")
|
20672 21751 | .method("POST")
|
20673 21752 | .header("content-type", "application/json")
|
20674 - | .body(::aws_smithy_http_server::body::Body::from(
|
20675 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
20676 - | "{ \"booleanInBody\" : \"TRUE\" }".as_bytes(),
|
20677 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21753 + | .body(::aws_smithy_http_server::body::boxed(
|
21754 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
21755 + | &::aws_smithy_protocol_test::decode_body_data(
|
21756 + | "{ \"booleanInBody\" : \"TRUE\" }".as_bytes(),
|
21757 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21758 + | ),
|
20678 21759 | )),
|
20679 21760 | ))
|
20680 21761 | .unwrap();
|
20681 21762 | #[allow(unused_mut)]
|
20682 21763 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
20683 21764 | let config = crate::service::RestJsonConfig::builder().build();
|
20684 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
21765 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
20685 21766 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
20686 21767 | let sender = sender.clone();
|
20687 21768 | async move {
|
20688 21769 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
20689 21770 | sender.send(()).await.expect("receiver dropped early");
|
20690 21771 | result
|
20691 21772 | }
|
20692 21773 | })
|
20693 21774 | .build_unchecked();
|
20694 21775 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
20695 21776 | .await
|
20696 21777 | .expect("unable to make an HTTP request");
|
20697 21778 | ::pretty_assertions::assert_eq!(
|
20698 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21779 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20699 21780 | http_response.status()
|
20700 21781 | );
|
20701 21782 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
20702 21783 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
20703 21784 | http_response.headers(),
|
20704 21785 | expected_headers,
|
20705 21786 | ));
|
20706 21787 | }
|
20707 21788 | }
|
20708 21789 |
|
20709 21790 | /// Attempted string coercion should result in SerializationException
|
20710 21791 | /// Test ID: RestJsonBodyBooleanStringCoercion_case3
|
20711 21792 | #[::tokio::test]
|
20712 21793 | #[::tracing_test::traced_test]
|
20713 21794 | async fn rest_json_body_boolean_string_coercion_case3_malformed_request() {
|
20714 21795 | {
|
20715 21796 | #[allow(unused_mut)]
|
20716 - | let mut http_request = http::Request::builder()
|
21797 + | let mut http_request = ::http_1x::Request::builder()
|
20717 21798 | .uri("/MalformedBoolean/true")
|
20718 21799 | .method("POST")
|
20719 21800 | .header("content-type", "application/json")
|
20720 - | .body(::aws_smithy_http_server::body::Body::from(
|
20721 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
20722 - | "{ \"booleanInBody\" : \"y\" }".as_bytes(),
|
20723 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21801 + | .body(::aws_smithy_http_server::body::boxed(
|
21802 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
21803 + | &::aws_smithy_protocol_test::decode_body_data(
|
21804 + | "{ \"booleanInBody\" : \"y\" }".as_bytes(),
|
21805 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21806 + | ),
|
20724 21807 | )),
|
20725 21808 | ))
|
20726 21809 | .unwrap();
|
20727 21810 | #[allow(unused_mut)]
|
20728 21811 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
20729 21812 | let config = crate::service::RestJsonConfig::builder().build();
|
20730 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
21813 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
20731 21814 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
20732 21815 | let sender = sender.clone();
|
20733 21816 | async move {
|
20734 21817 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
20735 21818 | sender.send(()).await.expect("receiver dropped early");
|
20736 21819 | result
|
20737 21820 | }
|
20738 21821 | })
|
20739 21822 | .build_unchecked();
|
20740 21823 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
20741 21824 | .await
|
20742 21825 | .expect("unable to make an HTTP request");
|
20743 21826 | ::pretty_assertions::assert_eq!(
|
20744 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21827 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20745 21828 | http_response.status()
|
20746 21829 | );
|
20747 21830 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
20748 21831 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
20749 21832 | http_response.headers(),
|
20750 21833 | expected_headers,
|
20751 21834 | ));
|
20752 21835 | }
|
20753 21836 | }
|
20754 21837 |
|
20755 21838 | /// Attempted string coercion should result in SerializationException
|
20756 21839 | /// Test ID: RestJsonBodyBooleanStringCoercion_case4
|
20757 21840 | #[::tokio::test]
|
20758 21841 | #[::tracing_test::traced_test]
|
20759 21842 | async fn rest_json_body_boolean_string_coercion_case4_malformed_request() {
|
20760 21843 | {
|
20761 21844 | #[allow(unused_mut)]
|
20762 - | let mut http_request = http::Request::builder()
|
21845 + | let mut http_request = ::http_1x::Request::builder()
|
20763 21846 | .uri("/MalformedBoolean/true")
|
20764 21847 | .method("POST")
|
20765 21848 | .header("content-type", "application/json")
|
20766 - | .body(::aws_smithy_http_server::body::Body::from(
|
20767 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
20768 - | "{ \"booleanInBody\" : \"Y\" }".as_bytes(),
|
20769 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21849 + | .body(::aws_smithy_http_server::body::boxed(
|
21850 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
21851 + | &::aws_smithy_protocol_test::decode_body_data(
|
21852 + | "{ \"booleanInBody\" : \"Y\" }".as_bytes(),
|
21853 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21854 + | ),
|
20770 21855 | )),
|
20771 21856 | ))
|
20772 21857 | .unwrap();
|
20773 21858 | #[allow(unused_mut)]
|
20774 21859 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
20775 21860 | let config = crate::service::RestJsonConfig::builder().build();
|
20776 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
21861 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
20777 21862 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
20778 21863 | let sender = sender.clone();
|
20779 21864 | async move {
|
20780 21865 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
20781 21866 | sender.send(()).await.expect("receiver dropped early");
|
20782 21867 | result
|
20783 21868 | }
|
20784 21869 | })
|
20785 21870 | .build_unchecked();
|
20786 21871 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
20787 21872 | .await
|
20788 21873 | .expect("unable to make an HTTP request");
|
20789 21874 | ::pretty_assertions::assert_eq!(
|
20790 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21875 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20791 21876 | http_response.status()
|
20792 21877 | );
|
20793 21878 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
20794 21879 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
20795 21880 | http_response.headers(),
|
20796 21881 | expected_headers,
|
20797 21882 | ));
|
20798 21883 | }
|
20799 21884 | }
|
20800 21885 |
|
20801 21886 | /// Attempted string coercion should result in SerializationException
|
20802 21887 | /// Test ID: RestJsonBodyBooleanStringCoercion_case5
|
20803 21888 | #[::tokio::test]
|
20804 21889 | #[::tracing_test::traced_test]
|
20805 21890 | async fn rest_json_body_boolean_string_coercion_case5_malformed_request() {
|
20806 21891 | {
|
20807 21892 | #[allow(unused_mut)]
|
20808 - | let mut http_request = http::Request::builder()
|
21893 + | let mut http_request = ::http_1x::Request::builder()
|
20809 21894 | .uri("/MalformedBoolean/true")
|
20810 21895 | .method("POST")
|
20811 21896 | .header("content-type", "application/json")
|
20812 - | .body(::aws_smithy_http_server::body::Body::from(
|
20813 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
20814 - | "{ \"booleanInBody\" : \"yes\" }".as_bytes(),
|
20815 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21897 + | .body(::aws_smithy_http_server::body::boxed(
|
21898 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
21899 + | &::aws_smithy_protocol_test::decode_body_data(
|
21900 + | "{ \"booleanInBody\" : \"yes\" }".as_bytes(),
|
21901 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21902 + | ),
|
20816 21903 | )),
|
20817 21904 | ))
|
20818 21905 | .unwrap();
|
20819 21906 | #[allow(unused_mut)]
|
20820 21907 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
20821 21908 | let config = crate::service::RestJsonConfig::builder().build();
|
20822 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
21909 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
20823 21910 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
20824 21911 | let sender = sender.clone();
|
20825 21912 | async move {
|
20826 21913 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
20827 21914 | sender.send(()).await.expect("receiver dropped early");
|
20828 21915 | result
|
20829 21916 | }
|
20830 21917 | })
|
20831 21918 | .build_unchecked();
|
20832 21919 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
20833 21920 | .await
|
20834 21921 | .expect("unable to make an HTTP request");
|
20835 21922 | ::pretty_assertions::assert_eq!(
|
20836 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21923 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20837 21924 | http_response.status()
|
20838 21925 | );
|
20839 21926 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
20840 21927 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
20841 21928 | http_response.headers(),
|
20842 21929 | expected_headers,
|
20843 21930 | ));
|
20844 21931 | }
|
20845 21932 | }
|
20846 21933 |
|
20847 21934 | /// Attempted string coercion should result in SerializationException
|
20848 21935 | /// Test ID: RestJsonBodyBooleanStringCoercion_case6
|
20849 21936 | #[::tokio::test]
|
20850 21937 | #[::tracing_test::traced_test]
|
20851 21938 | async fn rest_json_body_boolean_string_coercion_case6_malformed_request() {
|
20852 21939 | {
|
20853 21940 | #[allow(unused_mut)]
|
20854 - | let mut http_request = http::Request::builder()
|
21941 + | let mut http_request = ::http_1x::Request::builder()
|
20855 21942 | .uri("/MalformedBoolean/true")
|
20856 21943 | .method("POST")
|
20857 21944 | .header("content-type", "application/json")
|
20858 - | .body(::aws_smithy_http_server::body::Body::from(
|
20859 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
20860 - | "{ \"booleanInBody\" : \"Yes\" }".as_bytes(),
|
20861 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21945 + | .body(::aws_smithy_http_server::body::boxed(
|
21946 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
21947 + | &::aws_smithy_protocol_test::decode_body_data(
|
21948 + | "{ \"booleanInBody\" : \"Yes\" }".as_bytes(),
|
21949 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21950 + | ),
|
20862 21951 | )),
|
20863 21952 | ))
|
20864 21953 | .unwrap();
|
20865 21954 | #[allow(unused_mut)]
|
20866 21955 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
20867 21956 | let config = crate::service::RestJsonConfig::builder().build();
|
20868 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
21957 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
20869 21958 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
20870 21959 | let sender = sender.clone();
|
20871 21960 | async move {
|
20872 21961 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
20873 21962 | sender.send(()).await.expect("receiver dropped early");
|
20874 21963 | result
|
20875 21964 | }
|
20876 21965 | })
|
20877 21966 | .build_unchecked();
|
20878 21967 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
20879 21968 | .await
|
20880 21969 | .expect("unable to make an HTTP request");
|
20881 21970 | ::pretty_assertions::assert_eq!(
|
20882 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21971 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20883 21972 | http_response.status()
|
20884 21973 | );
|
20885 21974 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
20886 21975 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
20887 21976 | http_response.headers(),
|
20888 21977 | expected_headers,
|
20889 21978 | ));
|
20890 21979 | }
|
20891 21980 | }
|
20892 21981 |
|
20893 21982 | /// Attempted string coercion should result in SerializationException
|
20894 21983 | /// Test ID: RestJsonBodyBooleanStringCoercion_case7
|
20895 21984 | #[::tokio::test]
|
20896 21985 | #[::tracing_test::traced_test]
|
20897 21986 | async fn rest_json_body_boolean_string_coercion_case7_malformed_request() {
|
20898 21987 | {
|
20899 21988 | #[allow(unused_mut)]
|
20900 - | let mut http_request = http::Request::builder()
|
21989 + | let mut http_request = ::http_1x::Request::builder()
|
20901 21990 | .uri("/MalformedBoolean/true")
|
20902 21991 | .method("POST")
|
20903 21992 | .header("content-type", "application/json")
|
20904 - | .body(::aws_smithy_http_server::body::Body::from(
|
20905 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
20906 - | "{ \"booleanInBody\" : \"YES\" }".as_bytes(),
|
20907 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21993 + | .body(::aws_smithy_http_server::body::boxed(
|
21994 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
21995 + | &::aws_smithy_protocol_test::decode_body_data(
|
21996 + | "{ \"booleanInBody\" : \"YES\" }".as_bytes(),
|
21997 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
21998 + | ),
|
20908 21999 | )),
|
20909 22000 | ))
|
20910 22001 | .unwrap();
|
20911 22002 | #[allow(unused_mut)]
|
20912 22003 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
20913 22004 | let config = crate::service::RestJsonConfig::builder().build();
|
20914 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22005 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
20915 22006 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
20916 22007 | let sender = sender.clone();
|
20917 22008 | async move {
|
20918 22009 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
20919 22010 | sender.send(()).await.expect("receiver dropped early");
|
20920 22011 | result
|
20921 22012 | }
|
20922 22013 | })
|
20923 22014 | .build_unchecked();
|
20924 22015 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
20925 22016 | .await
|
20926 22017 | .expect("unable to make an HTTP request");
|
20927 22018 | ::pretty_assertions::assert_eq!(
|
20928 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22019 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20929 22020 | http_response.status()
|
20930 22021 | );
|
20931 22022 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
20932 22023 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
20933 22024 | http_response.headers(),
|
20934 22025 | expected_headers,
|
20935 22026 | ));
|
20936 22027 | }
|
20937 22028 | }
|
20938 22029 |
|
20939 22030 | /// Attempted string coercion should result in SerializationException
|
20940 22031 | /// Test ID: RestJsonBodyBooleanStringCoercion_case8
|
20941 22032 | #[::tokio::test]
|
20942 22033 | #[::tracing_test::traced_test]
|
20943 22034 | async fn rest_json_body_boolean_string_coercion_case8_malformed_request() {
|
20944 22035 | {
|
20945 22036 | #[allow(unused_mut)]
|
20946 - | let mut http_request = http::Request::builder()
|
22037 + | let mut http_request = ::http_1x::Request::builder()
|
20947 22038 | .uri("/MalformedBoolean/true")
|
20948 22039 | .method("POST")
|
20949 22040 | .header("content-type", "application/json")
|
20950 - | .body(::aws_smithy_http_server::body::Body::from(
|
20951 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
20952 - | "{ \"booleanInBody\" : \"1\" }".as_bytes(),
|
20953 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22041 + | .body(::aws_smithy_http_server::body::boxed(
|
22042 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22043 + | &::aws_smithy_protocol_test::decode_body_data(
|
22044 + | "{ \"booleanInBody\" : \"1\" }".as_bytes(),
|
22045 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22046 + | ),
|
20954 22047 | )),
|
20955 22048 | ))
|
20956 22049 | .unwrap();
|
20957 22050 | #[allow(unused_mut)]
|
20958 22051 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
20959 22052 | let config = crate::service::RestJsonConfig::builder().build();
|
20960 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22053 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
20961 22054 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
20962 22055 | let sender = sender.clone();
|
20963 22056 | async move {
|
20964 22057 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
20965 22058 | sender.send(()).await.expect("receiver dropped early");
|
20966 22059 | result
|
20967 22060 | }
|
20968 22061 | })
|
20969 22062 | .build_unchecked();
|
20970 22063 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
20971 22064 | .await
|
20972 22065 | .expect("unable to make an HTTP request");
|
20973 22066 | ::pretty_assertions::assert_eq!(
|
20974 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22067 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
20975 22068 | http_response.status()
|
20976 22069 | );
|
20977 22070 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
20978 22071 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
20979 22072 | http_response.headers(),
|
20980 22073 | expected_headers,
|
20981 22074 | ));
|
20982 22075 | }
|
20983 22076 | }
|
20984 22077 |
|
20985 22078 | /// Attempted string coercion should result in SerializationException
|
20986 22079 | /// Test ID: RestJsonBodyBooleanStringCoercion_case9
|
20987 22080 | #[::tokio::test]
|
20988 22081 | #[::tracing_test::traced_test]
|
20989 22082 | async fn rest_json_body_boolean_string_coercion_case9_malformed_request() {
|
20990 22083 | {
|
20991 22084 | #[allow(unused_mut)]
|
20992 - | let mut http_request = http::Request::builder()
|
22085 + | let mut http_request = ::http_1x::Request::builder()
|
20993 22086 | .uri("/MalformedBoolean/true")
|
20994 22087 | .method("POST")
|
20995 22088 | .header("content-type", "application/json")
|
20996 - | .body(::aws_smithy_http_server::body::Body::from(
|
20997 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
20998 - | "{ \"booleanInBody\" : \"on\" }".as_bytes(),
|
20999 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22089 + | .body(::aws_smithy_http_server::body::boxed(
|
22090 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22091 + | &::aws_smithy_protocol_test::decode_body_data(
|
22092 + | "{ \"booleanInBody\" : \"on\" }".as_bytes(),
|
22093 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22094 + | ),
|
21000 22095 | )),
|
21001 22096 | ))
|
21002 22097 | .unwrap();
|
21003 22098 | #[allow(unused_mut)]
|
21004 22099 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21005 22100 | let config = crate::service::RestJsonConfig::builder().build();
|
21006 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22101 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21007 22102 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21008 22103 | let sender = sender.clone();
|
21009 22104 | async move {
|
21010 22105 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21011 22106 | sender.send(()).await.expect("receiver dropped early");
|
21012 22107 | result
|
21013 22108 | }
|
21014 22109 | })
|
21015 22110 | .build_unchecked();
|
21016 22111 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21017 22112 | .await
|
21018 22113 | .expect("unable to make an HTTP request");
|
21019 22114 | ::pretty_assertions::assert_eq!(
|
21020 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22115 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21021 22116 | http_response.status()
|
21022 22117 | );
|
21023 22118 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21024 22119 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21025 22120 | http_response.headers(),
|
21026 22121 | expected_headers,
|
21027 22122 | ));
|
21028 22123 | }
|
21029 22124 | }
|
21030 22125 |
|
21031 22126 | /// Attempted string coercion should result in SerializationException
|
21032 22127 | /// Test ID: RestJsonBodyBooleanStringCoercion_case10
|
21033 22128 | #[::tokio::test]
|
21034 22129 | #[::tracing_test::traced_test]
|
21035 22130 | async fn rest_json_body_boolean_string_coercion_case10_malformed_request() {
|
21036 22131 | {
|
21037 22132 | #[allow(unused_mut)]
|
21038 - | let mut http_request = http::Request::builder()
|
22133 + | let mut http_request = ::http_1x::Request::builder()
|
21039 22134 | .uri("/MalformedBoolean/true")
|
21040 22135 | .method("POST")
|
21041 22136 | .header("content-type", "application/json")
|
21042 - | .body(::aws_smithy_http_server::body::Body::from(
|
21043 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21044 - | "{ \"booleanInBody\" : \"On\" }".as_bytes(),
|
21045 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22137 + | .body(::aws_smithy_http_server::body::boxed(
|
22138 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22139 + | &::aws_smithy_protocol_test::decode_body_data(
|
22140 + | "{ \"booleanInBody\" : \"On\" }".as_bytes(),
|
22141 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22142 + | ),
|
21046 22143 | )),
|
21047 22144 | ))
|
21048 22145 | .unwrap();
|
21049 22146 | #[allow(unused_mut)]
|
21050 22147 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21051 22148 | let config = crate::service::RestJsonConfig::builder().build();
|
21052 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22149 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21053 22150 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21054 22151 | let sender = sender.clone();
|
21055 22152 | async move {
|
21056 22153 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21057 22154 | sender.send(()).await.expect("receiver dropped early");
|
21058 22155 | result
|
21059 22156 | }
|
21060 22157 | })
|
21061 22158 | .build_unchecked();
|
21062 22159 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21063 22160 | .await
|
21064 22161 | .expect("unable to make an HTTP request");
|
21065 22162 | ::pretty_assertions::assert_eq!(
|
21066 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22163 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21067 22164 | http_response.status()
|
21068 22165 | );
|
21069 22166 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21070 22167 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21071 22168 | http_response.headers(),
|
21072 22169 | expected_headers,
|
21073 22170 | ));
|
21074 22171 | }
|
21075 22172 | }
|
21076 22173 |
|
21077 22174 | /// Attempted string coercion should result in SerializationException
|
21078 22175 | /// Test ID: RestJsonBodyBooleanStringCoercion_case11
|
21079 22176 | #[::tokio::test]
|
21080 22177 | #[::tracing_test::traced_test]
|
21081 22178 | async fn rest_json_body_boolean_string_coercion_case11_malformed_request() {
|
21082 22179 | {
|
21083 22180 | #[allow(unused_mut)]
|
21084 - | let mut http_request = http::Request::builder()
|
22181 + | let mut http_request = ::http_1x::Request::builder()
|
21085 22182 | .uri("/MalformedBoolean/true")
|
21086 22183 | .method("POST")
|
21087 22184 | .header("content-type", "application/json")
|
21088 - | .body(::aws_smithy_http_server::body::Body::from(
|
21089 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21090 - | "{ \"booleanInBody\" : \"ON\" }".as_bytes(),
|
21091 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22185 + | .body(::aws_smithy_http_server::body::boxed(
|
22186 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22187 + | &::aws_smithy_protocol_test::decode_body_data(
|
22188 + | "{ \"booleanInBody\" : \"ON\" }".as_bytes(),
|
22189 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22190 + | ),
|
21092 22191 | )),
|
21093 22192 | ))
|
21094 22193 | .unwrap();
|
21095 22194 | #[allow(unused_mut)]
|
21096 22195 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21097 22196 | let config = crate::service::RestJsonConfig::builder().build();
|
21098 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22197 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21099 22198 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21100 22199 | let sender = sender.clone();
|
21101 22200 | async move {
|
21102 22201 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21103 22202 | sender.send(()).await.expect("receiver dropped early");
|
21104 22203 | result
|
21105 22204 | }
|
21106 22205 | })
|
21107 22206 | .build_unchecked();
|
21108 22207 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21109 22208 | .await
|
21110 22209 | .expect("unable to make an HTTP request");
|
21111 22210 | ::pretty_assertions::assert_eq!(
|
21112 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22211 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21113 22212 | http_response.status()
|
21114 22213 | );
|
21115 22214 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21116 22215 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21117 22216 | http_response.headers(),
|
21118 22217 | expected_headers,
|
21119 22218 | ));
|
21120 22219 | }
|
21121 22220 | }
|
21122 22221 |
|
21123 22222 | /// Attempted string coercion should result in SerializationException
|
21124 22223 | /// Test ID: RestJsonBodyBooleanStringCoercion_case12
|
21125 22224 | #[::tokio::test]
|
21126 22225 | #[::tracing_test::traced_test]
|
21127 22226 | async fn rest_json_body_boolean_string_coercion_case12_malformed_request() {
|
21128 22227 | {
|
21129 22228 | #[allow(unused_mut)]
|
21130 - | let mut http_request = http::Request::builder()
|
22229 + | let mut http_request = ::http_1x::Request::builder()
|
21131 22230 | .uri("/MalformedBoolean/true")
|
21132 22231 | .method("POST")
|
21133 22232 | .header("content-type", "application/json")
|
21134 - | .body(::aws_smithy_http_server::body::Body::from(
|
21135 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21136 - | "{ \"booleanInBody\" : \"false\" }".as_bytes(),
|
21137 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22233 + | .body(::aws_smithy_http_server::body::boxed(
|
22234 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22235 + | &::aws_smithy_protocol_test::decode_body_data(
|
22236 + | "{ \"booleanInBody\" : \"false\" }".as_bytes(),
|
22237 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22238 + | ),
|
21138 22239 | )),
|
21139 22240 | ))
|
21140 22241 | .unwrap();
|
21141 22242 | #[allow(unused_mut)]
|
21142 22243 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21143 22244 | let config = crate::service::RestJsonConfig::builder().build();
|
21144 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22245 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21145 22246 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21146 22247 | let sender = sender.clone();
|
21147 22248 | async move {
|
21148 22249 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21149 22250 | sender.send(()).await.expect("receiver dropped early");
|
21150 22251 | result
|
21151 22252 | }
|
21152 22253 | })
|
21153 22254 | .build_unchecked();
|
21154 22255 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21155 22256 | .await
|
21156 22257 | .expect("unable to make an HTTP request");
|
21157 22258 | ::pretty_assertions::assert_eq!(
|
21158 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22259 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21159 22260 | http_response.status()
|
21160 22261 | );
|
21161 22262 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21162 22263 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21163 22264 | http_response.headers(),
|
21164 22265 | expected_headers,
|
21165 22266 | ));
|
21166 22267 | }
|
21167 22268 | }
|
21168 22269 |
|
21169 22270 | /// Attempted string coercion should result in SerializationException
|
21170 22271 | /// Test ID: RestJsonBodyBooleanStringCoercion_case13
|
21171 22272 | #[::tokio::test]
|
21172 22273 | #[::tracing_test::traced_test]
|
21173 22274 | async fn rest_json_body_boolean_string_coercion_case13_malformed_request() {
|
21174 22275 | {
|
21175 22276 | #[allow(unused_mut)]
|
21176 - | let mut http_request = http::Request::builder()
|
22277 + | let mut http_request = ::http_1x::Request::builder()
|
21177 22278 | .uri("/MalformedBoolean/true")
|
21178 22279 | .method("POST")
|
21179 22280 | .header("content-type", "application/json")
|
21180 - | .body(::aws_smithy_http_server::body::Body::from(
|
21181 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21182 - | "{ \"booleanInBody\" : \"False\" }".as_bytes(),
|
21183 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22281 + | .body(::aws_smithy_http_server::body::boxed(
|
22282 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22283 + | &::aws_smithy_protocol_test::decode_body_data(
|
22284 + | "{ \"booleanInBody\" : \"False\" }".as_bytes(),
|
22285 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22286 + | ),
|
21184 22287 | )),
|
21185 22288 | ))
|
21186 22289 | .unwrap();
|
21187 22290 | #[allow(unused_mut)]
|
21188 22291 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21189 22292 | let config = crate::service::RestJsonConfig::builder().build();
|
21190 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22293 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21191 22294 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21192 22295 | let sender = sender.clone();
|
21193 22296 | async move {
|
21194 22297 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21195 22298 | sender.send(()).await.expect("receiver dropped early");
|
21196 22299 | result
|
21197 22300 | }
|
21198 22301 | })
|
21199 22302 | .build_unchecked();
|
21200 22303 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21201 22304 | .await
|
21202 22305 | .expect("unable to make an HTTP request");
|
21203 22306 | ::pretty_assertions::assert_eq!(
|
21204 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22307 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21205 22308 | http_response.status()
|
21206 22309 | );
|
21207 22310 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21208 22311 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21209 22312 | http_response.headers(),
|
21210 22313 | expected_headers,
|
21211 22314 | ));
|
21212 22315 | }
|
21213 22316 | }
|
21214 22317 |
|
21215 22318 | /// Attempted string coercion should result in SerializationException
|
21216 22319 | /// Test ID: RestJsonBodyBooleanStringCoercion_case14
|
21217 22320 | #[::tokio::test]
|
21218 22321 | #[::tracing_test::traced_test]
|
21219 22322 | async fn rest_json_body_boolean_string_coercion_case14_malformed_request() {
|
21220 22323 | {
|
21221 22324 | #[allow(unused_mut)]
|
21222 - | let mut http_request = http::Request::builder()
|
22325 + | let mut http_request = ::http_1x::Request::builder()
|
21223 22326 | .uri("/MalformedBoolean/true")
|
21224 22327 | .method("POST")
|
21225 22328 | .header("content-type", "application/json")
|
21226 - | .body(::aws_smithy_http_server::body::Body::from(
|
21227 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21228 - | "{ \"booleanInBody\" : \"FALSE\" }".as_bytes(),
|
21229 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22329 + | .body(::aws_smithy_http_server::body::boxed(
|
22330 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22331 + | &::aws_smithy_protocol_test::decode_body_data(
|
22332 + | "{ \"booleanInBody\" : \"FALSE\" }".as_bytes(),
|
22333 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22334 + | ),
|
21230 22335 | )),
|
21231 22336 | ))
|
21232 22337 | .unwrap();
|
21233 22338 | #[allow(unused_mut)]
|
21234 22339 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21235 22340 | let config = crate::service::RestJsonConfig::builder().build();
|
21236 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22341 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21237 22342 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21238 22343 | let sender = sender.clone();
|
21239 22344 | async move {
|
21240 22345 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21241 22346 | sender.send(()).await.expect("receiver dropped early");
|
21242 22347 | result
|
21243 22348 | }
|
21244 22349 | })
|
21245 22350 | .build_unchecked();
|
21246 22351 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21247 22352 | .await
|
21248 22353 | .expect("unable to make an HTTP request");
|
21249 22354 | ::pretty_assertions::assert_eq!(
|
21250 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22355 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21251 22356 | http_response.status()
|
21252 22357 | );
|
21253 22358 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21254 22359 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21255 22360 | http_response.headers(),
|
21256 22361 | expected_headers,
|
21257 22362 | ));
|
21258 22363 | }
|
21259 22364 | }
|
21260 22365 |
|
21261 22366 | /// Attempted string coercion should result in SerializationException
|
21262 22367 | /// Test ID: RestJsonBodyBooleanStringCoercion_case15
|
21263 22368 | #[::tokio::test]
|
21264 22369 | #[::tracing_test::traced_test]
|
21265 22370 | async fn rest_json_body_boolean_string_coercion_case15_malformed_request() {
|
21266 22371 | {
|
21267 22372 | #[allow(unused_mut)]
|
21268 - | let mut http_request = http::Request::builder()
|
22373 + | let mut http_request = ::http_1x::Request::builder()
|
21269 22374 | .uri("/MalformedBoolean/true")
|
21270 22375 | .method("POST")
|
21271 22376 | .header("content-type", "application/json")
|
21272 - | .body(::aws_smithy_http_server::body::Body::from(
|
21273 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21274 - | "{ \"booleanInBody\" : \"n\" }".as_bytes(),
|
21275 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22377 + | .body(::aws_smithy_http_server::body::boxed(
|
22378 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22379 + | &::aws_smithy_protocol_test::decode_body_data(
|
22380 + | "{ \"booleanInBody\" : \"n\" }".as_bytes(),
|
22381 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22382 + | ),
|
21276 22383 | )),
|
21277 22384 | ))
|
21278 22385 | .unwrap();
|
21279 22386 | #[allow(unused_mut)]
|
21280 22387 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21281 22388 | let config = crate::service::RestJsonConfig::builder().build();
|
21282 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22389 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21283 22390 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21284 22391 | let sender = sender.clone();
|
21285 22392 | async move {
|
21286 22393 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21287 22394 | sender.send(()).await.expect("receiver dropped early");
|
21288 22395 | result
|
21289 22396 | }
|
21290 22397 | })
|
21291 22398 | .build_unchecked();
|
21292 22399 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21293 22400 | .await
|
21294 22401 | .expect("unable to make an HTTP request");
|
21295 22402 | ::pretty_assertions::assert_eq!(
|
21296 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22403 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21297 22404 | http_response.status()
|
21298 22405 | );
|
21299 22406 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21300 22407 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21301 22408 | http_response.headers(),
|
21302 22409 | expected_headers,
|
21303 22410 | ));
|
21304 22411 | }
|
21305 22412 | }
|
21306 22413 |
|
21307 22414 | /// Attempted string coercion should result in SerializationException
|
21308 22415 | /// Test ID: RestJsonBodyBooleanStringCoercion_case16
|
21309 22416 | #[::tokio::test]
|
21310 22417 | #[::tracing_test::traced_test]
|
21311 22418 | async fn rest_json_body_boolean_string_coercion_case16_malformed_request() {
|
21312 22419 | {
|
21313 22420 | #[allow(unused_mut)]
|
21314 - | let mut http_request = http::Request::builder()
|
22421 + | let mut http_request = ::http_1x::Request::builder()
|
21315 22422 | .uri("/MalformedBoolean/true")
|
21316 22423 | .method("POST")
|
21317 22424 | .header("content-type", "application/json")
|
21318 - | .body(::aws_smithy_http_server::body::Body::from(
|
21319 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21320 - | "{ \"booleanInBody\" : \"N\" }".as_bytes(),
|
21321 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22425 + | .body(::aws_smithy_http_server::body::boxed(
|
22426 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22427 + | &::aws_smithy_protocol_test::decode_body_data(
|
22428 + | "{ \"booleanInBody\" : \"N\" }".as_bytes(),
|
22429 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22430 + | ),
|
21322 22431 | )),
|
21323 22432 | ))
|
21324 22433 | .unwrap();
|
21325 22434 | #[allow(unused_mut)]
|
21326 22435 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21327 22436 | let config = crate::service::RestJsonConfig::builder().build();
|
21328 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22437 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21329 22438 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21330 22439 | let sender = sender.clone();
|
21331 22440 | async move {
|
21332 22441 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21333 22442 | sender.send(()).await.expect("receiver dropped early");
|
21334 22443 | result
|
21335 22444 | }
|
21336 22445 | })
|
21337 22446 | .build_unchecked();
|
21338 22447 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21339 22448 | .await
|
21340 22449 | .expect("unable to make an HTTP request");
|
21341 22450 | ::pretty_assertions::assert_eq!(
|
21342 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22451 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21343 22452 | http_response.status()
|
21344 22453 | );
|
21345 22454 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21346 22455 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21347 22456 | http_response.headers(),
|
21348 22457 | expected_headers,
|
21349 22458 | ));
|
21350 22459 | }
|
21351 22460 | }
|
21352 22461 |
|
21353 22462 | /// Attempted string coercion should result in SerializationException
|
21354 22463 | /// Test ID: RestJsonBodyBooleanStringCoercion_case17
|
21355 22464 | #[::tokio::test]
|
21356 22465 | #[::tracing_test::traced_test]
|
21357 22466 | async fn rest_json_body_boolean_string_coercion_case17_malformed_request() {
|
21358 22467 | {
|
21359 22468 | #[allow(unused_mut)]
|
21360 - | let mut http_request = http::Request::builder()
|
22469 + | let mut http_request = ::http_1x::Request::builder()
|
21361 22470 | .uri("/MalformedBoolean/true")
|
21362 22471 | .method("POST")
|
21363 22472 | .header("content-type", "application/json")
|
21364 - | .body(::aws_smithy_http_server::body::Body::from(
|
21365 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21366 - | "{ \"booleanInBody\" : \"no\" }".as_bytes(),
|
21367 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22473 + | .body(::aws_smithy_http_server::body::boxed(
|
22474 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22475 + | &::aws_smithy_protocol_test::decode_body_data(
|
22476 + | "{ \"booleanInBody\" : \"no\" }".as_bytes(),
|
22477 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22478 + | ),
|
21368 22479 | )),
|
21369 22480 | ))
|
21370 22481 | .unwrap();
|
21371 22482 | #[allow(unused_mut)]
|
21372 22483 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21373 22484 | let config = crate::service::RestJsonConfig::builder().build();
|
21374 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22485 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21375 22486 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21376 22487 | let sender = sender.clone();
|
21377 22488 | async move {
|
21378 22489 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21379 22490 | sender.send(()).await.expect("receiver dropped early");
|
21380 22491 | result
|
21381 22492 | }
|
21382 22493 | })
|
21383 22494 | .build_unchecked();
|
21384 22495 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21385 22496 | .await
|
21386 22497 | .expect("unable to make an HTTP request");
|
21387 22498 | ::pretty_assertions::assert_eq!(
|
21388 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22499 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21389 22500 | http_response.status()
|
21390 22501 | );
|
21391 22502 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21392 22503 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21393 22504 | http_response.headers(),
|
21394 22505 | expected_headers,
|
21395 22506 | ));
|
21396 22507 | }
|
21397 22508 | }
|
21398 22509 |
|
21399 22510 | /// Attempted string coercion should result in SerializationException
|
21400 22511 | /// Test ID: RestJsonBodyBooleanStringCoercion_case18
|
21401 22512 | #[::tokio::test]
|
21402 22513 | #[::tracing_test::traced_test]
|
21403 22514 | async fn rest_json_body_boolean_string_coercion_case18_malformed_request() {
|
21404 22515 | {
|
21405 22516 | #[allow(unused_mut)]
|
21406 - | let mut http_request = http::Request::builder()
|
22517 + | let mut http_request = ::http_1x::Request::builder()
|
21407 22518 | .uri("/MalformedBoolean/true")
|
21408 22519 | .method("POST")
|
21409 22520 | .header("content-type", "application/json")
|
21410 - | .body(::aws_smithy_http_server::body::Body::from(
|
21411 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21412 - | "{ \"booleanInBody\" : \"No\" }".as_bytes(),
|
21413 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22521 + | .body(::aws_smithy_http_server::body::boxed(
|
22522 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22523 + | &::aws_smithy_protocol_test::decode_body_data(
|
22524 + | "{ \"booleanInBody\" : \"No\" }".as_bytes(),
|
22525 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22526 + | ),
|
21414 22527 | )),
|
21415 22528 | ))
|
21416 22529 | .unwrap();
|
21417 22530 | #[allow(unused_mut)]
|
21418 22531 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21419 22532 | let config = crate::service::RestJsonConfig::builder().build();
|
21420 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22533 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21421 22534 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21422 22535 | let sender = sender.clone();
|
21423 22536 | async move {
|
21424 22537 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21425 22538 | sender.send(()).await.expect("receiver dropped early");
|
21426 22539 | result
|
21427 22540 | }
|
21428 22541 | })
|
21429 22542 | .build_unchecked();
|
21430 22543 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21431 22544 | .await
|
21432 22545 | .expect("unable to make an HTTP request");
|
21433 22546 | ::pretty_assertions::assert_eq!(
|
21434 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22547 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21435 22548 | http_response.status()
|
21436 22549 | );
|
21437 22550 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21438 22551 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21439 22552 | http_response.headers(),
|
21440 22553 | expected_headers,
|
21441 22554 | ));
|
21442 22555 | }
|
21443 22556 | }
|
21444 22557 |
|
21445 22558 | /// Attempted string coercion should result in SerializationException
|
21446 22559 | /// Test ID: RestJsonBodyBooleanStringCoercion_case19
|
21447 22560 | #[::tokio::test]
|
21448 22561 | #[::tracing_test::traced_test]
|
21449 22562 | async fn rest_json_body_boolean_string_coercion_case19_malformed_request() {
|
21450 22563 | {
|
21451 22564 | #[allow(unused_mut)]
|
21452 - | let mut http_request = http::Request::builder()
|
22565 + | let mut http_request = ::http_1x::Request::builder()
|
21453 22566 | .uri("/MalformedBoolean/true")
|
21454 22567 | .method("POST")
|
21455 22568 | .header("content-type", "application/json")
|
21456 - | .body(::aws_smithy_http_server::body::Body::from(
|
21457 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21458 - | "{ \"booleanInBody\" : \"NO\" }".as_bytes(),
|
21459 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22569 + | .body(::aws_smithy_http_server::body::boxed(
|
22570 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22571 + | &::aws_smithy_protocol_test::decode_body_data(
|
22572 + | "{ \"booleanInBody\" : \"NO\" }".as_bytes(),
|
22573 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22574 + | ),
|
21460 22575 | )),
|
21461 22576 | ))
|
21462 22577 | .unwrap();
|
21463 22578 | #[allow(unused_mut)]
|
21464 22579 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21465 22580 | let config = crate::service::RestJsonConfig::builder().build();
|
21466 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22581 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21467 22582 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21468 22583 | let sender = sender.clone();
|
21469 22584 | async move {
|
21470 22585 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21471 22586 | sender.send(()).await.expect("receiver dropped early");
|
21472 22587 | result
|
21473 22588 | }
|
21474 22589 | })
|
21475 22590 | .build_unchecked();
|
21476 22591 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21477 22592 | .await
|
21478 22593 | .expect("unable to make an HTTP request");
|
21479 22594 | ::pretty_assertions::assert_eq!(
|
21480 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22595 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21481 22596 | http_response.status()
|
21482 22597 | );
|
21483 22598 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21484 22599 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21485 22600 | http_response.headers(),
|
21486 22601 | expected_headers,
|
21487 22602 | ));
|
21488 22603 | }
|
21489 22604 | }
|
21490 22605 |
|
21491 22606 | /// Attempted string coercion should result in SerializationException
|
21492 22607 | /// Test ID: RestJsonBodyBooleanStringCoercion_case20
|
21493 22608 | #[::tokio::test]
|
21494 22609 | #[::tracing_test::traced_test]
|
21495 22610 | async fn rest_json_body_boolean_string_coercion_case20_malformed_request() {
|
21496 22611 | {
|
21497 22612 | #[allow(unused_mut)]
|
21498 - | let mut http_request = http::Request::builder()
|
22613 + | let mut http_request = ::http_1x::Request::builder()
|
21499 22614 | .uri("/MalformedBoolean/true")
|
21500 22615 | .method("POST")
|
21501 22616 | .header("content-type", "application/json")
|
21502 - | .body(::aws_smithy_http_server::body::Body::from(
|
21503 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21504 - | "{ \"booleanInBody\" : \"0\" }".as_bytes(),
|
21505 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22617 + | .body(::aws_smithy_http_server::body::boxed(
|
22618 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22619 + | &::aws_smithy_protocol_test::decode_body_data(
|
22620 + | "{ \"booleanInBody\" : \"0\" }".as_bytes(),
|
22621 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22622 + | ),
|
21506 22623 | )),
|
21507 22624 | ))
|
21508 22625 | .unwrap();
|
21509 22626 | #[allow(unused_mut)]
|
21510 22627 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21511 22628 | let config = crate::service::RestJsonConfig::builder().build();
|
21512 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22629 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21513 22630 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21514 22631 | let sender = sender.clone();
|
21515 22632 | async move {
|
21516 22633 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21517 22634 | sender.send(()).await.expect("receiver dropped early");
|
21518 22635 | result
|
21519 22636 | }
|
21520 22637 | })
|
21521 22638 | .build_unchecked();
|
21522 22639 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21523 22640 | .await
|
21524 22641 | .expect("unable to make an HTTP request");
|
21525 22642 | ::pretty_assertions::assert_eq!(
|
21526 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22643 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21527 22644 | http_response.status()
|
21528 22645 | );
|
21529 22646 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21530 22647 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21531 22648 | http_response.headers(),
|
21532 22649 | expected_headers,
|
21533 22650 | ));
|
21534 22651 | }
|
21535 22652 | }
|
21536 22653 |
|
21537 22654 | /// Attempted string coercion should result in SerializationException
|
21538 22655 | /// Test ID: RestJsonBodyBooleanStringCoercion_case21
|
21539 22656 | #[::tokio::test]
|
21540 22657 | #[::tracing_test::traced_test]
|
21541 22658 | async fn rest_json_body_boolean_string_coercion_case21_malformed_request() {
|
21542 22659 | {
|
21543 22660 | #[allow(unused_mut)]
|
21544 - | let mut http_request = http::Request::builder()
|
22661 + | let mut http_request = ::http_1x::Request::builder()
|
21545 22662 | .uri("/MalformedBoolean/true")
|
21546 22663 | .method("POST")
|
21547 22664 | .header("content-type", "application/json")
|
21548 - | .body(::aws_smithy_http_server::body::Body::from(
|
21549 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21550 - | "{ \"booleanInBody\" : \"off\" }".as_bytes(),
|
21551 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22665 + | .body(::aws_smithy_http_server::body::boxed(
|
22666 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22667 + | &::aws_smithy_protocol_test::decode_body_data(
|
22668 + | "{ \"booleanInBody\" : \"off\" }".as_bytes(),
|
22669 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22670 + | ),
|
21552 22671 | )),
|
21553 22672 | ))
|
21554 22673 | .unwrap();
|
21555 22674 | #[allow(unused_mut)]
|
21556 22675 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21557 22676 | let config = crate::service::RestJsonConfig::builder().build();
|
21558 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22677 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21559 22678 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21560 22679 | let sender = sender.clone();
|
21561 22680 | async move {
|
21562 22681 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21563 22682 | sender.send(()).await.expect("receiver dropped early");
|
21564 22683 | result
|
21565 22684 | }
|
21566 22685 | })
|
21567 22686 | .build_unchecked();
|
21568 22687 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21569 22688 | .await
|
21570 22689 | .expect("unable to make an HTTP request");
|
21571 22690 | ::pretty_assertions::assert_eq!(
|
21572 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22691 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21573 22692 | http_response.status()
|
21574 22693 | );
|
21575 22694 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21576 22695 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21577 22696 | http_response.headers(),
|
21578 22697 | expected_headers,
|
21579 22698 | ));
|
21580 22699 | }
|
21581 22700 | }
|
21582 22701 |
|
21583 22702 | /// Attempted string coercion should result in SerializationException
|
21584 22703 | /// Test ID: RestJsonBodyBooleanStringCoercion_case22
|
21585 22704 | #[::tokio::test]
|
21586 22705 | #[::tracing_test::traced_test]
|
21587 22706 | async fn rest_json_body_boolean_string_coercion_case22_malformed_request() {
|
21588 22707 | {
|
21589 22708 | #[allow(unused_mut)]
|
21590 - | let mut http_request = http::Request::builder()
|
22709 + | let mut http_request = ::http_1x::Request::builder()
|
21591 22710 | .uri("/MalformedBoolean/true")
|
21592 22711 | .method("POST")
|
21593 22712 | .header("content-type", "application/json")
|
21594 - | .body(::aws_smithy_http_server::body::Body::from(
|
21595 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21596 - | "{ \"booleanInBody\" : \"Off\" }".as_bytes(),
|
21597 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22713 + | .body(::aws_smithy_http_server::body::boxed(
|
22714 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22715 + | &::aws_smithy_protocol_test::decode_body_data(
|
22716 + | "{ \"booleanInBody\" : \"Off\" }".as_bytes(),
|
22717 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22718 + | ),
|
21598 22719 | )),
|
21599 22720 | ))
|
21600 22721 | .unwrap();
|
21601 22722 | #[allow(unused_mut)]
|
21602 22723 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21603 22724 | let config = crate::service::RestJsonConfig::builder().build();
|
21604 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22725 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21605 22726 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21606 22727 | let sender = sender.clone();
|
21607 22728 | async move {
|
21608 22729 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21609 22730 | sender.send(()).await.expect("receiver dropped early");
|
21610 22731 | result
|
21611 22732 | }
|
21612 22733 | })
|
21613 22734 | .build_unchecked();
|
21614 22735 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21615 22736 | .await
|
21616 22737 | .expect("unable to make an HTTP request");
|
21617 22738 | ::pretty_assertions::assert_eq!(
|
21618 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22739 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21619 22740 | http_response.status()
|
21620 22741 | );
|
21621 22742 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21622 22743 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21623 22744 | http_response.headers(),
|
21624 22745 | expected_headers,
|
21625 22746 | ));
|
21626 22747 | }
|
21627 22748 | }
|
21628 22749 |
|
21629 22750 | /// Attempted string coercion should result in SerializationException
|
21630 22751 | /// Test ID: RestJsonBodyBooleanStringCoercion_case23
|
21631 22752 | #[::tokio::test]
|
21632 22753 | #[::tracing_test::traced_test]
|
21633 22754 | async fn rest_json_body_boolean_string_coercion_case23_malformed_request() {
|
21634 22755 | {
|
21635 22756 | #[allow(unused_mut)]
|
21636 - | let mut http_request = http::Request::builder()
|
22757 + | let mut http_request = ::http_1x::Request::builder()
|
21637 22758 | .uri("/MalformedBoolean/true")
|
21638 22759 | .method("POST")
|
21639 22760 | .header("content-type", "application/json")
|
21640 - | .body(::aws_smithy_http_server::body::Body::from(
|
21641 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21642 - | "{ \"booleanInBody\" : \"OFF\" }".as_bytes(),
|
21643 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22761 + | .body(::aws_smithy_http_server::body::boxed(
|
22762 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22763 + | &::aws_smithy_protocol_test::decode_body_data(
|
22764 + | "{ \"booleanInBody\" : \"OFF\" }".as_bytes(),
|
22765 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22766 + | ),
|
21644 22767 | )),
|
21645 22768 | ))
|
21646 22769 | .unwrap();
|
21647 22770 | #[allow(unused_mut)]
|
21648 22771 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21649 22772 | let config = crate::service::RestJsonConfig::builder().build();
|
21650 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22773 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21651 22774 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21652 22775 | let sender = sender.clone();
|
21653 22776 | async move {
|
21654 22777 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21655 22778 | sender.send(()).await.expect("receiver dropped early");
|
21656 22779 | result
|
21657 22780 | }
|
21658 22781 | })
|
21659 22782 | .build_unchecked();
|
21660 22783 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21661 22784 | .await
|
21662 22785 | .expect("unable to make an HTTP request");
|
21663 22786 | ::pretty_assertions::assert_eq!(
|
21664 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22787 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21665 22788 | http_response.status()
|
21666 22789 | );
|
21667 22790 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21668 22791 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21669 22792 | http_response.headers(),
|
21670 22793 | expected_headers,
|
21671 22794 | ));
|
21672 22795 | }
|
21673 22796 | }
|
21674 22797 |
|
21675 22798 | /// YAML-style alternate boolean literals should result in SerializationException
|
21676 22799 | /// Test ID: RestJsonBodyBooleanBadLiteral_case0
|
21677 22800 | #[::tokio::test]
|
21678 22801 | #[::tracing_test::traced_test]
|
21679 22802 | async fn rest_json_body_boolean_bad_literal_case0_malformed_request() {
|
21680 22803 | {
|
21681 22804 | #[allow(unused_mut)]
|
21682 - | let mut http_request = http::Request::builder()
|
22805 + | let mut http_request = ::http_1x::Request::builder()
|
21683 22806 | .uri("/MalformedBoolean/true")
|
21684 22807 | .method("POST")
|
21685 22808 | .header("content-type", "application/json")
|
21686 - | .body(::aws_smithy_http_server::body::Body::from(
|
21687 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21688 - | "{ \"booleanInBody\" : True }".as_bytes(),
|
21689 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22809 + | .body(::aws_smithy_http_server::body::boxed(
|
22810 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22811 + | &::aws_smithy_protocol_test::decode_body_data(
|
22812 + | "{ \"booleanInBody\" : True }".as_bytes(),
|
22813 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22814 + | ),
|
21690 22815 | )),
|
21691 22816 | ))
|
21692 22817 | .unwrap();
|
21693 22818 | #[allow(unused_mut)]
|
21694 22819 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21695 22820 | let config = crate::service::RestJsonConfig::builder().build();
|
21696 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22821 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21697 22822 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21698 22823 | let sender = sender.clone();
|
21699 22824 | async move {
|
21700 22825 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21701 22826 | sender.send(()).await.expect("receiver dropped early");
|
21702 22827 | result
|
21703 22828 | }
|
21704 22829 | })
|
21705 22830 | .build_unchecked();
|
21706 22831 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21707 22832 | .await
|
21708 22833 | .expect("unable to make an HTTP request");
|
21709 22834 | ::pretty_assertions::assert_eq!(
|
21710 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22835 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21711 22836 | http_response.status()
|
21712 22837 | );
|
21713 22838 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21714 22839 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21715 22840 | http_response.headers(),
|
21716 22841 | expected_headers,
|
21717 22842 | ));
|
21718 22843 | }
|
21719 22844 | }
|
21720 22845 |
|
21721 22846 | /// YAML-style alternate boolean literals should result in SerializationException
|
21722 22847 | /// Test ID: RestJsonBodyBooleanBadLiteral_case1
|
21723 22848 | #[::tokio::test]
|
21724 22849 | #[::tracing_test::traced_test]
|
21725 22850 | async fn rest_json_body_boolean_bad_literal_case1_malformed_request() {
|
21726 22851 | {
|
21727 22852 | #[allow(unused_mut)]
|
21728 - | let mut http_request = http::Request::builder()
|
22853 + | let mut http_request = ::http_1x::Request::builder()
|
21729 22854 | .uri("/MalformedBoolean/true")
|
21730 22855 | .method("POST")
|
21731 22856 | .header("content-type", "application/json")
|
21732 - | .body(::aws_smithy_http_server::body::Body::from(
|
21733 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21734 - | "{ \"booleanInBody\" : TRUE }".as_bytes(),
|
21735 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22857 + | .body(::aws_smithy_http_server::body::boxed(
|
22858 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22859 + | &::aws_smithy_protocol_test::decode_body_data(
|
22860 + | "{ \"booleanInBody\" : TRUE }".as_bytes(),
|
22861 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22862 + | ),
|
21736 22863 | )),
|
21737 22864 | ))
|
21738 22865 | .unwrap();
|
21739 22866 | #[allow(unused_mut)]
|
21740 22867 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21741 22868 | let config = crate::service::RestJsonConfig::builder().build();
|
21742 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22869 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21743 22870 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21744 22871 | let sender = sender.clone();
|
21745 22872 | async move {
|
21746 22873 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21747 22874 | sender.send(()).await.expect("receiver dropped early");
|
21748 22875 | result
|
21749 22876 | }
|
21750 22877 | })
|
21751 22878 | .build_unchecked();
|
21752 22879 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21753 22880 | .await
|
21754 22881 | .expect("unable to make an HTTP request");
|
21755 22882 | ::pretty_assertions::assert_eq!(
|
21756 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22883 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21757 22884 | http_response.status()
|
21758 22885 | );
|
21759 22886 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21760 22887 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21761 22888 | http_response.headers(),
|
21762 22889 | expected_headers,
|
21763 22890 | ));
|
21764 22891 | }
|
21765 22892 | }
|
21766 22893 |
|
21767 22894 | /// YAML-style alternate boolean literals should result in SerializationException
|
21768 22895 | /// Test ID: RestJsonBodyBooleanBadLiteral_case2
|
21769 22896 | #[::tokio::test]
|
21770 22897 | #[::tracing_test::traced_test]
|
21771 22898 | async fn rest_json_body_boolean_bad_literal_case2_malformed_request() {
|
21772 22899 | {
|
21773 22900 | #[allow(unused_mut)]
|
21774 - | let mut http_request = http::Request::builder()
|
22901 + | let mut http_request = ::http_1x::Request::builder()
|
21775 22902 | .uri("/MalformedBoolean/true")
|
21776 22903 | .method("POST")
|
21777 22904 | .header("content-type", "application/json")
|
21778 - | .body(::aws_smithy_http_server::body::Body::from(
|
21779 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21780 - | "{ \"booleanInBody\" : y }".as_bytes(),
|
21781 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22905 + | .body(::aws_smithy_http_server::body::boxed(
|
22906 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22907 + | &::aws_smithy_protocol_test::decode_body_data(
|
22908 + | "{ \"booleanInBody\" : y }".as_bytes(),
|
22909 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22910 + | ),
|
21782 22911 | )),
|
21783 22912 | ))
|
21784 22913 | .unwrap();
|
21785 22914 | #[allow(unused_mut)]
|
21786 22915 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21787 22916 | let config = crate::service::RestJsonConfig::builder().build();
|
21788 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22917 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21789 22918 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21790 22919 | let sender = sender.clone();
|
21791 22920 | async move {
|
21792 22921 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21793 22922 | sender.send(()).await.expect("receiver dropped early");
|
21794 22923 | result
|
21795 22924 | }
|
21796 22925 | })
|
21797 22926 | .build_unchecked();
|
21798 22927 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21799 22928 | .await
|
21800 22929 | .expect("unable to make an HTTP request");
|
21801 22930 | ::pretty_assertions::assert_eq!(
|
21802 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22931 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21803 22932 | http_response.status()
|
21804 22933 | );
|
21805 22934 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21806 22935 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21807 22936 | http_response.headers(),
|
21808 22937 | expected_headers,
|
21809 22938 | ));
|
21810 22939 | }
|
21811 22940 | }
|
21812 22941 |
|
21813 22942 | /// YAML-style alternate boolean literals should result in SerializationException
|
21814 22943 | /// Test ID: RestJsonBodyBooleanBadLiteral_case3
|
21815 22944 | #[::tokio::test]
|
21816 22945 | #[::tracing_test::traced_test]
|
21817 22946 | async fn rest_json_body_boolean_bad_literal_case3_malformed_request() {
|
21818 22947 | {
|
21819 22948 | #[allow(unused_mut)]
|
21820 - | let mut http_request = http::Request::builder()
|
22949 + | let mut http_request = ::http_1x::Request::builder()
|
21821 22950 | .uri("/MalformedBoolean/true")
|
21822 22951 | .method("POST")
|
21823 22952 | .header("content-type", "application/json")
|
21824 - | .body(::aws_smithy_http_server::body::Body::from(
|
21825 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21826 - | "{ \"booleanInBody\" : Y }".as_bytes(),
|
21827 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22953 + | .body(::aws_smithy_http_server::body::boxed(
|
22954 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
22955 + | &::aws_smithy_protocol_test::decode_body_data(
|
22956 + | "{ \"booleanInBody\" : Y }".as_bytes(),
|
22957 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
22958 + | ),
|
21828 22959 | )),
|
21829 22960 | ))
|
21830 22961 | .unwrap();
|
21831 22962 | #[allow(unused_mut)]
|
21832 22963 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21833 22964 | let config = crate::service::RestJsonConfig::builder().build();
|
21834 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
22965 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21835 22966 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21836 22967 | let sender = sender.clone();
|
21837 22968 | async move {
|
21838 22969 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21839 22970 | sender.send(()).await.expect("receiver dropped early");
|
21840 22971 | result
|
21841 22972 | }
|
21842 22973 | })
|
21843 22974 | .build_unchecked();
|
21844 22975 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21845 22976 | .await
|
21846 22977 | .expect("unable to make an HTTP request");
|
21847 22978 | ::pretty_assertions::assert_eq!(
|
21848 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22979 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21849 22980 | http_response.status()
|
21850 22981 | );
|
21851 22982 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21852 22983 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21853 22984 | http_response.headers(),
|
21854 22985 | expected_headers,
|
21855 22986 | ));
|
21856 22987 | }
|
21857 22988 | }
|
21858 22989 |
|
21859 22990 | /// YAML-style alternate boolean literals should result in SerializationException
|
21860 22991 | /// Test ID: RestJsonBodyBooleanBadLiteral_case4
|
21861 22992 | #[::tokio::test]
|
21862 22993 | #[::tracing_test::traced_test]
|
21863 22994 | async fn rest_json_body_boolean_bad_literal_case4_malformed_request() {
|
21864 22995 | {
|
21865 22996 | #[allow(unused_mut)]
|
21866 - | let mut http_request = http::Request::builder()
|
22997 + | let mut http_request = ::http_1x::Request::builder()
|
21867 22998 | .uri("/MalformedBoolean/true")
|
21868 22999 | .method("POST")
|
21869 23000 | .header("content-type", "application/json")
|
21870 - | .body(::aws_smithy_http_server::body::Body::from(
|
21871 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21872 - | "{ \"booleanInBody\" : yes }".as_bytes(),
|
21873 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23001 + | .body(::aws_smithy_http_server::body::boxed(
|
23002 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23003 + | &::aws_smithy_protocol_test::decode_body_data(
|
23004 + | "{ \"booleanInBody\" : yes }".as_bytes(),
|
23005 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23006 + | ),
|
21874 23007 | )),
|
21875 23008 | ))
|
21876 23009 | .unwrap();
|
21877 23010 | #[allow(unused_mut)]
|
21878 23011 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21879 23012 | let config = crate::service::RestJsonConfig::builder().build();
|
21880 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23013 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21881 23014 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21882 23015 | let sender = sender.clone();
|
21883 23016 | async move {
|
21884 23017 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21885 23018 | sender.send(()).await.expect("receiver dropped early");
|
21886 23019 | result
|
21887 23020 | }
|
21888 23021 | })
|
21889 23022 | .build_unchecked();
|
21890 23023 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21891 23024 | .await
|
21892 23025 | .expect("unable to make an HTTP request");
|
21893 23026 | ::pretty_assertions::assert_eq!(
|
21894 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23027 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21895 23028 | http_response.status()
|
21896 23029 | );
|
21897 23030 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21898 23031 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21899 23032 | http_response.headers(),
|
21900 23033 | expected_headers,
|
21901 23034 | ));
|
21902 23035 | }
|
21903 23036 | }
|
21904 23037 |
|
21905 23038 | /// YAML-style alternate boolean literals should result in SerializationException
|
21906 23039 | /// Test ID: RestJsonBodyBooleanBadLiteral_case5
|
21907 23040 | #[::tokio::test]
|
21908 23041 | #[::tracing_test::traced_test]
|
21909 23042 | async fn rest_json_body_boolean_bad_literal_case5_malformed_request() {
|
21910 23043 | {
|
21911 23044 | #[allow(unused_mut)]
|
21912 - | let mut http_request = http::Request::builder()
|
23045 + | let mut http_request = ::http_1x::Request::builder()
|
21913 23046 | .uri("/MalformedBoolean/true")
|
21914 23047 | .method("POST")
|
21915 23048 | .header("content-type", "application/json")
|
21916 - | .body(::aws_smithy_http_server::body::Body::from(
|
21917 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21918 - | "{ \"booleanInBody\" : Yes }".as_bytes(),
|
21919 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23049 + | .body(::aws_smithy_http_server::body::boxed(
|
23050 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23051 + | &::aws_smithy_protocol_test::decode_body_data(
|
23052 + | "{ \"booleanInBody\" : Yes }".as_bytes(),
|
23053 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23054 + | ),
|
21920 23055 | )),
|
21921 23056 | ))
|
21922 23057 | .unwrap();
|
21923 23058 | #[allow(unused_mut)]
|
21924 23059 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21925 23060 | let config = crate::service::RestJsonConfig::builder().build();
|
21926 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23061 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21927 23062 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21928 23063 | let sender = sender.clone();
|
21929 23064 | async move {
|
21930 23065 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21931 23066 | sender.send(()).await.expect("receiver dropped early");
|
21932 23067 | result
|
21933 23068 | }
|
21934 23069 | })
|
21935 23070 | .build_unchecked();
|
21936 23071 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21937 23072 | .await
|
21938 23073 | .expect("unable to make an HTTP request");
|
21939 23074 | ::pretty_assertions::assert_eq!(
|
21940 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23075 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21941 23076 | http_response.status()
|
21942 23077 | );
|
21943 23078 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21944 23079 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21945 23080 | http_response.headers(),
|
21946 23081 | expected_headers,
|
21947 23082 | ));
|
21948 23083 | }
|
21949 23084 | }
|
21950 23085 |
|
21951 23086 | /// YAML-style alternate boolean literals should result in SerializationException
|
21952 23087 | /// Test ID: RestJsonBodyBooleanBadLiteral_case6
|
21953 23088 | #[::tokio::test]
|
21954 23089 | #[::tracing_test::traced_test]
|
21955 23090 | async fn rest_json_body_boolean_bad_literal_case6_malformed_request() {
|
21956 23091 | {
|
21957 23092 | #[allow(unused_mut)]
|
21958 - | let mut http_request = http::Request::builder()
|
23093 + | let mut http_request = ::http_1x::Request::builder()
|
21959 23094 | .uri("/MalformedBoolean/true")
|
21960 23095 | .method("POST")
|
21961 23096 | .header("content-type", "application/json")
|
21962 - | .body(::aws_smithy_http_server::body::Body::from(
|
21963 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
21964 - | "{ \"booleanInBody\" : YES }".as_bytes(),
|
21965 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23097 + | .body(::aws_smithy_http_server::body::boxed(
|
23098 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23099 + | &::aws_smithy_protocol_test::decode_body_data(
|
23100 + | "{ \"booleanInBody\" : YES }".as_bytes(),
|
23101 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23102 + | ),
|
21966 23103 | )),
|
21967 23104 | ))
|
21968 23105 | .unwrap();
|
21969 23106 | #[allow(unused_mut)]
|
21970 23107 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
21971 23108 | let config = crate::service::RestJsonConfig::builder().build();
|
21972 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23109 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
21973 23110 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
21974 23111 | let sender = sender.clone();
|
21975 23112 | async move {
|
21976 23113 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
21977 23114 | sender.send(()).await.expect("receiver dropped early");
|
21978 23115 | result
|
21979 23116 | }
|
21980 23117 | })
|
21981 23118 | .build_unchecked();
|
21982 23119 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
21983 23120 | .await
|
21984 23121 | .expect("unable to make an HTTP request");
|
21985 23122 | ::pretty_assertions::assert_eq!(
|
21986 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23123 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
21987 23124 | http_response.status()
|
21988 23125 | );
|
21989 23126 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
21990 23127 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
21991 23128 | http_response.headers(),
|
21992 23129 | expected_headers,
|
21993 23130 | ));
|
21994 23131 | }
|
21995 23132 | }
|
21996 23133 |
|
21997 23134 | /// YAML-style alternate boolean literals should result in SerializationException
|
21998 23135 | /// Test ID: RestJsonBodyBooleanBadLiteral_case7
|
21999 23136 | #[::tokio::test]
|
22000 23137 | #[::tracing_test::traced_test]
|
22001 23138 | async fn rest_json_body_boolean_bad_literal_case7_malformed_request() {
|
22002 23139 | {
|
22003 23140 | #[allow(unused_mut)]
|
22004 - | let mut http_request = http::Request::builder()
|
23141 + | let mut http_request = ::http_1x::Request::builder()
|
22005 23142 | .uri("/MalformedBoolean/true")
|
22006 23143 | .method("POST")
|
22007 23144 | .header("content-type", "application/json")
|
22008 - | .body(::aws_smithy_http_server::body::Body::from(
|
22009 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
22010 - | "{ \"booleanInBody\" : 1 }".as_bytes(),
|
22011 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23145 + | .body(::aws_smithy_http_server::body::boxed(
|
23146 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23147 + | &::aws_smithy_protocol_test::decode_body_data(
|
23148 + | "{ \"booleanInBody\" : 1 }".as_bytes(),
|
23149 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23150 + | ),
|
22012 23151 | )),
|
22013 23152 | ))
|
22014 23153 | .unwrap();
|
22015 23154 | #[allow(unused_mut)]
|
22016 23155 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22017 23156 | let config = crate::service::RestJsonConfig::builder().build();
|
22018 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23157 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22019 23158 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22020 23159 | let sender = sender.clone();
|
22021 23160 | async move {
|
22022 23161 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22023 23162 | sender.send(()).await.expect("receiver dropped early");
|
22024 23163 | result
|
22025 23164 | }
|
22026 23165 | })
|
22027 23166 | .build_unchecked();
|
22028 23167 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22029 23168 | .await
|
22030 23169 | .expect("unable to make an HTTP request");
|
22031 23170 | ::pretty_assertions::assert_eq!(
|
22032 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23171 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22033 23172 | http_response.status()
|
22034 23173 | );
|
22035 23174 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22036 23175 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22037 23176 | http_response.headers(),
|
22038 23177 | expected_headers,
|
22039 23178 | ));
|
22040 23179 | }
|
22041 23180 | }
|
22042 23181 |
|
22043 23182 | /// YAML-style alternate boolean literals should result in SerializationException
|
22044 23183 | /// Test ID: RestJsonBodyBooleanBadLiteral_case8
|
22045 23184 | #[::tokio::test]
|
22046 23185 | #[::tracing_test::traced_test]
|
22047 23186 | async fn rest_json_body_boolean_bad_literal_case8_malformed_request() {
|
22048 23187 | {
|
22049 23188 | #[allow(unused_mut)]
|
22050 - | let mut http_request = http::Request::builder()
|
23189 + | let mut http_request = ::http_1x::Request::builder()
|
22051 23190 | .uri("/MalformedBoolean/true")
|
22052 23191 | .method("POST")
|
22053 23192 | .header("content-type", "application/json")
|
22054 - | .body(::aws_smithy_http_server::body::Body::from(
|
22055 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
22056 - | "{ \"booleanInBody\" : on }".as_bytes(),
|
22057 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23193 + | .body(::aws_smithy_http_server::body::boxed(
|
23194 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23195 + | &::aws_smithy_protocol_test::decode_body_data(
|
23196 + | "{ \"booleanInBody\" : on }".as_bytes(),
|
23197 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23198 + | ),
|
22058 23199 | )),
|
22059 23200 | ))
|
22060 23201 | .unwrap();
|
22061 23202 | #[allow(unused_mut)]
|
22062 23203 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22063 23204 | let config = crate::service::RestJsonConfig::builder().build();
|
22064 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23205 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22065 23206 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22066 23207 | let sender = sender.clone();
|
22067 23208 | async move {
|
22068 23209 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22069 23210 | sender.send(()).await.expect("receiver dropped early");
|
22070 23211 | result
|
22071 23212 | }
|
22072 23213 | })
|
22073 23214 | .build_unchecked();
|
22074 23215 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22075 23216 | .await
|
22076 23217 | .expect("unable to make an HTTP request");
|
22077 23218 | ::pretty_assertions::assert_eq!(
|
22078 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23219 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22079 23220 | http_response.status()
|
22080 23221 | );
|
22081 23222 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22082 23223 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22083 23224 | http_response.headers(),
|
22084 23225 | expected_headers,
|
22085 23226 | ));
|
22086 23227 | }
|
22087 23228 | }
|
22088 23229 |
|
22089 23230 | /// YAML-style alternate boolean literals should result in SerializationException
|
22090 23231 | /// Test ID: RestJsonBodyBooleanBadLiteral_case9
|
22091 23232 | #[::tokio::test]
|
22092 23233 | #[::tracing_test::traced_test]
|
22093 23234 | async fn rest_json_body_boolean_bad_literal_case9_malformed_request() {
|
22094 23235 | {
|
22095 23236 | #[allow(unused_mut)]
|
22096 - | let mut http_request = http::Request::builder()
|
23237 + | let mut http_request = ::http_1x::Request::builder()
|
22097 23238 | .uri("/MalformedBoolean/true")
|
22098 23239 | .method("POST")
|
22099 23240 | .header("content-type", "application/json")
|
22100 - | .body(::aws_smithy_http_server::body::Body::from(
|
22101 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
22102 - | "{ \"booleanInBody\" : On }".as_bytes(),
|
22103 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23241 + | .body(::aws_smithy_http_server::body::boxed(
|
23242 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23243 + | &::aws_smithy_protocol_test::decode_body_data(
|
23244 + | "{ \"booleanInBody\" : On }".as_bytes(),
|
23245 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23246 + | ),
|
22104 23247 | )),
|
22105 23248 | ))
|
22106 23249 | .unwrap();
|
22107 23250 | #[allow(unused_mut)]
|
22108 23251 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22109 23252 | let config = crate::service::RestJsonConfig::builder().build();
|
22110 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23253 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22111 23254 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22112 23255 | let sender = sender.clone();
|
22113 23256 | async move {
|
22114 23257 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22115 23258 | sender.send(()).await.expect("receiver dropped early");
|
22116 23259 | result
|
22117 23260 | }
|
22118 23261 | })
|
22119 23262 | .build_unchecked();
|
22120 23263 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22121 23264 | .await
|
22122 23265 | .expect("unable to make an HTTP request");
|
22123 23266 | ::pretty_assertions::assert_eq!(
|
22124 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23267 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22125 23268 | http_response.status()
|
22126 23269 | );
|
22127 23270 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22128 23271 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22129 23272 | http_response.headers(),
|
22130 23273 | expected_headers,
|
22131 23274 | ));
|
22132 23275 | }
|
22133 23276 | }
|
22134 23277 |
|
22135 23278 | /// YAML-style alternate boolean literals should result in SerializationException
|
22136 23279 | /// Test ID: RestJsonBodyBooleanBadLiteral_case10
|
22137 23280 | #[::tokio::test]
|
22138 23281 | #[::tracing_test::traced_test]
|
22139 23282 | async fn rest_json_body_boolean_bad_literal_case10_malformed_request() {
|
22140 23283 | {
|
22141 23284 | #[allow(unused_mut)]
|
22142 - | let mut http_request = http::Request::builder()
|
23285 + | let mut http_request = ::http_1x::Request::builder()
|
22143 23286 | .uri("/MalformedBoolean/true")
|
22144 23287 | .method("POST")
|
22145 23288 | .header("content-type", "application/json")
|
22146 - | .body(::aws_smithy_http_server::body::Body::from(
|
22147 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
22148 - | "{ \"booleanInBody\" : ON }".as_bytes(),
|
22149 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23289 + | .body(::aws_smithy_http_server::body::boxed(
|
23290 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23291 + | &::aws_smithy_protocol_test::decode_body_data(
|
23292 + | "{ \"booleanInBody\" : ON }".as_bytes(),
|
23293 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23294 + | ),
|
22150 23295 | )),
|
22151 23296 | ))
|
22152 23297 | .unwrap();
|
22153 23298 | #[allow(unused_mut)]
|
22154 23299 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22155 23300 | let config = crate::service::RestJsonConfig::builder().build();
|
22156 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23301 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22157 23302 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22158 23303 | let sender = sender.clone();
|
22159 23304 | async move {
|
22160 23305 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22161 23306 | sender.send(()).await.expect("receiver dropped early");
|
22162 23307 | result
|
22163 23308 | }
|
22164 23309 | })
|
22165 23310 | .build_unchecked();
|
22166 23311 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22167 23312 | .await
|
22168 23313 | .expect("unable to make an HTTP request");
|
22169 23314 | ::pretty_assertions::assert_eq!(
|
22170 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23315 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22171 23316 | http_response.status()
|
22172 23317 | );
|
22173 23318 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22174 23319 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22175 23320 | http_response.headers(),
|
22176 23321 | expected_headers,
|
22177 23322 | ));
|
22178 23323 | }
|
22179 23324 | }
|
22180 23325 |
|
22181 23326 | /// YAML-style alternate boolean literals should result in SerializationException
|
22182 23327 | /// Test ID: RestJsonBodyBooleanBadLiteral_case11
|
22183 23328 | #[::tokio::test]
|
22184 23329 | #[::tracing_test::traced_test]
|
22185 23330 | async fn rest_json_body_boolean_bad_literal_case11_malformed_request() {
|
22186 23331 | {
|
22187 23332 | #[allow(unused_mut)]
|
22188 - | let mut http_request = http::Request::builder()
|
23333 + | let mut http_request = ::http_1x::Request::builder()
|
22189 23334 | .uri("/MalformedBoolean/true")
|
22190 23335 | .method("POST")
|
22191 23336 | .header("content-type", "application/json")
|
22192 - | .body(::aws_smithy_http_server::body::Body::from(
|
22193 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
22194 - | "{ \"booleanInBody\" : False }".as_bytes(),
|
22195 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23337 + | .body(::aws_smithy_http_server::body::boxed(
|
23338 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23339 + | &::aws_smithy_protocol_test::decode_body_data(
|
23340 + | "{ \"booleanInBody\" : False }".as_bytes(),
|
23341 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23342 + | ),
|
22196 23343 | )),
|
22197 23344 | ))
|
22198 23345 | .unwrap();
|
22199 23346 | #[allow(unused_mut)]
|
22200 23347 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22201 23348 | let config = crate::service::RestJsonConfig::builder().build();
|
22202 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23349 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22203 23350 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22204 23351 | let sender = sender.clone();
|
22205 23352 | async move {
|
22206 23353 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22207 23354 | sender.send(()).await.expect("receiver dropped early");
|
22208 23355 | result
|
22209 23356 | }
|
22210 23357 | })
|
22211 23358 | .build_unchecked();
|
22212 23359 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22213 23360 | .await
|
22214 23361 | .expect("unable to make an HTTP request");
|
22215 23362 | ::pretty_assertions::assert_eq!(
|
22216 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23363 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22217 23364 | http_response.status()
|
22218 23365 | );
|
22219 23366 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22220 23367 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22221 23368 | http_response.headers(),
|
22222 23369 | expected_headers,
|
22223 23370 | ));
|
22224 23371 | }
|
22225 23372 | }
|
22226 23373 |
|
22227 23374 | /// YAML-style alternate boolean literals should result in SerializationException
|
22228 23375 | /// Test ID: RestJsonBodyBooleanBadLiteral_case12
|
22229 23376 | #[::tokio::test]
|
22230 23377 | #[::tracing_test::traced_test]
|
22231 23378 | async fn rest_json_body_boolean_bad_literal_case12_malformed_request() {
|
22232 23379 | {
|
22233 23380 | #[allow(unused_mut)]
|
22234 - | let mut http_request = http::Request::builder()
|
23381 + | let mut http_request = ::http_1x::Request::builder()
|
22235 23382 | .uri("/MalformedBoolean/true")
|
22236 23383 | .method("POST")
|
22237 23384 | .header("content-type", "application/json")
|
22238 - | .body(::aws_smithy_http_server::body::Body::from(
|
22239 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
22240 - | "{ \"booleanInBody\" : FALSE }".as_bytes(),
|
22241 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23385 + | .body(::aws_smithy_http_server::body::boxed(
|
23386 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23387 + | &::aws_smithy_protocol_test::decode_body_data(
|
23388 + | "{ \"booleanInBody\" : FALSE }".as_bytes(),
|
23389 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23390 + | ),
|
22242 23391 | )),
|
22243 23392 | ))
|
22244 23393 | .unwrap();
|
22245 23394 | #[allow(unused_mut)]
|
22246 23395 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22247 23396 | let config = crate::service::RestJsonConfig::builder().build();
|
22248 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23397 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22249 23398 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22250 23399 | let sender = sender.clone();
|
22251 23400 | async move {
|
22252 23401 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22253 23402 | sender.send(()).await.expect("receiver dropped early");
|
22254 23403 | result
|
22255 23404 | }
|
22256 23405 | })
|
22257 23406 | .build_unchecked();
|
22258 23407 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22259 23408 | .await
|
22260 23409 | .expect("unable to make an HTTP request");
|
22261 23410 | ::pretty_assertions::assert_eq!(
|
22262 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23411 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22263 23412 | http_response.status()
|
22264 23413 | );
|
22265 23414 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22266 23415 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22267 23416 | http_response.headers(),
|
22268 23417 | expected_headers,
|
22269 23418 | ));
|
22270 23419 | }
|
22271 23420 | }
|
22272 23421 |
|
22273 23422 | /// YAML-style alternate boolean literals should result in SerializationException
|
22274 23423 | /// Test ID: RestJsonBodyBooleanBadLiteral_case13
|
22275 23424 | #[::tokio::test]
|
22276 23425 | #[::tracing_test::traced_test]
|
22277 23426 | async fn rest_json_body_boolean_bad_literal_case13_malformed_request() {
|
22278 23427 | {
|
22279 23428 | #[allow(unused_mut)]
|
22280 - | let mut http_request = http::Request::builder()
|
23429 + | let mut http_request = ::http_1x::Request::builder()
|
22281 23430 | .uri("/MalformedBoolean/true")
|
22282 23431 | .method("POST")
|
22283 23432 | .header("content-type", "application/json")
|
22284 - | .body(::aws_smithy_http_server::body::Body::from(
|
22285 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
22286 - | "{ \"booleanInBody\" : n }".as_bytes(),
|
22287 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23433 + | .body(::aws_smithy_http_server::body::boxed(
|
23434 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23435 + | &::aws_smithy_protocol_test::decode_body_data(
|
23436 + | "{ \"booleanInBody\" : n }".as_bytes(),
|
23437 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23438 + | ),
|
22288 23439 | )),
|
22289 23440 | ))
|
22290 23441 | .unwrap();
|
22291 23442 | #[allow(unused_mut)]
|
22292 23443 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22293 23444 | let config = crate::service::RestJsonConfig::builder().build();
|
22294 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23445 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22295 23446 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22296 23447 | let sender = sender.clone();
|
22297 23448 | async move {
|
22298 23449 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22299 23450 | sender.send(()).await.expect("receiver dropped early");
|
22300 23451 | result
|
22301 23452 | }
|
22302 23453 | })
|
22303 23454 | .build_unchecked();
|
22304 23455 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22305 23456 | .await
|
22306 23457 | .expect("unable to make an HTTP request");
|
22307 23458 | ::pretty_assertions::assert_eq!(
|
22308 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23459 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22309 23460 | http_response.status()
|
22310 23461 | );
|
22311 23462 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22312 23463 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22313 23464 | http_response.headers(),
|
22314 23465 | expected_headers,
|
22315 23466 | ));
|
22316 23467 | }
|
22317 23468 | }
|
22318 23469 |
|
22319 23470 | /// YAML-style alternate boolean literals should result in SerializationException
|
22320 23471 | /// Test ID: RestJsonBodyBooleanBadLiteral_case14
|
22321 23472 | #[::tokio::test]
|
22322 23473 | #[::tracing_test::traced_test]
|
22323 23474 | async fn rest_json_body_boolean_bad_literal_case14_malformed_request() {
|
22324 23475 | {
|
22325 23476 | #[allow(unused_mut)]
|
22326 - | let mut http_request = http::Request::builder()
|
23477 + | let mut http_request = ::http_1x::Request::builder()
|
22327 23478 | .uri("/MalformedBoolean/true")
|
22328 23479 | .method("POST")
|
22329 23480 | .header("content-type", "application/json")
|
22330 - | .body(::aws_smithy_http_server::body::Body::from(
|
22331 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
22332 - | "{ \"booleanInBody\" : N }".as_bytes(),
|
22333 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23481 + | .body(::aws_smithy_http_server::body::boxed(
|
23482 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23483 + | &::aws_smithy_protocol_test::decode_body_data(
|
23484 + | "{ \"booleanInBody\" : N }".as_bytes(),
|
23485 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23486 + | ),
|
22334 23487 | )),
|
22335 23488 | ))
|
22336 23489 | .unwrap();
|
22337 23490 | #[allow(unused_mut)]
|
22338 23491 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22339 23492 | let config = crate::service::RestJsonConfig::builder().build();
|
22340 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23493 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22341 23494 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22342 23495 | let sender = sender.clone();
|
22343 23496 | async move {
|
22344 23497 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22345 23498 | sender.send(()).await.expect("receiver dropped early");
|
22346 23499 | result
|
22347 23500 | }
|
22348 23501 | })
|
22349 23502 | .build_unchecked();
|
22350 23503 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22351 23504 | .await
|
22352 23505 | .expect("unable to make an HTTP request");
|
22353 23506 | ::pretty_assertions::assert_eq!(
|
22354 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23507 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22355 23508 | http_response.status()
|
22356 23509 | );
|
22357 23510 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22358 23511 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22359 23512 | http_response.headers(),
|
22360 23513 | expected_headers,
|
22361 23514 | ));
|
22362 23515 | }
|
22363 23516 | }
|
22364 23517 |
|
22365 23518 | /// YAML-style alternate boolean literals should result in SerializationException
|
22366 23519 | /// Test ID: RestJsonBodyBooleanBadLiteral_case15
|
22367 23520 | #[::tokio::test]
|
22368 23521 | #[::tracing_test::traced_test]
|
22369 23522 | async fn rest_json_body_boolean_bad_literal_case15_malformed_request() {
|
22370 23523 | {
|
22371 23524 | #[allow(unused_mut)]
|
22372 - | let mut http_request = http::Request::builder()
|
23525 + | let mut http_request = ::http_1x::Request::builder()
|
22373 23526 | .uri("/MalformedBoolean/true")
|
22374 23527 | .method("POST")
|
22375 23528 | .header("content-type", "application/json")
|
22376 - | .body(::aws_smithy_http_server::body::Body::from(
|
22377 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
22378 - | "{ \"booleanInBody\" : no }".as_bytes(),
|
22379 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23529 + | .body(::aws_smithy_http_server::body::boxed(
|
23530 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23531 + | &::aws_smithy_protocol_test::decode_body_data(
|
23532 + | "{ \"booleanInBody\" : no }".as_bytes(),
|
23533 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23534 + | ),
|
22380 23535 | )),
|
22381 23536 | ))
|
22382 23537 | .unwrap();
|
22383 23538 | #[allow(unused_mut)]
|
22384 23539 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22385 23540 | let config = crate::service::RestJsonConfig::builder().build();
|
22386 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23541 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22387 23542 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22388 23543 | let sender = sender.clone();
|
22389 23544 | async move {
|
22390 23545 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22391 23546 | sender.send(()).await.expect("receiver dropped early");
|
22392 23547 | result
|
22393 23548 | }
|
22394 23549 | })
|
22395 23550 | .build_unchecked();
|
22396 23551 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22397 23552 | .await
|
22398 23553 | .expect("unable to make an HTTP request");
|
22399 23554 | ::pretty_assertions::assert_eq!(
|
22400 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23555 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22401 23556 | http_response.status()
|
22402 23557 | );
|
22403 23558 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22404 23559 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22405 23560 | http_response.headers(),
|
22406 23561 | expected_headers,
|
22407 23562 | ));
|
22408 23563 | }
|
22409 23564 | }
|
22410 23565 |
|
22411 23566 | /// YAML-style alternate boolean literals should result in SerializationException
|
22412 23567 | /// Test ID: RestJsonBodyBooleanBadLiteral_case16
|
22413 23568 | #[::tokio::test]
|
22414 23569 | #[::tracing_test::traced_test]
|
22415 23570 | async fn rest_json_body_boolean_bad_literal_case16_malformed_request() {
|
22416 23571 | {
|
22417 23572 | #[allow(unused_mut)]
|
22418 - | let mut http_request = http::Request::builder()
|
23573 + | let mut http_request = ::http_1x::Request::builder()
|
22419 23574 | .uri("/MalformedBoolean/true")
|
22420 23575 | .method("POST")
|
22421 23576 | .header("content-type", "application/json")
|
22422 - | .body(::aws_smithy_http_server::body::Body::from(
|
22423 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
22424 - | "{ \"booleanInBody\" : No }".as_bytes(),
|
22425 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23577 + | .body(::aws_smithy_http_server::body::boxed(
|
23578 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23579 + | &::aws_smithy_protocol_test::decode_body_data(
|
23580 + | "{ \"booleanInBody\" : No }".as_bytes(),
|
23581 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23582 + | ),
|
22426 23583 | )),
|
22427 23584 | ))
|
22428 23585 | .unwrap();
|
22429 23586 | #[allow(unused_mut)]
|
22430 23587 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22431 23588 | let config = crate::service::RestJsonConfig::builder().build();
|
22432 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23589 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22433 23590 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22434 23591 | let sender = sender.clone();
|
22435 23592 | async move {
|
22436 23593 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22437 23594 | sender.send(()).await.expect("receiver dropped early");
|
22438 23595 | result
|
22439 23596 | }
|
22440 23597 | })
|
22441 23598 | .build_unchecked();
|
22442 23599 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22443 23600 | .await
|
22444 23601 | .expect("unable to make an HTTP request");
|
22445 23602 | ::pretty_assertions::assert_eq!(
|
22446 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23603 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22447 23604 | http_response.status()
|
22448 23605 | );
|
22449 23606 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22450 23607 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22451 23608 | http_response.headers(),
|
22452 23609 | expected_headers,
|
22453 23610 | ));
|
22454 23611 | }
|
22455 23612 | }
|
22456 23613 |
|
22457 23614 | /// YAML-style alternate boolean literals should result in SerializationException
|
22458 23615 | /// Test ID: RestJsonBodyBooleanBadLiteral_case17
|
22459 23616 | #[::tokio::test]
|
22460 23617 | #[::tracing_test::traced_test]
|
22461 23618 | async fn rest_json_body_boolean_bad_literal_case17_malformed_request() {
|
22462 23619 | {
|
22463 23620 | #[allow(unused_mut)]
|
22464 - | let mut http_request = http::Request::builder()
|
23621 + | let mut http_request = ::http_1x::Request::builder()
|
22465 23622 | .uri("/MalformedBoolean/true")
|
22466 23623 | .method("POST")
|
22467 23624 | .header("content-type", "application/json")
|
22468 - | .body(::aws_smithy_http_server::body::Body::from(
|
22469 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
22470 - | "{ \"booleanInBody\" : NO }".as_bytes(),
|
22471 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23625 + | .body(::aws_smithy_http_server::body::boxed(
|
23626 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23627 + | &::aws_smithy_protocol_test::decode_body_data(
|
23628 + | "{ \"booleanInBody\" : NO }".as_bytes(),
|
23629 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23630 + | ),
|
22472 23631 | )),
|
22473 23632 | ))
|
22474 23633 | .unwrap();
|
22475 23634 | #[allow(unused_mut)]
|
22476 23635 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22477 23636 | let config = crate::service::RestJsonConfig::builder().build();
|
22478 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23637 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22479 23638 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22480 23639 | let sender = sender.clone();
|
22481 23640 | async move {
|
22482 23641 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22483 23642 | sender.send(()).await.expect("receiver dropped early");
|
22484 23643 | result
|
22485 23644 | }
|
22486 23645 | })
|
22487 23646 | .build_unchecked();
|
22488 23647 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22489 23648 | .await
|
22490 23649 | .expect("unable to make an HTTP request");
|
22491 23650 | ::pretty_assertions::assert_eq!(
|
22492 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23651 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22493 23652 | http_response.status()
|
22494 23653 | );
|
22495 23654 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22496 23655 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22497 23656 | http_response.headers(),
|
22498 23657 | expected_headers,
|
22499 23658 | ));
|
22500 23659 | }
|
22501 23660 | }
|
22502 23661 |
|
22503 23662 | /// YAML-style alternate boolean literals should result in SerializationException
|
22504 23663 | /// Test ID: RestJsonBodyBooleanBadLiteral_case18
|
22505 23664 | #[::tokio::test]
|
22506 23665 | #[::tracing_test::traced_test]
|
22507 23666 | async fn rest_json_body_boolean_bad_literal_case18_malformed_request() {
|
22508 23667 | {
|
22509 23668 | #[allow(unused_mut)]
|
22510 - | let mut http_request = http::Request::builder()
|
23669 + | let mut http_request = ::http_1x::Request::builder()
|
22511 23670 | .uri("/MalformedBoolean/true")
|
22512 23671 | .method("POST")
|
22513 23672 | .header("content-type", "application/json")
|
22514 - | .body(::aws_smithy_http_server::body::Body::from(
|
22515 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
22516 - | "{ \"booleanInBody\" : 0 }".as_bytes(),
|
22517 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23673 + | .body(::aws_smithy_http_server::body::boxed(
|
23674 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23675 + | &::aws_smithy_protocol_test::decode_body_data(
|
23676 + | "{ \"booleanInBody\" : 0 }".as_bytes(),
|
23677 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23678 + | ),
|
22518 23679 | )),
|
22519 23680 | ))
|
22520 23681 | .unwrap();
|
22521 23682 | #[allow(unused_mut)]
|
22522 23683 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22523 23684 | let config = crate::service::RestJsonConfig::builder().build();
|
22524 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23685 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22525 23686 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22526 23687 | let sender = sender.clone();
|
22527 23688 | async move {
|
22528 23689 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22529 23690 | sender.send(()).await.expect("receiver dropped early");
|
22530 23691 | result
|
22531 23692 | }
|
22532 23693 | })
|
22533 23694 | .build_unchecked();
|
22534 23695 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22535 23696 | .await
|
22536 23697 | .expect("unable to make an HTTP request");
|
22537 23698 | ::pretty_assertions::assert_eq!(
|
22538 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23699 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22539 23700 | http_response.status()
|
22540 23701 | );
|
22541 23702 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22542 23703 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22543 23704 | http_response.headers(),
|
22544 23705 | expected_headers,
|
22545 23706 | ));
|
22546 23707 | }
|
22547 23708 | }
|
22548 23709 |
|
22549 23710 | /// YAML-style alternate boolean literals should result in SerializationException
|
22550 23711 | /// Test ID: RestJsonBodyBooleanBadLiteral_case19
|
22551 23712 | #[::tokio::test]
|
22552 23713 | #[::tracing_test::traced_test]
|
22553 23714 | async fn rest_json_body_boolean_bad_literal_case19_malformed_request() {
|
22554 23715 | {
|
22555 23716 | #[allow(unused_mut)]
|
22556 - | let mut http_request = http::Request::builder()
|
23717 + | let mut http_request = ::http_1x::Request::builder()
|
22557 23718 | .uri("/MalformedBoolean/true")
|
22558 23719 | .method("POST")
|
22559 23720 | .header("content-type", "application/json")
|
22560 - | .body(::aws_smithy_http_server::body::Body::from(
|
22561 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
22562 - | "{ \"booleanInBody\" : off }".as_bytes(),
|
22563 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23721 + | .body(::aws_smithy_http_server::body::boxed(
|
23722 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23723 + | &::aws_smithy_protocol_test::decode_body_data(
|
23724 + | "{ \"booleanInBody\" : off }".as_bytes(),
|
23725 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23726 + | ),
|
22564 23727 | )),
|
22565 23728 | ))
|
22566 23729 | .unwrap();
|
22567 23730 | #[allow(unused_mut)]
|
22568 23731 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22569 23732 | let config = crate::service::RestJsonConfig::builder().build();
|
22570 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23733 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22571 23734 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22572 23735 | let sender = sender.clone();
|
22573 23736 | async move {
|
22574 23737 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22575 23738 | sender.send(()).await.expect("receiver dropped early");
|
22576 23739 | result
|
22577 23740 | }
|
22578 23741 | })
|
22579 23742 | .build_unchecked();
|
22580 23743 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22581 23744 | .await
|
22582 23745 | .expect("unable to make an HTTP request");
|
22583 23746 | ::pretty_assertions::assert_eq!(
|
22584 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23747 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22585 23748 | http_response.status()
|
22586 23749 | );
|
22587 23750 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22588 23751 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22589 23752 | http_response.headers(),
|
22590 23753 | expected_headers,
|
22591 23754 | ));
|
22592 23755 | }
|
22593 23756 | }
|
22594 23757 |
|
22595 23758 | /// YAML-style alternate boolean literals should result in SerializationException
|
22596 23759 | /// Test ID: RestJsonBodyBooleanBadLiteral_case20
|
22597 23760 | #[::tokio::test]
|
22598 23761 | #[::tracing_test::traced_test]
|
22599 23762 | async fn rest_json_body_boolean_bad_literal_case20_malformed_request() {
|
22600 23763 | {
|
22601 23764 | #[allow(unused_mut)]
|
22602 - | let mut http_request = http::Request::builder()
|
23765 + | let mut http_request = ::http_1x::Request::builder()
|
22603 23766 | .uri("/MalformedBoolean/true")
|
22604 23767 | .method("POST")
|
22605 23768 | .header("content-type", "application/json")
|
22606 - | .body(::aws_smithy_http_server::body::Body::from(
|
22607 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
22608 - | "{ \"booleanInBody\" : Off }".as_bytes(),
|
22609 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23769 + | .body(::aws_smithy_http_server::body::boxed(
|
23770 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23771 + | &::aws_smithy_protocol_test::decode_body_data(
|
23772 + | "{ \"booleanInBody\" : Off }".as_bytes(),
|
23773 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23774 + | ),
|
22610 23775 | )),
|
22611 23776 | ))
|
22612 23777 | .unwrap();
|
22613 23778 | #[allow(unused_mut)]
|
22614 23779 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22615 23780 | let config = crate::service::RestJsonConfig::builder().build();
|
22616 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23781 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22617 23782 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22618 23783 | let sender = sender.clone();
|
22619 23784 | async move {
|
22620 23785 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22621 23786 | sender.send(()).await.expect("receiver dropped early");
|
22622 23787 | result
|
22623 23788 | }
|
22624 23789 | })
|
22625 23790 | .build_unchecked();
|
22626 23791 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22627 23792 | .await
|
22628 23793 | .expect("unable to make an HTTP request");
|
22629 23794 | ::pretty_assertions::assert_eq!(
|
22630 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23795 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22631 23796 | http_response.status()
|
22632 23797 | );
|
22633 23798 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22634 23799 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22635 23800 | http_response.headers(),
|
22636 23801 | expected_headers,
|
22637 23802 | ));
|
22638 23803 | }
|
22639 23804 | }
|
22640 23805 |
|
22641 23806 | /// YAML-style alternate boolean literals should result in SerializationException
|
22642 23807 | /// Test ID: RestJsonBodyBooleanBadLiteral_case21
|
22643 23808 | #[::tokio::test]
|
22644 23809 | #[::tracing_test::traced_test]
|
22645 23810 | async fn rest_json_body_boolean_bad_literal_case21_malformed_request() {
|
22646 23811 | {
|
22647 23812 | #[allow(unused_mut)]
|
22648 - | let mut http_request = http::Request::builder()
|
23813 + | let mut http_request = ::http_1x::Request::builder()
|
22649 23814 | .uri("/MalformedBoolean/true")
|
22650 23815 | .method("POST")
|
22651 23816 | .header("content-type", "application/json")
|
22652 - | .body(::aws_smithy_http_server::body::Body::from(
|
22653 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
22654 - | "{ \"booleanInBody\" : OFF }".as_bytes(),
|
22655 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23817 + | .body(::aws_smithy_http_server::body::boxed(
|
23818 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
23819 + | &::aws_smithy_protocol_test::decode_body_data(
|
23820 + | "{ \"booleanInBody\" : OFF }".as_bytes(),
|
23821 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
23822 + | ),
|
22656 23823 | )),
|
22657 23824 | ))
|
22658 23825 | .unwrap();
|
22659 23826 | #[allow(unused_mut)]
|
22660 23827 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22661 23828 | let config = crate::service::RestJsonConfig::builder().build();
|
22662 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23829 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22663 23830 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22664 23831 | let sender = sender.clone();
|
22665 23832 | async move {
|
22666 23833 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22667 23834 | sender.send(()).await.expect("receiver dropped early");
|
22668 23835 | result
|
22669 23836 | }
|
22670 23837 | })
|
22671 23838 | .build_unchecked();
|
22672 23839 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22673 23840 | .await
|
22674 23841 | .expect("unable to make an HTTP request");
|
22675 23842 | ::pretty_assertions::assert_eq!(
|
22676 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23843 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22677 23844 | http_response.status()
|
22678 23845 | );
|
22679 23846 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22680 23847 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22681 23848 | http_response.headers(),
|
22682 23849 | expected_headers,
|
22683 23850 | ));
|
22684 23851 | }
|
22685 23852 | }
|
22686 23853 |
|
22687 23854 | /// Attempted string coercion should result in SerializationException
|
22688 23855 | /// Test ID: RestJsonPathBooleanStringCoercion_case0
|
22689 23856 | #[::tokio::test]
|
22690 23857 | #[::tracing_test::traced_test]
|
22691 23858 | async fn rest_json_path_boolean_string_coercion_case0_malformed_request() {
|
22692 23859 | {
|
22693 23860 | #[allow(unused_mut)]
|
22694 - | let mut http_request = http::Request::builder()
|
23861 + | let mut http_request = ::http_1x::Request::builder()
|
22695 23862 | .uri("/MalformedBoolean/True")
|
22696 23863 | .method("POST")
|
22697 - | .body(::aws_smithy_http_server::body::Body::empty())
|
23864 + | .body(::aws_smithy_http_server::body::boxed(
|
23865 + | ::http_body_util::Empty::new(),
|
23866 + | ))
|
22698 23867 | .unwrap();
|
22699 23868 | #[allow(unused_mut)]
|
22700 23869 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22701 23870 | let config = crate::service::RestJsonConfig::builder().build();
|
22702 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23871 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22703 23872 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22704 23873 | let sender = sender.clone();
|
22705 23874 | async move {
|
22706 23875 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22707 23876 | sender.send(()).await.expect("receiver dropped early");
|
22708 23877 | result
|
22709 23878 | }
|
22710 23879 | })
|
22711 23880 | .build_unchecked();
|
22712 23881 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22713 23882 | .await
|
22714 23883 | .expect("unable to make an HTTP request");
|
22715 23884 | ::pretty_assertions::assert_eq!(
|
22716 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23885 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22717 23886 | http_response.status()
|
22718 23887 | );
|
22719 23888 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22720 23889 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22721 23890 | http_response.headers(),
|
22722 23891 | expected_headers,
|
22723 23892 | ));
|
22724 23893 | }
|
22725 23894 | }
|
22726 23895 |
|
22727 23896 | /// Attempted string coercion should result in SerializationException
|
22728 23897 | /// Test ID: RestJsonPathBooleanStringCoercion_case1
|
22729 23898 | #[::tokio::test]
|
22730 23899 | #[::tracing_test::traced_test]
|
22731 23900 | async fn rest_json_path_boolean_string_coercion_case1_malformed_request() {
|
22732 23901 | {
|
22733 23902 | #[allow(unused_mut)]
|
22734 - | let mut http_request = http::Request::builder()
|
23903 + | let mut http_request = ::http_1x::Request::builder()
|
22735 23904 | .uri("/MalformedBoolean/TRUE")
|
22736 23905 | .method("POST")
|
22737 - | .body(::aws_smithy_http_server::body::Body::empty())
|
23906 + | .body(::aws_smithy_http_server::body::boxed(
|
23907 + | ::http_body_util::Empty::new(),
|
23908 + | ))
|
22738 23909 | .unwrap();
|
22739 23910 | #[allow(unused_mut)]
|
22740 23911 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22741 23912 | let config = crate::service::RestJsonConfig::builder().build();
|
22742 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23913 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22743 23914 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22744 23915 | let sender = sender.clone();
|
22745 23916 | async move {
|
22746 23917 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22747 23918 | sender.send(()).await.expect("receiver dropped early");
|
22748 23919 | result
|
22749 23920 | }
|
22750 23921 | })
|
22751 23922 | .build_unchecked();
|
22752 23923 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22753 23924 | .await
|
22754 23925 | .expect("unable to make an HTTP request");
|
22755 23926 | ::pretty_assertions::assert_eq!(
|
22756 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23927 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22757 23928 | http_response.status()
|
22758 23929 | );
|
22759 23930 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22760 23931 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22761 23932 | http_response.headers(),
|
22762 23933 | expected_headers,
|
22763 23934 | ));
|
22764 23935 | }
|
22765 23936 | }
|
22766 23937 |
|
22767 23938 | /// Attempted string coercion should result in SerializationException
|
22768 23939 | /// Test ID: RestJsonPathBooleanStringCoercion_case2
|
22769 23940 | #[::tokio::test]
|
22770 23941 | #[::tracing_test::traced_test]
|
22771 23942 | async fn rest_json_path_boolean_string_coercion_case2_malformed_request() {
|
22772 23943 | {
|
22773 23944 | #[allow(unused_mut)]
|
22774 - | let mut http_request = http::Request::builder()
|
23945 + | let mut http_request = ::http_1x::Request::builder()
|
22775 23946 | .uri("/MalformedBoolean/y")
|
22776 23947 | .method("POST")
|
22777 - | .body(::aws_smithy_http_server::body::Body::empty())
|
23948 + | .body(::aws_smithy_http_server::body::boxed(
|
23949 + | ::http_body_util::Empty::new(),
|
23950 + | ))
|
22778 23951 | .unwrap();
|
22779 23952 | #[allow(unused_mut)]
|
22780 23953 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22781 23954 | let config = crate::service::RestJsonConfig::builder().build();
|
22782 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23955 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22783 23956 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22784 23957 | let sender = sender.clone();
|
22785 23958 | async move {
|
22786 23959 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22787 23960 | sender.send(()).await.expect("receiver dropped early");
|
22788 23961 | result
|
22789 23962 | }
|
22790 23963 | })
|
22791 23964 | .build_unchecked();
|
22792 23965 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22793 23966 | .await
|
22794 23967 | .expect("unable to make an HTTP request");
|
22795 23968 | ::pretty_assertions::assert_eq!(
|
22796 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23969 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22797 23970 | http_response.status()
|
22798 23971 | );
|
22799 23972 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22800 23973 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22801 23974 | http_response.headers(),
|
22802 23975 | expected_headers,
|
22803 23976 | ));
|
22804 23977 | }
|
22805 23978 | }
|
22806 23979 |
|
22807 23980 | /// Attempted string coercion should result in SerializationException
|
22808 23981 | /// Test ID: RestJsonPathBooleanStringCoercion_case3
|
22809 23982 | #[::tokio::test]
|
22810 23983 | #[::tracing_test::traced_test]
|
22811 23984 | async fn rest_json_path_boolean_string_coercion_case3_malformed_request() {
|
22812 23985 | {
|
22813 23986 | #[allow(unused_mut)]
|
22814 - | let mut http_request = http::Request::builder()
|
23987 + | let mut http_request = ::http_1x::Request::builder()
|
22815 23988 | .uri("/MalformedBoolean/Y")
|
22816 23989 | .method("POST")
|
22817 - | .body(::aws_smithy_http_server::body::Body::empty())
|
23990 + | .body(::aws_smithy_http_server::body::boxed(
|
23991 + | ::http_body_util::Empty::new(),
|
23992 + | ))
|
22818 23993 | .unwrap();
|
22819 23994 | #[allow(unused_mut)]
|
22820 23995 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22821 23996 | let config = crate::service::RestJsonConfig::builder().build();
|
22822 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
23997 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22823 23998 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22824 23999 | let sender = sender.clone();
|
22825 24000 | async move {
|
22826 24001 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22827 24002 | sender.send(()).await.expect("receiver dropped early");
|
22828 24003 | result
|
22829 24004 | }
|
22830 24005 | })
|
22831 24006 | .build_unchecked();
|
22832 24007 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22833 24008 | .await
|
22834 24009 | .expect("unable to make an HTTP request");
|
22835 24010 | ::pretty_assertions::assert_eq!(
|
22836 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24011 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22837 24012 | http_response.status()
|
22838 24013 | );
|
22839 24014 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22840 24015 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22841 24016 | http_response.headers(),
|
22842 24017 | expected_headers,
|
22843 24018 | ));
|
22844 24019 | }
|
22845 24020 | }
|
22846 24021 |
|
22847 24022 | /// Attempted string coercion should result in SerializationException
|
22848 24023 | /// Test ID: RestJsonPathBooleanStringCoercion_case4
|
22849 24024 | #[::tokio::test]
|
22850 24025 | #[::tracing_test::traced_test]
|
22851 24026 | async fn rest_json_path_boolean_string_coercion_case4_malformed_request() {
|
22852 24027 | {
|
22853 24028 | #[allow(unused_mut)]
|
22854 - | let mut http_request = http::Request::builder()
|
24029 + | let mut http_request = ::http_1x::Request::builder()
|
22855 24030 | .uri("/MalformedBoolean/yes")
|
22856 24031 | .method("POST")
|
22857 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24032 + | .body(::aws_smithy_http_server::body::boxed(
|
24033 + | ::http_body_util::Empty::new(),
|
24034 + | ))
|
22858 24035 | .unwrap();
|
22859 24036 | #[allow(unused_mut)]
|
22860 24037 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22861 24038 | let config = crate::service::RestJsonConfig::builder().build();
|
22862 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24039 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22863 24040 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22864 24041 | let sender = sender.clone();
|
22865 24042 | async move {
|
22866 24043 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22867 24044 | sender.send(()).await.expect("receiver dropped early");
|
22868 24045 | result
|
22869 24046 | }
|
22870 24047 | })
|
22871 24048 | .build_unchecked();
|
22872 24049 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22873 24050 | .await
|
22874 24051 | .expect("unable to make an HTTP request");
|
22875 24052 | ::pretty_assertions::assert_eq!(
|
22876 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24053 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22877 24054 | http_response.status()
|
22878 24055 | );
|
22879 24056 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22880 24057 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22881 24058 | http_response.headers(),
|
22882 24059 | expected_headers,
|
22883 24060 | ));
|
22884 24061 | }
|
22885 24062 | }
|
22886 24063 |
|
22887 24064 | /// Attempted string coercion should result in SerializationException
|
22888 24065 | /// Test ID: RestJsonPathBooleanStringCoercion_case5
|
22889 24066 | #[::tokio::test]
|
22890 24067 | #[::tracing_test::traced_test]
|
22891 24068 | async fn rest_json_path_boolean_string_coercion_case5_malformed_request() {
|
22892 24069 | {
|
22893 24070 | #[allow(unused_mut)]
|
22894 - | let mut http_request = http::Request::builder()
|
24071 + | let mut http_request = ::http_1x::Request::builder()
|
22895 24072 | .uri("/MalformedBoolean/Yes")
|
22896 24073 | .method("POST")
|
22897 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24074 + | .body(::aws_smithy_http_server::body::boxed(
|
24075 + | ::http_body_util::Empty::new(),
|
24076 + | ))
|
22898 24077 | .unwrap();
|
22899 24078 | #[allow(unused_mut)]
|
22900 24079 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22901 24080 | let config = crate::service::RestJsonConfig::builder().build();
|
22902 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24081 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22903 24082 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22904 24083 | let sender = sender.clone();
|
22905 24084 | async move {
|
22906 24085 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22907 24086 | sender.send(()).await.expect("receiver dropped early");
|
22908 24087 | result
|
22909 24088 | }
|
22910 24089 | })
|
22911 24090 | .build_unchecked();
|
22912 24091 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22913 24092 | .await
|
22914 24093 | .expect("unable to make an HTTP request");
|
22915 24094 | ::pretty_assertions::assert_eq!(
|
22916 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24095 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22917 24096 | http_response.status()
|
22918 24097 | );
|
22919 24098 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22920 24099 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22921 24100 | http_response.headers(),
|
22922 24101 | expected_headers,
|
22923 24102 | ));
|
22924 24103 | }
|
22925 24104 | }
|
22926 24105 |
|
22927 24106 | /// Attempted string coercion should result in SerializationException
|
22928 24107 | /// Test ID: RestJsonPathBooleanStringCoercion_case6
|
22929 24108 | #[::tokio::test]
|
22930 24109 | #[::tracing_test::traced_test]
|
22931 24110 | async fn rest_json_path_boolean_string_coercion_case6_malformed_request() {
|
22932 24111 | {
|
22933 24112 | #[allow(unused_mut)]
|
22934 - | let mut http_request = http::Request::builder()
|
24113 + | let mut http_request = ::http_1x::Request::builder()
|
22935 24114 | .uri("/MalformedBoolean/YES")
|
22936 24115 | .method("POST")
|
22937 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24116 + | .body(::aws_smithy_http_server::body::boxed(
|
24117 + | ::http_body_util::Empty::new(),
|
24118 + | ))
|
22938 24119 | .unwrap();
|
22939 24120 | #[allow(unused_mut)]
|
22940 24121 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22941 24122 | let config = crate::service::RestJsonConfig::builder().build();
|
22942 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24123 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22943 24124 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22944 24125 | let sender = sender.clone();
|
22945 24126 | async move {
|
22946 24127 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22947 24128 | sender.send(()).await.expect("receiver dropped early");
|
22948 24129 | result
|
22949 24130 | }
|
22950 24131 | })
|
22951 24132 | .build_unchecked();
|
22952 24133 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22953 24134 | .await
|
22954 24135 | .expect("unable to make an HTTP request");
|
22955 24136 | ::pretty_assertions::assert_eq!(
|
22956 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24137 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22957 24138 | http_response.status()
|
22958 24139 | );
|
22959 24140 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
22960 24141 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
22961 24142 | http_response.headers(),
|
22962 24143 | expected_headers,
|
22963 24144 | ));
|
22964 24145 | }
|
22965 24146 | }
|
22966 24147 |
|
22967 24148 | /// Attempted string coercion should result in SerializationException
|
22968 24149 | /// Test ID: RestJsonPathBooleanStringCoercion_case7
|
22969 24150 | #[::tokio::test]
|
22970 24151 | #[::tracing_test::traced_test]
|
22971 24152 | async fn rest_json_path_boolean_string_coercion_case7_malformed_request() {
|
22972 24153 | {
|
22973 24154 | #[allow(unused_mut)]
|
22974 - | let mut http_request = http::Request::builder()
|
24155 + | let mut http_request = ::http_1x::Request::builder()
|
22975 24156 | .uri("/MalformedBoolean/1")
|
22976 24157 | .method("POST")
|
22977 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24158 + | .body(::aws_smithy_http_server::body::boxed(
|
24159 + | ::http_body_util::Empty::new(),
|
24160 + | ))
|
22978 24161 | .unwrap();
|
22979 24162 | #[allow(unused_mut)]
|
22980 24163 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
22981 24164 | let config = crate::service::RestJsonConfig::builder().build();
|
22982 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24165 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
22983 24166 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
22984 24167 | let sender = sender.clone();
|
22985 24168 | async move {
|
22986 24169 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
22987 24170 | sender.send(()).await.expect("receiver dropped early");
|
22988 24171 | result
|
22989 24172 | }
|
22990 24173 | })
|
22991 24174 | .build_unchecked();
|
22992 24175 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
22993 24176 | .await
|
22994 24177 | .expect("unable to make an HTTP request");
|
22995 24178 | ::pretty_assertions::assert_eq!(
|
22996 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24179 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
22997 24180 | http_response.status()
|
22998 24181 | );
|
22999 24182 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23000 24183 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23001 24184 | http_response.headers(),
|
23002 24185 | expected_headers,
|
23003 24186 | ));
|
23004 24187 | }
|
23005 24188 | }
|
23006 24189 |
|
23007 24190 | /// Attempted string coercion should result in SerializationException
|
23008 24191 | /// Test ID: RestJsonPathBooleanStringCoercion_case8
|
23009 24192 | #[::tokio::test]
|
23010 24193 | #[::tracing_test::traced_test]
|
23011 24194 | async fn rest_json_path_boolean_string_coercion_case8_malformed_request() {
|
23012 24195 | {
|
23013 24196 | #[allow(unused_mut)]
|
23014 - | let mut http_request = http::Request::builder()
|
24197 + | let mut http_request = ::http_1x::Request::builder()
|
23015 24198 | .uri("/MalformedBoolean/on")
|
23016 24199 | .method("POST")
|
23017 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24200 + | .body(::aws_smithy_http_server::body::boxed(
|
24201 + | ::http_body_util::Empty::new(),
|
24202 + | ))
|
23018 24203 | .unwrap();
|
23019 24204 | #[allow(unused_mut)]
|
23020 24205 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23021 24206 | let config = crate::service::RestJsonConfig::builder().build();
|
23022 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24207 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23023 24208 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23024 24209 | let sender = sender.clone();
|
23025 24210 | async move {
|
23026 24211 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23027 24212 | sender.send(()).await.expect("receiver dropped early");
|
23028 24213 | result
|
23029 24214 | }
|
23030 24215 | })
|
23031 24216 | .build_unchecked();
|
23032 24217 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23033 24218 | .await
|
23034 24219 | .expect("unable to make an HTTP request");
|
23035 24220 | ::pretty_assertions::assert_eq!(
|
23036 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24221 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23037 24222 | http_response.status()
|
23038 24223 | );
|
23039 24224 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23040 24225 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23041 24226 | http_response.headers(),
|
23042 24227 | expected_headers,
|
23043 24228 | ));
|
23044 24229 | }
|
23045 24230 | }
|
23046 24231 |
|
23047 24232 | /// Attempted string coercion should result in SerializationException
|
23048 24233 | /// Test ID: RestJsonPathBooleanStringCoercion_case9
|
23049 24234 | #[::tokio::test]
|
23050 24235 | #[::tracing_test::traced_test]
|
23051 24236 | async fn rest_json_path_boolean_string_coercion_case9_malformed_request() {
|
23052 24237 | {
|
23053 24238 | #[allow(unused_mut)]
|
23054 - | let mut http_request = http::Request::builder()
|
24239 + | let mut http_request = ::http_1x::Request::builder()
|
23055 24240 | .uri("/MalformedBoolean/On")
|
23056 24241 | .method("POST")
|
23057 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24242 + | .body(::aws_smithy_http_server::body::boxed(
|
24243 + | ::http_body_util::Empty::new(),
|
24244 + | ))
|
23058 24245 | .unwrap();
|
23059 24246 | #[allow(unused_mut)]
|
23060 24247 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23061 24248 | let config = crate::service::RestJsonConfig::builder().build();
|
23062 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24249 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23063 24250 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23064 24251 | let sender = sender.clone();
|
23065 24252 | async move {
|
23066 24253 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23067 24254 | sender.send(()).await.expect("receiver dropped early");
|
23068 24255 | result
|
23069 24256 | }
|
23070 24257 | })
|
23071 24258 | .build_unchecked();
|
23072 24259 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23073 24260 | .await
|
23074 24261 | .expect("unable to make an HTTP request");
|
23075 24262 | ::pretty_assertions::assert_eq!(
|
23076 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24263 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23077 24264 | http_response.status()
|
23078 24265 | );
|
23079 24266 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23080 24267 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23081 24268 | http_response.headers(),
|
23082 24269 | expected_headers,
|
23083 24270 | ));
|
23084 24271 | }
|
23085 24272 | }
|
23086 24273 |
|
23087 24274 | /// Attempted string coercion should result in SerializationException
|
23088 24275 | /// Test ID: RestJsonPathBooleanStringCoercion_case10
|
23089 24276 | #[::tokio::test]
|
23090 24277 | #[::tracing_test::traced_test]
|
23091 24278 | async fn rest_json_path_boolean_string_coercion_case10_malformed_request() {
|
23092 24279 | {
|
23093 24280 | #[allow(unused_mut)]
|
23094 - | let mut http_request = http::Request::builder()
|
24281 + | let mut http_request = ::http_1x::Request::builder()
|
23095 24282 | .uri("/MalformedBoolean/ON")
|
23096 24283 | .method("POST")
|
23097 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24284 + | .body(::aws_smithy_http_server::body::boxed(
|
24285 + | ::http_body_util::Empty::new(),
|
24286 + | ))
|
23098 24287 | .unwrap();
|
23099 24288 | #[allow(unused_mut)]
|
23100 24289 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23101 24290 | let config = crate::service::RestJsonConfig::builder().build();
|
23102 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24291 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23103 24292 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23104 24293 | let sender = sender.clone();
|
23105 24294 | async move {
|
23106 24295 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23107 24296 | sender.send(()).await.expect("receiver dropped early");
|
23108 24297 | result
|
23109 24298 | }
|
23110 24299 | })
|
23111 24300 | .build_unchecked();
|
23112 24301 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23113 24302 | .await
|
23114 24303 | .expect("unable to make an HTTP request");
|
23115 24304 | ::pretty_assertions::assert_eq!(
|
23116 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24305 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23117 24306 | http_response.status()
|
23118 24307 | );
|
23119 24308 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23120 24309 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23121 24310 | http_response.headers(),
|
23122 24311 | expected_headers,
|
23123 24312 | ));
|
23124 24313 | }
|
23125 24314 | }
|
23126 24315 |
|
23127 24316 | /// Attempted string coercion should result in SerializationException
|
23128 24317 | /// Test ID: RestJsonPathBooleanStringCoercion_case11
|
23129 24318 | #[::tokio::test]
|
23130 24319 | #[::tracing_test::traced_test]
|
23131 24320 | async fn rest_json_path_boolean_string_coercion_case11_malformed_request() {
|
23132 24321 | {
|
23133 24322 | #[allow(unused_mut)]
|
23134 - | let mut http_request = http::Request::builder()
|
24323 + | let mut http_request = ::http_1x::Request::builder()
|
23135 24324 | .uri("/MalformedBoolean/False")
|
23136 24325 | .method("POST")
|
23137 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24326 + | .body(::aws_smithy_http_server::body::boxed(
|
24327 + | ::http_body_util::Empty::new(),
|
24328 + | ))
|
23138 24329 | .unwrap();
|
23139 24330 | #[allow(unused_mut)]
|
23140 24331 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23141 24332 | let config = crate::service::RestJsonConfig::builder().build();
|
23142 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24333 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23143 24334 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23144 24335 | let sender = sender.clone();
|
23145 24336 | async move {
|
23146 24337 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23147 24338 | sender.send(()).await.expect("receiver dropped early");
|
23148 24339 | result
|
23149 24340 | }
|
23150 24341 | })
|
23151 24342 | .build_unchecked();
|
23152 24343 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23153 24344 | .await
|
23154 24345 | .expect("unable to make an HTTP request");
|
23155 24346 | ::pretty_assertions::assert_eq!(
|
23156 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24347 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23157 24348 | http_response.status()
|
23158 24349 | );
|
23159 24350 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23160 24351 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23161 24352 | http_response.headers(),
|
23162 24353 | expected_headers,
|
23163 24354 | ));
|
23164 24355 | }
|
23165 24356 | }
|
23166 24357 |
|
23167 24358 | /// Attempted string coercion should result in SerializationException
|
23168 24359 | /// Test ID: RestJsonPathBooleanStringCoercion_case12
|
23169 24360 | #[::tokio::test]
|
23170 24361 | #[::tracing_test::traced_test]
|
23171 24362 | async fn rest_json_path_boolean_string_coercion_case12_malformed_request() {
|
23172 24363 | {
|
23173 24364 | #[allow(unused_mut)]
|
23174 - | let mut http_request = http::Request::builder()
|
24365 + | let mut http_request = ::http_1x::Request::builder()
|
23175 24366 | .uri("/MalformedBoolean/FALSE")
|
23176 24367 | .method("POST")
|
23177 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24368 + | .body(::aws_smithy_http_server::body::boxed(
|
24369 + | ::http_body_util::Empty::new(),
|
24370 + | ))
|
23178 24371 | .unwrap();
|
23179 24372 | #[allow(unused_mut)]
|
23180 24373 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23181 24374 | let config = crate::service::RestJsonConfig::builder().build();
|
23182 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24375 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23183 24376 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23184 24377 | let sender = sender.clone();
|
23185 24378 | async move {
|
23186 24379 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23187 24380 | sender.send(()).await.expect("receiver dropped early");
|
23188 24381 | result
|
23189 24382 | }
|
23190 24383 | })
|
23191 24384 | .build_unchecked();
|
23192 24385 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23193 24386 | .await
|
23194 24387 | .expect("unable to make an HTTP request");
|
23195 24388 | ::pretty_assertions::assert_eq!(
|
23196 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24389 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23197 24390 | http_response.status()
|
23198 24391 | );
|
23199 24392 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23200 24393 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23201 24394 | http_response.headers(),
|
23202 24395 | expected_headers,
|
23203 24396 | ));
|
23204 24397 | }
|
23205 24398 | }
|
23206 24399 |
|
23207 24400 | /// Attempted string coercion should result in SerializationException
|
23208 24401 | /// Test ID: RestJsonPathBooleanStringCoercion_case13
|
23209 24402 | #[::tokio::test]
|
23210 24403 | #[::tracing_test::traced_test]
|
23211 24404 | async fn rest_json_path_boolean_string_coercion_case13_malformed_request() {
|
23212 24405 | {
|
23213 24406 | #[allow(unused_mut)]
|
23214 - | let mut http_request = http::Request::builder()
|
24407 + | let mut http_request = ::http_1x::Request::builder()
|
23215 24408 | .uri("/MalformedBoolean/n")
|
23216 24409 | .method("POST")
|
23217 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24410 + | .body(::aws_smithy_http_server::body::boxed(
|
24411 + | ::http_body_util::Empty::new(),
|
24412 + | ))
|
23218 24413 | .unwrap();
|
23219 24414 | #[allow(unused_mut)]
|
23220 24415 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23221 24416 | let config = crate::service::RestJsonConfig::builder().build();
|
23222 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24417 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23223 24418 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23224 24419 | let sender = sender.clone();
|
23225 24420 | async move {
|
23226 24421 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23227 24422 | sender.send(()).await.expect("receiver dropped early");
|
23228 24423 | result
|
23229 24424 | }
|
23230 24425 | })
|
23231 24426 | .build_unchecked();
|
23232 24427 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23233 24428 | .await
|
23234 24429 | .expect("unable to make an HTTP request");
|
23235 24430 | ::pretty_assertions::assert_eq!(
|
23236 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24431 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23237 24432 | http_response.status()
|
23238 24433 | );
|
23239 24434 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23240 24435 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23241 24436 | http_response.headers(),
|
23242 24437 | expected_headers,
|
23243 24438 | ));
|
23244 24439 | }
|
23245 24440 | }
|
23246 24441 |
|
23247 24442 | /// Attempted string coercion should result in SerializationException
|
23248 24443 | /// Test ID: RestJsonPathBooleanStringCoercion_case14
|
23249 24444 | #[::tokio::test]
|
23250 24445 | #[::tracing_test::traced_test]
|
23251 24446 | async fn rest_json_path_boolean_string_coercion_case14_malformed_request() {
|
23252 24447 | {
|
23253 24448 | #[allow(unused_mut)]
|
23254 - | let mut http_request = http::Request::builder()
|
24449 + | let mut http_request = ::http_1x::Request::builder()
|
23255 24450 | .uri("/MalformedBoolean/N")
|
23256 24451 | .method("POST")
|
23257 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24452 + | .body(::aws_smithy_http_server::body::boxed(
|
24453 + | ::http_body_util::Empty::new(),
|
24454 + | ))
|
23258 24455 | .unwrap();
|
23259 24456 | #[allow(unused_mut)]
|
23260 24457 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23261 24458 | let config = crate::service::RestJsonConfig::builder().build();
|
23262 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24459 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23263 24460 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23264 24461 | let sender = sender.clone();
|
23265 24462 | async move {
|
23266 24463 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23267 24464 | sender.send(()).await.expect("receiver dropped early");
|
23268 24465 | result
|
23269 24466 | }
|
23270 24467 | })
|
23271 24468 | .build_unchecked();
|
23272 24469 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23273 24470 | .await
|
23274 24471 | .expect("unable to make an HTTP request");
|
23275 24472 | ::pretty_assertions::assert_eq!(
|
23276 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24473 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23277 24474 | http_response.status()
|
23278 24475 | );
|
23279 24476 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23280 24477 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23281 24478 | http_response.headers(),
|
23282 24479 | expected_headers,
|
23283 24480 | ));
|
23284 24481 | }
|
23285 24482 | }
|
23286 24483 |
|
23287 24484 | /// Attempted string coercion should result in SerializationException
|
23288 24485 | /// Test ID: RestJsonPathBooleanStringCoercion_case15
|
23289 24486 | #[::tokio::test]
|
23290 24487 | #[::tracing_test::traced_test]
|
23291 24488 | async fn rest_json_path_boolean_string_coercion_case15_malformed_request() {
|
23292 24489 | {
|
23293 24490 | #[allow(unused_mut)]
|
23294 - | let mut http_request = http::Request::builder()
|
24491 + | let mut http_request = ::http_1x::Request::builder()
|
23295 24492 | .uri("/MalformedBoolean/no")
|
23296 24493 | .method("POST")
|
23297 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24494 + | .body(::aws_smithy_http_server::body::boxed(
|
24495 + | ::http_body_util::Empty::new(),
|
24496 + | ))
|
23298 24497 | .unwrap();
|
23299 24498 | #[allow(unused_mut)]
|
23300 24499 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23301 24500 | let config = crate::service::RestJsonConfig::builder().build();
|
23302 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24501 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23303 24502 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23304 24503 | let sender = sender.clone();
|
23305 24504 | async move {
|
23306 24505 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23307 24506 | sender.send(()).await.expect("receiver dropped early");
|
23308 24507 | result
|
23309 24508 | }
|
23310 24509 | })
|
23311 24510 | .build_unchecked();
|
23312 24511 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23313 24512 | .await
|
23314 24513 | .expect("unable to make an HTTP request");
|
23315 24514 | ::pretty_assertions::assert_eq!(
|
23316 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24515 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23317 24516 | http_response.status()
|
23318 24517 | );
|
23319 24518 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23320 24519 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23321 24520 | http_response.headers(),
|
23322 24521 | expected_headers,
|
23323 24522 | ));
|
23324 24523 | }
|
23325 24524 | }
|
23326 24525 |
|
23327 24526 | /// Attempted string coercion should result in SerializationException
|
23328 24527 | /// Test ID: RestJsonPathBooleanStringCoercion_case16
|
23329 24528 | #[::tokio::test]
|
23330 24529 | #[::tracing_test::traced_test]
|
23331 24530 | async fn rest_json_path_boolean_string_coercion_case16_malformed_request() {
|
23332 24531 | {
|
23333 24532 | #[allow(unused_mut)]
|
23334 - | let mut http_request = http::Request::builder()
|
24533 + | let mut http_request = ::http_1x::Request::builder()
|
23335 24534 | .uri("/MalformedBoolean/No")
|
23336 24535 | .method("POST")
|
23337 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24536 + | .body(::aws_smithy_http_server::body::boxed(
|
24537 + | ::http_body_util::Empty::new(),
|
24538 + | ))
|
23338 24539 | .unwrap();
|
23339 24540 | #[allow(unused_mut)]
|
23340 24541 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23341 24542 | let config = crate::service::RestJsonConfig::builder().build();
|
23342 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24543 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23343 24544 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23344 24545 | let sender = sender.clone();
|
23345 24546 | async move {
|
23346 24547 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23347 24548 | sender.send(()).await.expect("receiver dropped early");
|
23348 24549 | result
|
23349 24550 | }
|
23350 24551 | })
|
23351 24552 | .build_unchecked();
|
23352 24553 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23353 24554 | .await
|
23354 24555 | .expect("unable to make an HTTP request");
|
23355 24556 | ::pretty_assertions::assert_eq!(
|
23356 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24557 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23357 24558 | http_response.status()
|
23358 24559 | );
|
23359 24560 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23360 24561 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23361 24562 | http_response.headers(),
|
23362 24563 | expected_headers,
|
23363 24564 | ));
|
23364 24565 | }
|
23365 24566 | }
|
23366 24567 |
|
23367 24568 | /// Attempted string coercion should result in SerializationException
|
23368 24569 | /// Test ID: RestJsonPathBooleanStringCoercion_case17
|
23369 24570 | #[::tokio::test]
|
23370 24571 | #[::tracing_test::traced_test]
|
23371 24572 | async fn rest_json_path_boolean_string_coercion_case17_malformed_request() {
|
23372 24573 | {
|
23373 24574 | #[allow(unused_mut)]
|
23374 - | let mut http_request = http::Request::builder()
|
24575 + | let mut http_request = ::http_1x::Request::builder()
|
23375 24576 | .uri("/MalformedBoolean/NO")
|
23376 24577 | .method("POST")
|
23377 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24578 + | .body(::aws_smithy_http_server::body::boxed(
|
24579 + | ::http_body_util::Empty::new(),
|
24580 + | ))
|
23378 24581 | .unwrap();
|
23379 24582 | #[allow(unused_mut)]
|
23380 24583 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23381 24584 | let config = crate::service::RestJsonConfig::builder().build();
|
23382 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24585 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23383 24586 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23384 24587 | let sender = sender.clone();
|
23385 24588 | async move {
|
23386 24589 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23387 24590 | sender.send(()).await.expect("receiver dropped early");
|
23388 24591 | result
|
23389 24592 | }
|
23390 24593 | })
|
23391 24594 | .build_unchecked();
|
23392 24595 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23393 24596 | .await
|
23394 24597 | .expect("unable to make an HTTP request");
|
23395 24598 | ::pretty_assertions::assert_eq!(
|
23396 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24599 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23397 24600 | http_response.status()
|
23398 24601 | );
|
23399 24602 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23400 24603 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23401 24604 | http_response.headers(),
|
23402 24605 | expected_headers,
|
23403 24606 | ));
|
23404 24607 | }
|
23405 24608 | }
|
23406 24609 |
|
23407 24610 | /// Attempted string coercion should result in SerializationException
|
23408 24611 | /// Test ID: RestJsonPathBooleanStringCoercion_case18
|
23409 24612 | #[::tokio::test]
|
23410 24613 | #[::tracing_test::traced_test]
|
23411 24614 | async fn rest_json_path_boolean_string_coercion_case18_malformed_request() {
|
23412 24615 | {
|
23413 24616 | #[allow(unused_mut)]
|
23414 - | let mut http_request = http::Request::builder()
|
24617 + | let mut http_request = ::http_1x::Request::builder()
|
23415 24618 | .uri("/MalformedBoolean/0")
|
23416 24619 | .method("POST")
|
23417 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24620 + | .body(::aws_smithy_http_server::body::boxed(
|
24621 + | ::http_body_util::Empty::new(),
|
24622 + | ))
|
23418 24623 | .unwrap();
|
23419 24624 | #[allow(unused_mut)]
|
23420 24625 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23421 24626 | let config = crate::service::RestJsonConfig::builder().build();
|
23422 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24627 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23423 24628 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23424 24629 | let sender = sender.clone();
|
23425 24630 | async move {
|
23426 24631 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23427 24632 | sender.send(()).await.expect("receiver dropped early");
|
23428 24633 | result
|
23429 24634 | }
|
23430 24635 | })
|
23431 24636 | .build_unchecked();
|
23432 24637 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23433 24638 | .await
|
23434 24639 | .expect("unable to make an HTTP request");
|
23435 24640 | ::pretty_assertions::assert_eq!(
|
23436 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24641 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23437 24642 | http_response.status()
|
23438 24643 | );
|
23439 24644 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23440 24645 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23441 24646 | http_response.headers(),
|
23442 24647 | expected_headers,
|
23443 24648 | ));
|
23444 24649 | }
|
23445 24650 | }
|
23446 24651 |
|
23447 24652 | /// Attempted string coercion should result in SerializationException
|
23448 24653 | /// Test ID: RestJsonPathBooleanStringCoercion_case19
|
23449 24654 | #[::tokio::test]
|
23450 24655 | #[::tracing_test::traced_test]
|
23451 24656 | async fn rest_json_path_boolean_string_coercion_case19_malformed_request() {
|
23452 24657 | {
|
23453 24658 | #[allow(unused_mut)]
|
23454 - | let mut http_request = http::Request::builder()
|
24659 + | let mut http_request = ::http_1x::Request::builder()
|
23455 24660 | .uri("/MalformedBoolean/off")
|
23456 24661 | .method("POST")
|
23457 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24662 + | .body(::aws_smithy_http_server::body::boxed(
|
24663 + | ::http_body_util::Empty::new(),
|
24664 + | ))
|
23458 24665 | .unwrap();
|
23459 24666 | #[allow(unused_mut)]
|
23460 24667 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23461 24668 | let config = crate::service::RestJsonConfig::builder().build();
|
23462 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24669 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23463 24670 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23464 24671 | let sender = sender.clone();
|
23465 24672 | async move {
|
23466 24673 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23467 24674 | sender.send(()).await.expect("receiver dropped early");
|
23468 24675 | result
|
23469 24676 | }
|
23470 24677 | })
|
23471 24678 | .build_unchecked();
|
23472 24679 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23473 24680 | .await
|
23474 24681 | .expect("unable to make an HTTP request");
|
23475 24682 | ::pretty_assertions::assert_eq!(
|
23476 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24683 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23477 24684 | http_response.status()
|
23478 24685 | );
|
23479 24686 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23480 24687 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23481 24688 | http_response.headers(),
|
23482 24689 | expected_headers,
|
23483 24690 | ));
|
23484 24691 | }
|
23485 24692 | }
|
23486 24693 |
|
23487 24694 | /// Attempted string coercion should result in SerializationException
|
23488 24695 | /// Test ID: RestJsonPathBooleanStringCoercion_case20
|
23489 24696 | #[::tokio::test]
|
23490 24697 | #[::tracing_test::traced_test]
|
23491 24698 | async fn rest_json_path_boolean_string_coercion_case20_malformed_request() {
|
23492 24699 | {
|
23493 24700 | #[allow(unused_mut)]
|
23494 - | let mut http_request = http::Request::builder()
|
24701 + | let mut http_request = ::http_1x::Request::builder()
|
23495 24702 | .uri("/MalformedBoolean/Off")
|
23496 24703 | .method("POST")
|
23497 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24704 + | .body(::aws_smithy_http_server::body::boxed(
|
24705 + | ::http_body_util::Empty::new(),
|
24706 + | ))
|
23498 24707 | .unwrap();
|
23499 24708 | #[allow(unused_mut)]
|
23500 24709 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23501 24710 | let config = crate::service::RestJsonConfig::builder().build();
|
23502 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24711 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23503 24712 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23504 24713 | let sender = sender.clone();
|
23505 24714 | async move {
|
23506 24715 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23507 24716 | sender.send(()).await.expect("receiver dropped early");
|
23508 24717 | result
|
23509 24718 | }
|
23510 24719 | })
|
23511 24720 | .build_unchecked();
|
23512 24721 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23513 24722 | .await
|
23514 24723 | .expect("unable to make an HTTP request");
|
23515 24724 | ::pretty_assertions::assert_eq!(
|
23516 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24725 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23517 24726 | http_response.status()
|
23518 24727 | );
|
23519 24728 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23520 24729 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23521 24730 | http_response.headers(),
|
23522 24731 | expected_headers,
|
23523 24732 | ));
|
23524 24733 | }
|
23525 24734 | }
|
23526 24735 |
|
23527 24736 | /// Attempted string coercion should result in SerializationException
|
23528 24737 | /// Test ID: RestJsonPathBooleanStringCoercion_case21
|
23529 24738 | #[::tokio::test]
|
23530 24739 | #[::tracing_test::traced_test]
|
23531 24740 | async fn rest_json_path_boolean_string_coercion_case21_malformed_request() {
|
23532 24741 | {
|
23533 24742 | #[allow(unused_mut)]
|
23534 - | let mut http_request = http::Request::builder()
|
24743 + | let mut http_request = ::http_1x::Request::builder()
|
23535 24744 | .uri("/MalformedBoolean/OFF")
|
23536 24745 | .method("POST")
|
23537 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24746 + | .body(::aws_smithy_http_server::body::boxed(
|
24747 + | ::http_body_util::Empty::new(),
|
24748 + | ))
|
23538 24749 | .unwrap();
|
23539 24750 | #[allow(unused_mut)]
|
23540 24751 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23541 24752 | let config = crate::service::RestJsonConfig::builder().build();
|
23542 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24753 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23543 24754 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23544 24755 | let sender = sender.clone();
|
23545 24756 | async move {
|
23546 24757 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23547 24758 | sender.send(()).await.expect("receiver dropped early");
|
23548 24759 | result
|
23549 24760 | }
|
23550 24761 | })
|
23551 24762 | .build_unchecked();
|
23552 24763 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23553 24764 | .await
|
23554 24765 | .expect("unable to make an HTTP request");
|
23555 24766 | ::pretty_assertions::assert_eq!(
|
23556 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24767 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23557 24768 | http_response.status()
|
23558 24769 | );
|
23559 24770 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23560 24771 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23561 24772 | http_response.headers(),
|
23562 24773 | expected_headers,
|
23563 24774 | ));
|
23564 24775 | }
|
23565 24776 | }
|
23566 24777 |
|
23567 24778 | /// Attempted string coercion should result in SerializationException
|
23568 24779 | /// Test ID: RestJsonQueryBooleanStringCoercion_case0
|
23569 24780 | #[::tokio::test]
|
23570 24781 | #[::tracing_test::traced_test]
|
23571 24782 | async fn rest_json_query_boolean_string_coercion_case0_malformed_request() {
|
23572 24783 | {
|
23573 24784 | #[allow(unused_mut)]
|
23574 - | let mut http_request = http::Request::builder()
|
24785 + | let mut http_request = ::http_1x::Request::builder()
|
23575 24786 | .uri("/MalformedBoolean/true")
|
23576 24787 | .method("POST")
|
23577 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24788 + | .body(::aws_smithy_http_server::body::boxed(
|
24789 + | ::http_body_util::Empty::new(),
|
24790 + | ))
|
23578 24791 | .unwrap();
|
23579 24792 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=True"
|
23580 24793 | .parse()
|
23581 24794 | .unwrap();
|
23582 24795 | #[allow(unused_mut)]
|
23583 24796 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23584 24797 | let config = crate::service::RestJsonConfig::builder().build();
|
23585 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24798 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23586 24799 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23587 24800 | let sender = sender.clone();
|
23588 24801 | async move {
|
23589 24802 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23590 24803 | sender.send(()).await.expect("receiver dropped early");
|
23591 24804 | result
|
23592 24805 | }
|
23593 24806 | })
|
23594 24807 | .build_unchecked();
|
23595 24808 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23596 24809 | .await
|
23597 24810 | .expect("unable to make an HTTP request");
|
23598 24811 | ::pretty_assertions::assert_eq!(
|
23599 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24812 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23600 24813 | http_response.status()
|
23601 24814 | );
|
23602 24815 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23603 24816 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23604 24817 | http_response.headers(),
|
23605 24818 | expected_headers,
|
23606 24819 | ));
|
23607 24820 | }
|
23608 24821 | }
|
23609 24822 |
|
23610 24823 | /// Attempted string coercion should result in SerializationException
|
23611 24824 | /// Test ID: RestJsonQueryBooleanStringCoercion_case1
|
23612 24825 | #[::tokio::test]
|
23613 24826 | #[::tracing_test::traced_test]
|
23614 24827 | async fn rest_json_query_boolean_string_coercion_case1_malformed_request() {
|
23615 24828 | {
|
23616 24829 | #[allow(unused_mut)]
|
23617 - | let mut http_request = http::Request::builder()
|
24830 + | let mut http_request = ::http_1x::Request::builder()
|
23618 24831 | .uri("/MalformedBoolean/true")
|
23619 24832 | .method("POST")
|
23620 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24833 + | .body(::aws_smithy_http_server::body::boxed(
|
24834 + | ::http_body_util::Empty::new(),
|
24835 + | ))
|
23621 24836 | .unwrap();
|
23622 24837 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=TRUE"
|
23623 24838 | .parse()
|
23624 24839 | .unwrap();
|
23625 24840 | #[allow(unused_mut)]
|
23626 24841 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23627 24842 | let config = crate::service::RestJsonConfig::builder().build();
|
23628 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24843 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23629 24844 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23630 24845 | let sender = sender.clone();
|
23631 24846 | async move {
|
23632 24847 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23633 24848 | sender.send(()).await.expect("receiver dropped early");
|
23634 24849 | result
|
23635 24850 | }
|
23636 24851 | })
|
23637 24852 | .build_unchecked();
|
23638 24853 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23639 24854 | .await
|
23640 24855 | .expect("unable to make an HTTP request");
|
23641 24856 | ::pretty_assertions::assert_eq!(
|
23642 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24857 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23643 24858 | http_response.status()
|
23644 24859 | );
|
23645 24860 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23646 24861 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23647 24862 | http_response.headers(),
|
23648 24863 | expected_headers,
|
23649 24864 | ));
|
23650 24865 | }
|
23651 24866 | }
|
23652 24867 |
|
23653 24868 | /// Attempted string coercion should result in SerializationException
|
23654 24869 | /// Test ID: RestJsonQueryBooleanStringCoercion_case2
|
23655 24870 | #[::tokio::test]
|
23656 24871 | #[::tracing_test::traced_test]
|
23657 24872 | async fn rest_json_query_boolean_string_coercion_case2_malformed_request() {
|
23658 24873 | {
|
23659 24874 | #[allow(unused_mut)]
|
23660 - | let mut http_request = http::Request::builder()
|
24875 + | let mut http_request = ::http_1x::Request::builder()
|
23661 24876 | .uri("/MalformedBoolean/true")
|
23662 24877 | .method("POST")
|
23663 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24878 + | .body(::aws_smithy_http_server::body::boxed(
|
24879 + | ::http_body_util::Empty::new(),
|
24880 + | ))
|
23664 24881 | .unwrap();
|
23665 24882 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=y".parse().unwrap();
|
23666 24883 | #[allow(unused_mut)]
|
23667 24884 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23668 24885 | let config = crate::service::RestJsonConfig::builder().build();
|
23669 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24886 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23670 24887 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23671 24888 | let sender = sender.clone();
|
23672 24889 | async move {
|
23673 24890 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23674 24891 | sender.send(()).await.expect("receiver dropped early");
|
23675 24892 | result
|
23676 24893 | }
|
23677 24894 | })
|
23678 24895 | .build_unchecked();
|
23679 24896 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23680 24897 | .await
|
23681 24898 | .expect("unable to make an HTTP request");
|
23682 24899 | ::pretty_assertions::assert_eq!(
|
23683 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24900 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23684 24901 | http_response.status()
|
23685 24902 | );
|
23686 24903 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23687 24904 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23688 24905 | http_response.headers(),
|
23689 24906 | expected_headers,
|
23690 24907 | ));
|
23691 24908 | }
|
23692 24909 | }
|
23693 24910 |
|
23694 24911 | /// Attempted string coercion should result in SerializationException
|
23695 24912 | /// Test ID: RestJsonQueryBooleanStringCoercion_case3
|
23696 24913 | #[::tokio::test]
|
23697 24914 | #[::tracing_test::traced_test]
|
23698 24915 | async fn rest_json_query_boolean_string_coercion_case3_malformed_request() {
|
23699 24916 | {
|
23700 24917 | #[allow(unused_mut)]
|
23701 - | let mut http_request = http::Request::builder()
|
24918 + | let mut http_request = ::http_1x::Request::builder()
|
23702 24919 | .uri("/MalformedBoolean/true")
|
23703 24920 | .method("POST")
|
23704 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24921 + | .body(::aws_smithy_http_server::body::boxed(
|
24922 + | ::http_body_util::Empty::new(),
|
24923 + | ))
|
23705 24924 | .unwrap();
|
23706 24925 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=Y".parse().unwrap();
|
23707 24926 | #[allow(unused_mut)]
|
23708 24927 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23709 24928 | let config = crate::service::RestJsonConfig::builder().build();
|
23710 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24929 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23711 24930 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23712 24931 | let sender = sender.clone();
|
23713 24932 | async move {
|
23714 24933 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23715 24934 | sender.send(()).await.expect("receiver dropped early");
|
23716 24935 | result
|
23717 24936 | }
|
23718 24937 | })
|
23719 24938 | .build_unchecked();
|
23720 24939 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23721 24940 | .await
|
23722 24941 | .expect("unable to make an HTTP request");
|
23723 24942 | ::pretty_assertions::assert_eq!(
|
23724 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24943 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23725 24944 | http_response.status()
|
23726 24945 | );
|
23727 24946 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23728 24947 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23729 24948 | http_response.headers(),
|
23730 24949 | expected_headers,
|
23731 24950 | ));
|
23732 24951 | }
|
23733 24952 | }
|
23734 24953 |
|
23735 24954 | /// Attempted string coercion should result in SerializationException
|
23736 24955 | /// Test ID: RestJsonQueryBooleanStringCoercion_case4
|
23737 24956 | #[::tokio::test]
|
23738 24957 | #[::tracing_test::traced_test]
|
23739 24958 | async fn rest_json_query_boolean_string_coercion_case4_malformed_request() {
|
23740 24959 | {
|
23741 24960 | #[allow(unused_mut)]
|
23742 - | let mut http_request = http::Request::builder()
|
24961 + | let mut http_request = ::http_1x::Request::builder()
|
23743 24962 | .uri("/MalformedBoolean/true")
|
23744 24963 | .method("POST")
|
23745 - | .body(::aws_smithy_http_server::body::Body::empty())
|
24964 + | .body(::aws_smithy_http_server::body::boxed(
|
24965 + | ::http_body_util::Empty::new(),
|
24966 + | ))
|
23746 24967 | .unwrap();
|
23747 24968 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=yes".parse().unwrap();
|
23748 24969 | #[allow(unused_mut)]
|
23749 24970 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23750 24971 | let config = crate::service::RestJsonConfig::builder().build();
|
23751 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
24972 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23752 24973 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23753 24974 | let sender = sender.clone();
|
23754 24975 | async move {
|
23755 24976 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23756 24977 | sender.send(()).await.expect("receiver dropped early");
|
23757 24978 | result
|
23758 24979 | }
|
23759 24980 | })
|
23760 24981 | .build_unchecked();
|
23761 24982 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23762 24983 | .await
|
23763 24984 | .expect("unable to make an HTTP request");
|
23764 24985 | ::pretty_assertions::assert_eq!(
|
23765 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24986 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23766 24987 | http_response.status()
|
23767 24988 | );
|
23768 24989 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23769 24990 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23770 24991 | http_response.headers(),
|
23771 24992 | expected_headers,
|
23772 24993 | ));
|
23773 24994 | }
|
23774 24995 | }
|
23775 24996 |
|
23776 24997 | /// Attempted string coercion should result in SerializationException
|
23777 24998 | /// Test ID: RestJsonQueryBooleanStringCoercion_case5
|
23778 24999 | #[::tokio::test]
|
23779 25000 | #[::tracing_test::traced_test]
|
23780 25001 | async fn rest_json_query_boolean_string_coercion_case5_malformed_request() {
|
23781 25002 | {
|
23782 25003 | #[allow(unused_mut)]
|
23783 - | let mut http_request = http::Request::builder()
|
25004 + | let mut http_request = ::http_1x::Request::builder()
|
23784 25005 | .uri("/MalformedBoolean/true")
|
23785 25006 | .method("POST")
|
23786 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25007 + | .body(::aws_smithy_http_server::body::boxed(
|
25008 + | ::http_body_util::Empty::new(),
|
25009 + | ))
|
23787 25010 | .unwrap();
|
23788 25011 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=Yes".parse().unwrap();
|
23789 25012 | #[allow(unused_mut)]
|
23790 25013 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23791 25014 | let config = crate::service::RestJsonConfig::builder().build();
|
23792 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25015 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23793 25016 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23794 25017 | let sender = sender.clone();
|
23795 25018 | async move {
|
23796 25019 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23797 25020 | sender.send(()).await.expect("receiver dropped early");
|
23798 25021 | result
|
23799 25022 | }
|
23800 25023 | })
|
23801 25024 | .build_unchecked();
|
23802 25025 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23803 25026 | .await
|
23804 25027 | .expect("unable to make an HTTP request");
|
23805 25028 | ::pretty_assertions::assert_eq!(
|
23806 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25029 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23807 25030 | http_response.status()
|
23808 25031 | );
|
23809 25032 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23810 25033 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23811 25034 | http_response.headers(),
|
23812 25035 | expected_headers,
|
23813 25036 | ));
|
23814 25037 | }
|
23815 25038 | }
|
23816 25039 |
|
23817 25040 | /// Attempted string coercion should result in SerializationException
|
23818 25041 | /// Test ID: RestJsonQueryBooleanStringCoercion_case6
|
23819 25042 | #[::tokio::test]
|
23820 25043 | #[::tracing_test::traced_test]
|
23821 25044 | async fn rest_json_query_boolean_string_coercion_case6_malformed_request() {
|
23822 25045 | {
|
23823 25046 | #[allow(unused_mut)]
|
23824 - | let mut http_request = http::Request::builder()
|
25047 + | let mut http_request = ::http_1x::Request::builder()
|
23825 25048 | .uri("/MalformedBoolean/true")
|
23826 25049 | .method("POST")
|
23827 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25050 + | .body(::aws_smithy_http_server::body::boxed(
|
25051 + | ::http_body_util::Empty::new(),
|
25052 + | ))
|
23828 25053 | .unwrap();
|
23829 25054 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=YES".parse().unwrap();
|
23830 25055 | #[allow(unused_mut)]
|
23831 25056 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23832 25057 | let config = crate::service::RestJsonConfig::builder().build();
|
23833 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25058 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23834 25059 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23835 25060 | let sender = sender.clone();
|
23836 25061 | async move {
|
23837 25062 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23838 25063 | sender.send(()).await.expect("receiver dropped early");
|
23839 25064 | result
|
23840 25065 | }
|
23841 25066 | })
|
23842 25067 | .build_unchecked();
|
23843 25068 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23844 25069 | .await
|
23845 25070 | .expect("unable to make an HTTP request");
|
23846 25071 | ::pretty_assertions::assert_eq!(
|
23847 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25072 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23848 25073 | http_response.status()
|
23849 25074 | );
|
23850 25075 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23851 25076 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23852 25077 | http_response.headers(),
|
23853 25078 | expected_headers,
|
23854 25079 | ));
|
23855 25080 | }
|
23856 25081 | }
|
23857 25082 |
|
23858 25083 | /// Attempted string coercion should result in SerializationException
|
23859 25084 | /// Test ID: RestJsonQueryBooleanStringCoercion_case7
|
23860 25085 | #[::tokio::test]
|
23861 25086 | #[::tracing_test::traced_test]
|
23862 25087 | async fn rest_json_query_boolean_string_coercion_case7_malformed_request() {
|
23863 25088 | {
|
23864 25089 | #[allow(unused_mut)]
|
23865 - | let mut http_request = http::Request::builder()
|
25090 + | let mut http_request = ::http_1x::Request::builder()
|
23866 25091 | .uri("/MalformedBoolean/true")
|
23867 25092 | .method("POST")
|
23868 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25093 + | .body(::aws_smithy_http_server::body::boxed(
|
25094 + | ::http_body_util::Empty::new(),
|
25095 + | ))
|
23869 25096 | .unwrap();
|
23870 25097 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=1".parse().unwrap();
|
23871 25098 | #[allow(unused_mut)]
|
23872 25099 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23873 25100 | let config = crate::service::RestJsonConfig::builder().build();
|
23874 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25101 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23875 25102 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23876 25103 | let sender = sender.clone();
|
23877 25104 | async move {
|
23878 25105 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23879 25106 | sender.send(()).await.expect("receiver dropped early");
|
23880 25107 | result
|
23881 25108 | }
|
23882 25109 | })
|
23883 25110 | .build_unchecked();
|
23884 25111 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23885 25112 | .await
|
23886 25113 | .expect("unable to make an HTTP request");
|
23887 25114 | ::pretty_assertions::assert_eq!(
|
23888 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25115 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23889 25116 | http_response.status()
|
23890 25117 | );
|
23891 25118 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23892 25119 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23893 25120 | http_response.headers(),
|
23894 25121 | expected_headers,
|
23895 25122 | ));
|
23896 25123 | }
|
23897 25124 | }
|
23898 25125 |
|
23899 25126 | /// Attempted string coercion should result in SerializationException
|
23900 25127 | /// Test ID: RestJsonQueryBooleanStringCoercion_case8
|
23901 25128 | #[::tokio::test]
|
23902 25129 | #[::tracing_test::traced_test]
|
23903 25130 | async fn rest_json_query_boolean_string_coercion_case8_malformed_request() {
|
23904 25131 | {
|
23905 25132 | #[allow(unused_mut)]
|
23906 - | let mut http_request = http::Request::builder()
|
25133 + | let mut http_request = ::http_1x::Request::builder()
|
23907 25134 | .uri("/MalformedBoolean/true")
|
23908 25135 | .method("POST")
|
23909 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25136 + | .body(::aws_smithy_http_server::body::boxed(
|
25137 + | ::http_body_util::Empty::new(),
|
25138 + | ))
|
23910 25139 | .unwrap();
|
23911 25140 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=on".parse().unwrap();
|
23912 25141 | #[allow(unused_mut)]
|
23913 25142 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23914 25143 | let config = crate::service::RestJsonConfig::builder().build();
|
23915 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25144 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23916 25145 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23917 25146 | let sender = sender.clone();
|
23918 25147 | async move {
|
23919 25148 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23920 25149 | sender.send(()).await.expect("receiver dropped early");
|
23921 25150 | result
|
23922 25151 | }
|
23923 25152 | })
|
23924 25153 | .build_unchecked();
|
23925 25154 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23926 25155 | .await
|
23927 25156 | .expect("unable to make an HTTP request");
|
23928 25157 | ::pretty_assertions::assert_eq!(
|
23929 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25158 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23930 25159 | http_response.status()
|
23931 25160 | );
|
23932 25161 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23933 25162 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23934 25163 | http_response.headers(),
|
23935 25164 | expected_headers,
|
23936 25165 | ));
|
23937 25166 | }
|
23938 25167 | }
|
23939 25168 |
|
23940 25169 | /// Attempted string coercion should result in SerializationException
|
23941 25170 | /// Test ID: RestJsonQueryBooleanStringCoercion_case9
|
23942 25171 | #[::tokio::test]
|
23943 25172 | #[::tracing_test::traced_test]
|
23944 25173 | async fn rest_json_query_boolean_string_coercion_case9_malformed_request() {
|
23945 25174 | {
|
23946 25175 | #[allow(unused_mut)]
|
23947 - | let mut http_request = http::Request::builder()
|
25176 + | let mut http_request = ::http_1x::Request::builder()
|
23948 25177 | .uri("/MalformedBoolean/true")
|
23949 25178 | .method("POST")
|
23950 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25179 + | .body(::aws_smithy_http_server::body::boxed(
|
25180 + | ::http_body_util::Empty::new(),
|
25181 + | ))
|
23951 25182 | .unwrap();
|
23952 25183 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=On".parse().unwrap();
|
23953 25184 | #[allow(unused_mut)]
|
23954 25185 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23955 25186 | let config = crate::service::RestJsonConfig::builder().build();
|
23956 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25187 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23957 25188 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23958 25189 | let sender = sender.clone();
|
23959 25190 | async move {
|
23960 25191 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
23961 25192 | sender.send(()).await.expect("receiver dropped early");
|
23962 25193 | result
|
23963 25194 | }
|
23964 25195 | })
|
23965 25196 | .build_unchecked();
|
23966 25197 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
23967 25198 | .await
|
23968 25199 | .expect("unable to make an HTTP request");
|
23969 25200 | ::pretty_assertions::assert_eq!(
|
23970 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25201 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
23971 25202 | http_response.status()
|
23972 25203 | );
|
23973 25204 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
23974 25205 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
23975 25206 | http_response.headers(),
|
23976 25207 | expected_headers,
|
23977 25208 | ));
|
23978 25209 | }
|
23979 25210 | }
|
23980 25211 |
|
23981 25212 | /// Attempted string coercion should result in SerializationException
|
23982 25213 | /// Test ID: RestJsonQueryBooleanStringCoercion_case10
|
23983 25214 | #[::tokio::test]
|
23984 25215 | #[::tracing_test::traced_test]
|
23985 25216 | async fn rest_json_query_boolean_string_coercion_case10_malformed_request() {
|
23986 25217 | {
|
23987 25218 | #[allow(unused_mut)]
|
23988 - | let mut http_request = http::Request::builder()
|
25219 + | let mut http_request = ::http_1x::Request::builder()
|
23989 25220 | .uri("/MalformedBoolean/true")
|
23990 25221 | .method("POST")
|
23991 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25222 + | .body(::aws_smithy_http_server::body::boxed(
|
25223 + | ::http_body_util::Empty::new(),
|
25224 + | ))
|
23992 25225 | .unwrap();
|
23993 25226 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=ON".parse().unwrap();
|
23994 25227 | #[allow(unused_mut)]
|
23995 25228 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
23996 25229 | let config = crate::service::RestJsonConfig::builder().build();
|
23997 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25230 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
23998 25231 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
23999 25232 | let sender = sender.clone();
|
24000 25233 | async move {
|
24001 25234 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24002 25235 | sender.send(()).await.expect("receiver dropped early");
|
24003 25236 | result
|
24004 25237 | }
|
24005 25238 | })
|
24006 25239 | .build_unchecked();
|
24007 25240 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24008 25241 | .await
|
24009 25242 | .expect("unable to make an HTTP request");
|
24010 25243 | ::pretty_assertions::assert_eq!(
|
24011 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25244 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24012 25245 | http_response.status()
|
24013 25246 | );
|
24014 25247 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24015 25248 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24016 25249 | http_response.headers(),
|
24017 25250 | expected_headers,
|
24018 25251 | ));
|
24019 25252 | }
|
24020 25253 | }
|
24021 25254 |
|
24022 25255 | /// Attempted string coercion should result in SerializationException
|
24023 25256 | /// Test ID: RestJsonQueryBooleanStringCoercion_case11
|
24024 25257 | #[::tokio::test]
|
24025 25258 | #[::tracing_test::traced_test]
|
24026 25259 | async fn rest_json_query_boolean_string_coercion_case11_malformed_request() {
|
24027 25260 | {
|
24028 25261 | #[allow(unused_mut)]
|
24029 - | let mut http_request = http::Request::builder()
|
25262 + | let mut http_request = ::http_1x::Request::builder()
|
24030 25263 | .uri("/MalformedBoolean/true")
|
24031 25264 | .method("POST")
|
24032 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25265 + | .body(::aws_smithy_http_server::body::boxed(
|
25266 + | ::http_body_util::Empty::new(),
|
25267 + | ))
|
24033 25268 | .unwrap();
|
24034 25269 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=False"
|
24035 25270 | .parse()
|
24036 25271 | .unwrap();
|
24037 25272 | #[allow(unused_mut)]
|
24038 25273 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24039 25274 | let config = crate::service::RestJsonConfig::builder().build();
|
24040 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25275 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24041 25276 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24042 25277 | let sender = sender.clone();
|
24043 25278 | async move {
|
24044 25279 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24045 25280 | sender.send(()).await.expect("receiver dropped early");
|
24046 25281 | result
|
24047 25282 | }
|
24048 25283 | })
|
24049 25284 | .build_unchecked();
|
24050 25285 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24051 25286 | .await
|
24052 25287 | .expect("unable to make an HTTP request");
|
24053 25288 | ::pretty_assertions::assert_eq!(
|
24054 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25289 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24055 25290 | http_response.status()
|
24056 25291 | );
|
24057 25292 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24058 25293 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24059 25294 | http_response.headers(),
|
24060 25295 | expected_headers,
|
24061 25296 | ));
|
24062 25297 | }
|
24063 25298 | }
|
24064 25299 |
|
24065 25300 | /// Attempted string coercion should result in SerializationException
|
24066 25301 | /// Test ID: RestJsonQueryBooleanStringCoercion_case12
|
24067 25302 | #[::tokio::test]
|
24068 25303 | #[::tracing_test::traced_test]
|
24069 25304 | async fn rest_json_query_boolean_string_coercion_case12_malformed_request() {
|
24070 25305 | {
|
24071 25306 | #[allow(unused_mut)]
|
24072 - | let mut http_request = http::Request::builder()
|
25307 + | let mut http_request = ::http_1x::Request::builder()
|
24073 25308 | .uri("/MalformedBoolean/true")
|
24074 25309 | .method("POST")
|
24075 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25310 + | .body(::aws_smithy_http_server::body::boxed(
|
25311 + | ::http_body_util::Empty::new(),
|
25312 + | ))
|
24076 25313 | .unwrap();
|
24077 25314 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=FALSE"
|
24078 25315 | .parse()
|
24079 25316 | .unwrap();
|
24080 25317 | #[allow(unused_mut)]
|
24081 25318 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24082 25319 | let config = crate::service::RestJsonConfig::builder().build();
|
24083 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25320 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24084 25321 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24085 25322 | let sender = sender.clone();
|
24086 25323 | async move {
|
24087 25324 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24088 25325 | sender.send(()).await.expect("receiver dropped early");
|
24089 25326 | result
|
24090 25327 | }
|
24091 25328 | })
|
24092 25329 | .build_unchecked();
|
24093 25330 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24094 25331 | .await
|
24095 25332 | .expect("unable to make an HTTP request");
|
24096 25333 | ::pretty_assertions::assert_eq!(
|
24097 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25334 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24098 25335 | http_response.status()
|
24099 25336 | );
|
24100 25337 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24101 25338 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24102 25339 | http_response.headers(),
|
24103 25340 | expected_headers,
|
24104 25341 | ));
|
24105 25342 | }
|
24106 25343 | }
|
24107 25344 |
|
24108 25345 | /// Attempted string coercion should result in SerializationException
|
24109 25346 | /// Test ID: RestJsonQueryBooleanStringCoercion_case13
|
24110 25347 | #[::tokio::test]
|
24111 25348 | #[::tracing_test::traced_test]
|
24112 25349 | async fn rest_json_query_boolean_string_coercion_case13_malformed_request() {
|
24113 25350 | {
|
24114 25351 | #[allow(unused_mut)]
|
24115 - | let mut http_request = http::Request::builder()
|
25352 + | let mut http_request = ::http_1x::Request::builder()
|
24116 25353 | .uri("/MalformedBoolean/true")
|
24117 25354 | .method("POST")
|
24118 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25355 + | .body(::aws_smithy_http_server::body::boxed(
|
25356 + | ::http_body_util::Empty::new(),
|
25357 + | ))
|
24119 25358 | .unwrap();
|
24120 25359 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=n".parse().unwrap();
|
24121 25360 | #[allow(unused_mut)]
|
24122 25361 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24123 25362 | let config = crate::service::RestJsonConfig::builder().build();
|
24124 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25363 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24125 25364 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24126 25365 | let sender = sender.clone();
|
24127 25366 | async move {
|
24128 25367 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24129 25368 | sender.send(()).await.expect("receiver dropped early");
|
24130 25369 | result
|
24131 25370 | }
|
24132 25371 | })
|
24133 25372 | .build_unchecked();
|
24134 25373 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24135 25374 | .await
|
24136 25375 | .expect("unable to make an HTTP request");
|
24137 25376 | ::pretty_assertions::assert_eq!(
|
24138 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25377 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24139 25378 | http_response.status()
|
24140 25379 | );
|
24141 25380 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24142 25381 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24143 25382 | http_response.headers(),
|
24144 25383 | expected_headers,
|
24145 25384 | ));
|
24146 25385 | }
|
24147 25386 | }
|
24148 25387 |
|
24149 25388 | /// Attempted string coercion should result in SerializationException
|
24150 25389 | /// Test ID: RestJsonQueryBooleanStringCoercion_case14
|
24151 25390 | #[::tokio::test]
|
24152 25391 | #[::tracing_test::traced_test]
|
24153 25392 | async fn rest_json_query_boolean_string_coercion_case14_malformed_request() {
|
24154 25393 | {
|
24155 25394 | #[allow(unused_mut)]
|
24156 - | let mut http_request = http::Request::builder()
|
25395 + | let mut http_request = ::http_1x::Request::builder()
|
24157 25396 | .uri("/MalformedBoolean/true")
|
24158 25397 | .method("POST")
|
24159 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25398 + | .body(::aws_smithy_http_server::body::boxed(
|
25399 + | ::http_body_util::Empty::new(),
|
25400 + | ))
|
24160 25401 | .unwrap();
|
24161 25402 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=N".parse().unwrap();
|
24162 25403 | #[allow(unused_mut)]
|
24163 25404 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24164 25405 | let config = crate::service::RestJsonConfig::builder().build();
|
24165 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25406 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24166 25407 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24167 25408 | let sender = sender.clone();
|
24168 25409 | async move {
|
24169 25410 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24170 25411 | sender.send(()).await.expect("receiver dropped early");
|
24171 25412 | result
|
24172 25413 | }
|
24173 25414 | })
|
24174 25415 | .build_unchecked();
|
24175 25416 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24176 25417 | .await
|
24177 25418 | .expect("unable to make an HTTP request");
|
24178 25419 | ::pretty_assertions::assert_eq!(
|
24179 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25420 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24180 25421 | http_response.status()
|
24181 25422 | );
|
24182 25423 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24183 25424 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24184 25425 | http_response.headers(),
|
24185 25426 | expected_headers,
|
24186 25427 | ));
|
24187 25428 | }
|
24188 25429 | }
|
24189 25430 |
|
24190 25431 | /// Attempted string coercion should result in SerializationException
|
24191 25432 | /// Test ID: RestJsonQueryBooleanStringCoercion_case15
|
24192 25433 | #[::tokio::test]
|
24193 25434 | #[::tracing_test::traced_test]
|
24194 25435 | async fn rest_json_query_boolean_string_coercion_case15_malformed_request() {
|
24195 25436 | {
|
24196 25437 | #[allow(unused_mut)]
|
24197 - | let mut http_request = http::Request::builder()
|
25438 + | let mut http_request = ::http_1x::Request::builder()
|
24198 25439 | .uri("/MalformedBoolean/true")
|
24199 25440 | .method("POST")
|
24200 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25441 + | .body(::aws_smithy_http_server::body::boxed(
|
25442 + | ::http_body_util::Empty::new(),
|
25443 + | ))
|
24201 25444 | .unwrap();
|
24202 25445 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=no".parse().unwrap();
|
24203 25446 | #[allow(unused_mut)]
|
24204 25447 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24205 25448 | let config = crate::service::RestJsonConfig::builder().build();
|
24206 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25449 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24207 25450 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24208 25451 | let sender = sender.clone();
|
24209 25452 | async move {
|
24210 25453 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24211 25454 | sender.send(()).await.expect("receiver dropped early");
|
24212 25455 | result
|
24213 25456 | }
|
24214 25457 | })
|
24215 25458 | .build_unchecked();
|
24216 25459 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24217 25460 | .await
|
24218 25461 | .expect("unable to make an HTTP request");
|
24219 25462 | ::pretty_assertions::assert_eq!(
|
24220 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25463 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24221 25464 | http_response.status()
|
24222 25465 | );
|
24223 25466 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24224 25467 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24225 25468 | http_response.headers(),
|
24226 25469 | expected_headers,
|
24227 25470 | ));
|
24228 25471 | }
|
24229 25472 | }
|
24230 25473 |
|
24231 25474 | /// Attempted string coercion should result in SerializationException
|
24232 25475 | /// Test ID: RestJsonQueryBooleanStringCoercion_case16
|
24233 25476 | #[::tokio::test]
|
24234 25477 | #[::tracing_test::traced_test]
|
24235 25478 | async fn rest_json_query_boolean_string_coercion_case16_malformed_request() {
|
24236 25479 | {
|
24237 25480 | #[allow(unused_mut)]
|
24238 - | let mut http_request = http::Request::builder()
|
25481 + | let mut http_request = ::http_1x::Request::builder()
|
24239 25482 | .uri("/MalformedBoolean/true")
|
24240 25483 | .method("POST")
|
24241 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25484 + | .body(::aws_smithy_http_server::body::boxed(
|
25485 + | ::http_body_util::Empty::new(),
|
25486 + | ))
|
24242 25487 | .unwrap();
|
24243 25488 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=No".parse().unwrap();
|
24244 25489 | #[allow(unused_mut)]
|
24245 25490 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24246 25491 | let config = crate::service::RestJsonConfig::builder().build();
|
24247 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25492 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24248 25493 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24249 25494 | let sender = sender.clone();
|
24250 25495 | async move {
|
24251 25496 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24252 25497 | sender.send(()).await.expect("receiver dropped early");
|
24253 25498 | result
|
24254 25499 | }
|
24255 25500 | })
|
24256 25501 | .build_unchecked();
|
24257 25502 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24258 25503 | .await
|
24259 25504 | .expect("unable to make an HTTP request");
|
24260 25505 | ::pretty_assertions::assert_eq!(
|
24261 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25506 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24262 25507 | http_response.status()
|
24263 25508 | );
|
24264 25509 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24265 25510 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24266 25511 | http_response.headers(),
|
24267 25512 | expected_headers,
|
24268 25513 | ));
|
24269 25514 | }
|
24270 25515 | }
|
24271 25516 |
|
24272 25517 | /// Attempted string coercion should result in SerializationException
|
24273 25518 | /// Test ID: RestJsonQueryBooleanStringCoercion_case17
|
24274 25519 | #[::tokio::test]
|
24275 25520 | #[::tracing_test::traced_test]
|
24276 25521 | async fn rest_json_query_boolean_string_coercion_case17_malformed_request() {
|
24277 25522 | {
|
24278 25523 | #[allow(unused_mut)]
|
24279 - | let mut http_request = http::Request::builder()
|
25524 + | let mut http_request = ::http_1x::Request::builder()
|
24280 25525 | .uri("/MalformedBoolean/true")
|
24281 25526 | .method("POST")
|
24282 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25527 + | .body(::aws_smithy_http_server::body::boxed(
|
25528 + | ::http_body_util::Empty::new(),
|
25529 + | ))
|
24283 25530 | .unwrap();
|
24284 25531 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=NO".parse().unwrap();
|
24285 25532 | #[allow(unused_mut)]
|
24286 25533 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24287 25534 | let config = crate::service::RestJsonConfig::builder().build();
|
24288 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25535 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24289 25536 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24290 25537 | let sender = sender.clone();
|
24291 25538 | async move {
|
24292 25539 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24293 25540 | sender.send(()).await.expect("receiver dropped early");
|
24294 25541 | result
|
24295 25542 | }
|
24296 25543 | })
|
24297 25544 | .build_unchecked();
|
24298 25545 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24299 25546 | .await
|
24300 25547 | .expect("unable to make an HTTP request");
|
24301 25548 | ::pretty_assertions::assert_eq!(
|
24302 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25549 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24303 25550 | http_response.status()
|
24304 25551 | );
|
24305 25552 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24306 25553 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24307 25554 | http_response.headers(),
|
24308 25555 | expected_headers,
|
24309 25556 | ));
|
24310 25557 | }
|
24311 25558 | }
|
24312 25559 |
|
24313 25560 | /// Attempted string coercion should result in SerializationException
|
24314 25561 | /// Test ID: RestJsonQueryBooleanStringCoercion_case18
|
24315 25562 | #[::tokio::test]
|
24316 25563 | #[::tracing_test::traced_test]
|
24317 25564 | async fn rest_json_query_boolean_string_coercion_case18_malformed_request() {
|
24318 25565 | {
|
24319 25566 | #[allow(unused_mut)]
|
24320 - | let mut http_request = http::Request::builder()
|
25567 + | let mut http_request = ::http_1x::Request::builder()
|
24321 25568 | .uri("/MalformedBoolean/true")
|
24322 25569 | .method("POST")
|
24323 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25570 + | .body(::aws_smithy_http_server::body::boxed(
|
25571 + | ::http_body_util::Empty::new(),
|
25572 + | ))
|
24324 25573 | .unwrap();
|
24325 25574 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=0".parse().unwrap();
|
24326 25575 | #[allow(unused_mut)]
|
24327 25576 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24328 25577 | let config = crate::service::RestJsonConfig::builder().build();
|
24329 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25578 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24330 25579 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24331 25580 | let sender = sender.clone();
|
24332 25581 | async move {
|
24333 25582 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24334 25583 | sender.send(()).await.expect("receiver dropped early");
|
24335 25584 | result
|
24336 25585 | }
|
24337 25586 | })
|
24338 25587 | .build_unchecked();
|
24339 25588 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24340 25589 | .await
|
24341 25590 | .expect("unable to make an HTTP request");
|
24342 25591 | ::pretty_assertions::assert_eq!(
|
24343 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25592 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24344 25593 | http_response.status()
|
24345 25594 | );
|
24346 25595 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24347 25596 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24348 25597 | http_response.headers(),
|
24349 25598 | expected_headers,
|
24350 25599 | ));
|
24351 25600 | }
|
24352 25601 | }
|
24353 25602 |
|
24354 25603 | /// Attempted string coercion should result in SerializationException
|
24355 25604 | /// Test ID: RestJsonQueryBooleanStringCoercion_case19
|
24356 25605 | #[::tokio::test]
|
24357 25606 | #[::tracing_test::traced_test]
|
24358 25607 | async fn rest_json_query_boolean_string_coercion_case19_malformed_request() {
|
24359 25608 | {
|
24360 25609 | #[allow(unused_mut)]
|
24361 - | let mut http_request = http::Request::builder()
|
25610 + | let mut http_request = ::http_1x::Request::builder()
|
24362 25611 | .uri("/MalformedBoolean/true")
|
24363 25612 | .method("POST")
|
24364 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25613 + | .body(::aws_smithy_http_server::body::boxed(
|
25614 + | ::http_body_util::Empty::new(),
|
25615 + | ))
|
24365 25616 | .unwrap();
|
24366 25617 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=off".parse().unwrap();
|
24367 25618 | #[allow(unused_mut)]
|
24368 25619 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24369 25620 | let config = crate::service::RestJsonConfig::builder().build();
|
24370 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25621 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24371 25622 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24372 25623 | let sender = sender.clone();
|
24373 25624 | async move {
|
24374 25625 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24375 25626 | sender.send(()).await.expect("receiver dropped early");
|
24376 25627 | result
|
24377 25628 | }
|
24378 25629 | })
|
24379 25630 | .build_unchecked();
|
24380 25631 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24381 25632 | .await
|
24382 25633 | .expect("unable to make an HTTP request");
|
24383 25634 | ::pretty_assertions::assert_eq!(
|
24384 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25635 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24385 25636 | http_response.status()
|
24386 25637 | );
|
24387 25638 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24388 25639 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24389 25640 | http_response.headers(),
|
24390 25641 | expected_headers,
|
24391 25642 | ));
|
24392 25643 | }
|
24393 25644 | }
|
24394 25645 |
|
24395 25646 | /// Attempted string coercion should result in SerializationException
|
24396 25647 | /// Test ID: RestJsonQueryBooleanStringCoercion_case20
|
24397 25648 | #[::tokio::test]
|
24398 25649 | #[::tracing_test::traced_test]
|
24399 25650 | async fn rest_json_query_boolean_string_coercion_case20_malformed_request() {
|
24400 25651 | {
|
24401 25652 | #[allow(unused_mut)]
|
24402 - | let mut http_request = http::Request::builder()
|
25653 + | let mut http_request = ::http_1x::Request::builder()
|
24403 25654 | .uri("/MalformedBoolean/true")
|
24404 25655 | .method("POST")
|
24405 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25656 + | .body(::aws_smithy_http_server::body::boxed(
|
25657 + | ::http_body_util::Empty::new(),
|
25658 + | ))
|
24406 25659 | .unwrap();
|
24407 25660 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=Off".parse().unwrap();
|
24408 25661 | #[allow(unused_mut)]
|
24409 25662 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24410 25663 | let config = crate::service::RestJsonConfig::builder().build();
|
24411 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25664 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24412 25665 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24413 25666 | let sender = sender.clone();
|
24414 25667 | async move {
|
24415 25668 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24416 25669 | sender.send(()).await.expect("receiver dropped early");
|
24417 25670 | result
|
24418 25671 | }
|
24419 25672 | })
|
24420 25673 | .build_unchecked();
|
24421 25674 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24422 25675 | .await
|
24423 25676 | .expect("unable to make an HTTP request");
|
24424 25677 | ::pretty_assertions::assert_eq!(
|
24425 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25678 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24426 25679 | http_response.status()
|
24427 25680 | );
|
24428 25681 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24429 25682 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24430 25683 | http_response.headers(),
|
24431 25684 | expected_headers,
|
24432 25685 | ));
|
24433 25686 | }
|
24434 25687 | }
|
24435 25688 |
|
24436 25689 | /// Attempted string coercion should result in SerializationException
|
24437 25690 | /// Test ID: RestJsonQueryBooleanStringCoercion_case21
|
24438 25691 | #[::tokio::test]
|
24439 25692 | #[::tracing_test::traced_test]
|
24440 25693 | async fn rest_json_query_boolean_string_coercion_case21_malformed_request() {
|
24441 25694 | {
|
24442 25695 | #[allow(unused_mut)]
|
24443 - | let mut http_request = http::Request::builder()
|
25696 + | let mut http_request = ::http_1x::Request::builder()
|
24444 25697 | .uri("/MalformedBoolean/true")
|
24445 25698 | .method("POST")
|
24446 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25699 + | .body(::aws_smithy_http_server::body::boxed(
|
25700 + | ::http_body_util::Empty::new(),
|
25701 + | ))
|
24447 25702 | .unwrap();
|
24448 25703 | *http_request.uri_mut() = "/MalformedBoolean/true?booleanInQuery=OFF".parse().unwrap();
|
24449 25704 | #[allow(unused_mut)]
|
24450 25705 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24451 25706 | let config = crate::service::RestJsonConfig::builder().build();
|
24452 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25707 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24453 25708 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24454 25709 | let sender = sender.clone();
|
24455 25710 | async move {
|
24456 25711 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24457 25712 | sender.send(()).await.expect("receiver dropped early");
|
24458 25713 | result
|
24459 25714 | }
|
24460 25715 | })
|
24461 25716 | .build_unchecked();
|
24462 25717 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24463 25718 | .await
|
24464 25719 | .expect("unable to make an HTTP request");
|
24465 25720 | ::pretty_assertions::assert_eq!(
|
24466 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25721 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24467 25722 | http_response.status()
|
24468 25723 | );
|
24469 25724 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24470 25725 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24471 25726 | http_response.headers(),
|
24472 25727 | expected_headers,
|
24473 25728 | ));
|
24474 25729 | }
|
24475 25730 | }
|
24476 25731 |
|
24477 25732 | /// Attempted string coercion should result in SerializationException
|
24478 25733 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case0
|
24479 25734 | #[::tokio::test]
|
24480 25735 | #[::tracing_test::traced_test]
|
24481 25736 | async fn rest_json_header_boolean_string_coercion_case0_malformed_request() {
|
24482 25737 | {
|
24483 25738 | #[allow(unused_mut)]
|
24484 - | let mut http_request = http::Request::builder()
|
25739 + | let mut http_request = ::http_1x::Request::builder()
|
24485 25740 | .uri("/MalformedBoolean/true")
|
24486 25741 | .method("POST")
|
24487 25742 | .header("booleanInHeader", "True")
|
24488 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25743 + | .body(::aws_smithy_http_server::body::boxed(
|
25744 + | ::http_body_util::Empty::new(),
|
25745 + | ))
|
24489 25746 | .unwrap();
|
24490 25747 | #[allow(unused_mut)]
|
24491 25748 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24492 25749 | let config = crate::service::RestJsonConfig::builder().build();
|
24493 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25750 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24494 25751 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24495 25752 | let sender = sender.clone();
|
24496 25753 | async move {
|
24497 25754 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24498 25755 | sender.send(()).await.expect("receiver dropped early");
|
24499 25756 | result
|
24500 25757 | }
|
24501 25758 | })
|
24502 25759 | .build_unchecked();
|
24503 25760 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24504 25761 | .await
|
24505 25762 | .expect("unable to make an HTTP request");
|
24506 25763 | ::pretty_assertions::assert_eq!(
|
24507 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25764 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24508 25765 | http_response.status()
|
24509 25766 | );
|
24510 25767 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24511 25768 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24512 25769 | http_response.headers(),
|
24513 25770 | expected_headers,
|
24514 25771 | ));
|
24515 25772 | }
|
24516 25773 | }
|
24517 25774 |
|
24518 25775 | /// Attempted string coercion should result in SerializationException
|
24519 25776 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case1
|
24520 25777 | #[::tokio::test]
|
24521 25778 | #[::tracing_test::traced_test]
|
24522 25779 | async fn rest_json_header_boolean_string_coercion_case1_malformed_request() {
|
24523 25780 | {
|
24524 25781 | #[allow(unused_mut)]
|
24525 - | let mut http_request = http::Request::builder()
|
25782 + | let mut http_request = ::http_1x::Request::builder()
|
24526 25783 | .uri("/MalformedBoolean/true")
|
24527 25784 | .method("POST")
|
24528 25785 | .header("booleanInHeader", "TRUE")
|
24529 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25786 + | .body(::aws_smithy_http_server::body::boxed(
|
25787 + | ::http_body_util::Empty::new(),
|
25788 + | ))
|
24530 25789 | .unwrap();
|
24531 25790 | #[allow(unused_mut)]
|
24532 25791 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24533 25792 | let config = crate::service::RestJsonConfig::builder().build();
|
24534 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25793 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24535 25794 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24536 25795 | let sender = sender.clone();
|
24537 25796 | async move {
|
24538 25797 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24539 25798 | sender.send(()).await.expect("receiver dropped early");
|
24540 25799 | result
|
24541 25800 | }
|
24542 25801 | })
|
24543 25802 | .build_unchecked();
|
24544 25803 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24545 25804 | .await
|
24546 25805 | .expect("unable to make an HTTP request");
|
24547 25806 | ::pretty_assertions::assert_eq!(
|
24548 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25807 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24549 25808 | http_response.status()
|
24550 25809 | );
|
24551 25810 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24552 25811 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24553 25812 | http_response.headers(),
|
24554 25813 | expected_headers,
|
24555 25814 | ));
|
24556 25815 | }
|
24557 25816 | }
|
24558 25817 |
|
24559 25818 | /// Attempted string coercion should result in SerializationException
|
24560 25819 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case2
|
24561 25820 | #[::tokio::test]
|
24562 25821 | #[::tracing_test::traced_test]
|
24563 25822 | async fn rest_json_header_boolean_string_coercion_case2_malformed_request() {
|
24564 25823 | {
|
24565 25824 | #[allow(unused_mut)]
|
24566 - | let mut http_request = http::Request::builder()
|
25825 + | let mut http_request = ::http_1x::Request::builder()
|
24567 25826 | .uri("/MalformedBoolean/true")
|
24568 25827 | .method("POST")
|
24569 25828 | .header("booleanInHeader", "y")
|
24570 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25829 + | .body(::aws_smithy_http_server::body::boxed(
|
25830 + | ::http_body_util::Empty::new(),
|
25831 + | ))
|
24571 25832 | .unwrap();
|
24572 25833 | #[allow(unused_mut)]
|
24573 25834 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24574 25835 | let config = crate::service::RestJsonConfig::builder().build();
|
24575 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25836 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24576 25837 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24577 25838 | let sender = sender.clone();
|
24578 25839 | async move {
|
24579 25840 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24580 25841 | sender.send(()).await.expect("receiver dropped early");
|
24581 25842 | result
|
24582 25843 | }
|
24583 25844 | })
|
24584 25845 | .build_unchecked();
|
24585 25846 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24586 25847 | .await
|
24587 25848 | .expect("unable to make an HTTP request");
|
24588 25849 | ::pretty_assertions::assert_eq!(
|
24589 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25850 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24590 25851 | http_response.status()
|
24591 25852 | );
|
24592 25853 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24593 25854 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24594 25855 | http_response.headers(),
|
24595 25856 | expected_headers,
|
24596 25857 | ));
|
24597 25858 | }
|
24598 25859 | }
|
24599 25860 |
|
24600 25861 | /// Attempted string coercion should result in SerializationException
|
24601 25862 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case3
|
24602 25863 | #[::tokio::test]
|
24603 25864 | #[::tracing_test::traced_test]
|
24604 25865 | async fn rest_json_header_boolean_string_coercion_case3_malformed_request() {
|
24605 25866 | {
|
24606 25867 | #[allow(unused_mut)]
|
24607 - | let mut http_request = http::Request::builder()
|
25868 + | let mut http_request = ::http_1x::Request::builder()
|
24608 25869 | .uri("/MalformedBoolean/true")
|
24609 25870 | .method("POST")
|
24610 25871 | .header("booleanInHeader", "Y")
|
24611 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25872 + | .body(::aws_smithy_http_server::body::boxed(
|
25873 + | ::http_body_util::Empty::new(),
|
25874 + | ))
|
24612 25875 | .unwrap();
|
24613 25876 | #[allow(unused_mut)]
|
24614 25877 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24615 25878 | let config = crate::service::RestJsonConfig::builder().build();
|
24616 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25879 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24617 25880 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24618 25881 | let sender = sender.clone();
|
24619 25882 | async move {
|
24620 25883 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24621 25884 | sender.send(()).await.expect("receiver dropped early");
|
24622 25885 | result
|
24623 25886 | }
|
24624 25887 | })
|
24625 25888 | .build_unchecked();
|
24626 25889 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24627 25890 | .await
|
24628 25891 | .expect("unable to make an HTTP request");
|
24629 25892 | ::pretty_assertions::assert_eq!(
|
24630 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25893 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24631 25894 | http_response.status()
|
24632 25895 | );
|
24633 25896 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24634 25897 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24635 25898 | http_response.headers(),
|
24636 25899 | expected_headers,
|
24637 25900 | ));
|
24638 25901 | }
|
24639 25902 | }
|
24640 25903 |
|
24641 25904 | /// Attempted string coercion should result in SerializationException
|
24642 25905 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case4
|
24643 25906 | #[::tokio::test]
|
24644 25907 | #[::tracing_test::traced_test]
|
24645 25908 | async fn rest_json_header_boolean_string_coercion_case4_malformed_request() {
|
24646 25909 | {
|
24647 25910 | #[allow(unused_mut)]
|
24648 - | let mut http_request = http::Request::builder()
|
25911 + | let mut http_request = ::http_1x::Request::builder()
|
24649 25912 | .uri("/MalformedBoolean/true")
|
24650 25913 | .method("POST")
|
24651 25914 | .header("booleanInHeader", "yes")
|
24652 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25915 + | .body(::aws_smithy_http_server::body::boxed(
|
25916 + | ::http_body_util::Empty::new(),
|
25917 + | ))
|
24653 25918 | .unwrap();
|
24654 25919 | #[allow(unused_mut)]
|
24655 25920 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24656 25921 | let config = crate::service::RestJsonConfig::builder().build();
|
24657 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25922 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24658 25923 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24659 25924 | let sender = sender.clone();
|
24660 25925 | async move {
|
24661 25926 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24662 25927 | sender.send(()).await.expect("receiver dropped early");
|
24663 25928 | result
|
24664 25929 | }
|
24665 25930 | })
|
24666 25931 | .build_unchecked();
|
24667 25932 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24668 25933 | .await
|
24669 25934 | .expect("unable to make an HTTP request");
|
24670 25935 | ::pretty_assertions::assert_eq!(
|
24671 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25936 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24672 25937 | http_response.status()
|
24673 25938 | );
|
24674 25939 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24675 25940 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24676 25941 | http_response.headers(),
|
24677 25942 | expected_headers,
|
24678 25943 | ));
|
24679 25944 | }
|
24680 25945 | }
|
24681 25946 |
|
24682 25947 | /// Attempted string coercion should result in SerializationException
|
24683 25948 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case5
|
24684 25949 | #[::tokio::test]
|
24685 25950 | #[::tracing_test::traced_test]
|
24686 25951 | async fn rest_json_header_boolean_string_coercion_case5_malformed_request() {
|
24687 25952 | {
|
24688 25953 | #[allow(unused_mut)]
|
24689 - | let mut http_request = http::Request::builder()
|
25954 + | let mut http_request = ::http_1x::Request::builder()
|
24690 25955 | .uri("/MalformedBoolean/true")
|
24691 25956 | .method("POST")
|
24692 25957 | .header("booleanInHeader", "Yes")
|
24693 - | .body(::aws_smithy_http_server::body::Body::empty())
|
25958 + | .body(::aws_smithy_http_server::body::boxed(
|
25959 + | ::http_body_util::Empty::new(),
|
25960 + | ))
|
24694 25961 | .unwrap();
|
24695 25962 | #[allow(unused_mut)]
|
24696 25963 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24697 25964 | let config = crate::service::RestJsonConfig::builder().build();
|
24698 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
25965 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24699 25966 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24700 25967 | let sender = sender.clone();
|
24701 25968 | async move {
|
24702 25969 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24703 25970 | sender.send(()).await.expect("receiver dropped early");
|
24704 25971 | result
|
24705 25972 | }
|
24706 25973 | })
|
24707 25974 | .build_unchecked();
|
24708 25975 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24709 25976 | .await
|
24710 25977 | .expect("unable to make an HTTP request");
|
24711 25978 | ::pretty_assertions::assert_eq!(
|
24712 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25979 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24713 25980 | http_response.status()
|
24714 25981 | );
|
24715 25982 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24716 25983 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24717 25984 | http_response.headers(),
|
24718 25985 | expected_headers,
|
24719 25986 | ));
|
24720 25987 | }
|
24721 25988 | }
|
24722 25989 |
|
24723 25990 | /// Attempted string coercion should result in SerializationException
|
24724 25991 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case6
|
24725 25992 | #[::tokio::test]
|
24726 25993 | #[::tracing_test::traced_test]
|
24727 25994 | async fn rest_json_header_boolean_string_coercion_case6_malformed_request() {
|
24728 25995 | {
|
24729 25996 | #[allow(unused_mut)]
|
24730 - | let mut http_request = http::Request::builder()
|
25997 + | let mut http_request = ::http_1x::Request::builder()
|
24731 25998 | .uri("/MalformedBoolean/true")
|
24732 25999 | .method("POST")
|
24733 26000 | .header("booleanInHeader", "YES")
|
24734 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26001 + | .body(::aws_smithy_http_server::body::boxed(
|
26002 + | ::http_body_util::Empty::new(),
|
26003 + | ))
|
24735 26004 | .unwrap();
|
24736 26005 | #[allow(unused_mut)]
|
24737 26006 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24738 26007 | let config = crate::service::RestJsonConfig::builder().build();
|
24739 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26008 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24740 26009 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24741 26010 | let sender = sender.clone();
|
24742 26011 | async move {
|
24743 26012 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24744 26013 | sender.send(()).await.expect("receiver dropped early");
|
24745 26014 | result
|
24746 26015 | }
|
24747 26016 | })
|
24748 26017 | .build_unchecked();
|
24749 26018 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24750 26019 | .await
|
24751 26020 | .expect("unable to make an HTTP request");
|
24752 26021 | ::pretty_assertions::assert_eq!(
|
24753 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26022 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24754 26023 | http_response.status()
|
24755 26024 | );
|
24756 26025 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24757 26026 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24758 26027 | http_response.headers(),
|
24759 26028 | expected_headers,
|
24760 26029 | ));
|
24761 26030 | }
|
24762 26031 | }
|
24763 26032 |
|
24764 26033 | /// Attempted string coercion should result in SerializationException
|
24765 26034 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case7
|
24766 26035 | #[::tokio::test]
|
24767 26036 | #[::tracing_test::traced_test]
|
24768 26037 | async fn rest_json_header_boolean_string_coercion_case7_malformed_request() {
|
24769 26038 | {
|
24770 26039 | #[allow(unused_mut)]
|
24771 - | let mut http_request = http::Request::builder()
|
26040 + | let mut http_request = ::http_1x::Request::builder()
|
24772 26041 | .uri("/MalformedBoolean/true")
|
24773 26042 | .method("POST")
|
24774 26043 | .header("booleanInHeader", "1")
|
24775 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26044 + | .body(::aws_smithy_http_server::body::boxed(
|
26045 + | ::http_body_util::Empty::new(),
|
26046 + | ))
|
24776 26047 | .unwrap();
|
24777 26048 | #[allow(unused_mut)]
|
24778 26049 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24779 26050 | let config = crate::service::RestJsonConfig::builder().build();
|
24780 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26051 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24781 26052 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24782 26053 | let sender = sender.clone();
|
24783 26054 | async move {
|
24784 26055 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24785 26056 | sender.send(()).await.expect("receiver dropped early");
|
24786 26057 | result
|
24787 26058 | }
|
24788 26059 | })
|
24789 26060 | .build_unchecked();
|
24790 26061 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24791 26062 | .await
|
24792 26063 | .expect("unable to make an HTTP request");
|
24793 26064 | ::pretty_assertions::assert_eq!(
|
24794 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26065 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24795 26066 | http_response.status()
|
24796 26067 | );
|
24797 26068 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24798 26069 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24799 26070 | http_response.headers(),
|
24800 26071 | expected_headers,
|
24801 26072 | ));
|
24802 26073 | }
|
24803 26074 | }
|
24804 26075 |
|
24805 26076 | /// Attempted string coercion should result in SerializationException
|
24806 26077 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case8
|
24807 26078 | #[::tokio::test]
|
24808 26079 | #[::tracing_test::traced_test]
|
24809 26080 | async fn rest_json_header_boolean_string_coercion_case8_malformed_request() {
|
24810 26081 | {
|
24811 26082 | #[allow(unused_mut)]
|
24812 - | let mut http_request = http::Request::builder()
|
26083 + | let mut http_request = ::http_1x::Request::builder()
|
24813 26084 | .uri("/MalformedBoolean/true")
|
24814 26085 | .method("POST")
|
24815 26086 | .header("booleanInHeader", "on")
|
24816 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26087 + | .body(::aws_smithy_http_server::body::boxed(
|
26088 + | ::http_body_util::Empty::new(),
|
26089 + | ))
|
24817 26090 | .unwrap();
|
24818 26091 | #[allow(unused_mut)]
|
24819 26092 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24820 26093 | let config = crate::service::RestJsonConfig::builder().build();
|
24821 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26094 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24822 26095 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24823 26096 | let sender = sender.clone();
|
24824 26097 | async move {
|
24825 26098 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24826 26099 | sender.send(()).await.expect("receiver dropped early");
|
24827 26100 | result
|
24828 26101 | }
|
24829 26102 | })
|
24830 26103 | .build_unchecked();
|
24831 26104 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24832 26105 | .await
|
24833 26106 | .expect("unable to make an HTTP request");
|
24834 26107 | ::pretty_assertions::assert_eq!(
|
24835 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26108 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24836 26109 | http_response.status()
|
24837 26110 | );
|
24838 26111 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24839 26112 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24840 26113 | http_response.headers(),
|
24841 26114 | expected_headers,
|
24842 26115 | ));
|
24843 26116 | }
|
24844 26117 | }
|
24845 26118 |
|
24846 26119 | /// Attempted string coercion should result in SerializationException
|
24847 26120 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case9
|
24848 26121 | #[::tokio::test]
|
24849 26122 | #[::tracing_test::traced_test]
|
24850 26123 | async fn rest_json_header_boolean_string_coercion_case9_malformed_request() {
|
24851 26124 | {
|
24852 26125 | #[allow(unused_mut)]
|
24853 - | let mut http_request = http::Request::builder()
|
26126 + | let mut http_request = ::http_1x::Request::builder()
|
24854 26127 | .uri("/MalformedBoolean/true")
|
24855 26128 | .method("POST")
|
24856 26129 | .header("booleanInHeader", "On")
|
24857 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26130 + | .body(::aws_smithy_http_server::body::boxed(
|
26131 + | ::http_body_util::Empty::new(),
|
26132 + | ))
|
24858 26133 | .unwrap();
|
24859 26134 | #[allow(unused_mut)]
|
24860 26135 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24861 26136 | let config = crate::service::RestJsonConfig::builder().build();
|
24862 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26137 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24863 26138 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24864 26139 | let sender = sender.clone();
|
24865 26140 | async move {
|
24866 26141 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24867 26142 | sender.send(()).await.expect("receiver dropped early");
|
24868 26143 | result
|
24869 26144 | }
|
24870 26145 | })
|
24871 26146 | .build_unchecked();
|
24872 26147 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24873 26148 | .await
|
24874 26149 | .expect("unable to make an HTTP request");
|
24875 26150 | ::pretty_assertions::assert_eq!(
|
24876 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26151 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24877 26152 | http_response.status()
|
24878 26153 | );
|
24879 26154 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24880 26155 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24881 26156 | http_response.headers(),
|
24882 26157 | expected_headers,
|
24883 26158 | ));
|
24884 26159 | }
|
24885 26160 | }
|
24886 26161 |
|
24887 26162 | /// Attempted string coercion should result in SerializationException
|
24888 26163 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case10
|
24889 26164 | #[::tokio::test]
|
24890 26165 | #[::tracing_test::traced_test]
|
24891 26166 | async fn rest_json_header_boolean_string_coercion_case10_malformed_request() {
|
24892 26167 | {
|
24893 26168 | #[allow(unused_mut)]
|
24894 - | let mut http_request = http::Request::builder()
|
26169 + | let mut http_request = ::http_1x::Request::builder()
|
24895 26170 | .uri("/MalformedBoolean/true")
|
24896 26171 | .method("POST")
|
24897 26172 | .header("booleanInHeader", "ON")
|
24898 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26173 + | .body(::aws_smithy_http_server::body::boxed(
|
26174 + | ::http_body_util::Empty::new(),
|
26175 + | ))
|
24899 26176 | .unwrap();
|
24900 26177 | #[allow(unused_mut)]
|
24901 26178 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24902 26179 | let config = crate::service::RestJsonConfig::builder().build();
|
24903 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26180 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24904 26181 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24905 26182 | let sender = sender.clone();
|
24906 26183 | async move {
|
24907 26184 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24908 26185 | sender.send(()).await.expect("receiver dropped early");
|
24909 26186 | result
|
24910 26187 | }
|
24911 26188 | })
|
24912 26189 | .build_unchecked();
|
24913 26190 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24914 26191 | .await
|
24915 26192 | .expect("unable to make an HTTP request");
|
24916 26193 | ::pretty_assertions::assert_eq!(
|
24917 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26194 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24918 26195 | http_response.status()
|
24919 26196 | );
|
24920 26197 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24921 26198 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24922 26199 | http_response.headers(),
|
24923 26200 | expected_headers,
|
24924 26201 | ));
|
24925 26202 | }
|
24926 26203 | }
|
24927 26204 |
|
24928 26205 | /// Attempted string coercion should result in SerializationException
|
24929 26206 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case11
|
24930 26207 | #[::tokio::test]
|
24931 26208 | #[::tracing_test::traced_test]
|
24932 26209 | async fn rest_json_header_boolean_string_coercion_case11_malformed_request() {
|
24933 26210 | {
|
24934 26211 | #[allow(unused_mut)]
|
24935 - | let mut http_request = http::Request::builder()
|
26212 + | let mut http_request = ::http_1x::Request::builder()
|
24936 26213 | .uri("/MalformedBoolean/true")
|
24937 26214 | .method("POST")
|
24938 26215 | .header("booleanInHeader", "False")
|
24939 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26216 + | .body(::aws_smithy_http_server::body::boxed(
|
26217 + | ::http_body_util::Empty::new(),
|
26218 + | ))
|
24940 26219 | .unwrap();
|
24941 26220 | #[allow(unused_mut)]
|
24942 26221 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24943 26222 | let config = crate::service::RestJsonConfig::builder().build();
|
24944 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26223 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24945 26224 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24946 26225 | let sender = sender.clone();
|
24947 26226 | async move {
|
24948 26227 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24949 26228 | sender.send(()).await.expect("receiver dropped early");
|
24950 26229 | result
|
24951 26230 | }
|
24952 26231 | })
|
24953 26232 | .build_unchecked();
|
24954 26233 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24955 26234 | .await
|
24956 26235 | .expect("unable to make an HTTP request");
|
24957 26236 | ::pretty_assertions::assert_eq!(
|
24958 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26237 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
24959 26238 | http_response.status()
|
24960 26239 | );
|
24961 26240 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
24962 26241 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
24963 26242 | http_response.headers(),
|
24964 26243 | expected_headers,
|
24965 26244 | ));
|
24966 26245 | }
|
24967 26246 | }
|
24968 26247 |
|
24969 26248 | /// Attempted string coercion should result in SerializationException
|
24970 26249 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case12
|
24971 26250 | #[::tokio::test]
|
24972 26251 | #[::tracing_test::traced_test]
|
24973 26252 | async fn rest_json_header_boolean_string_coercion_case12_malformed_request() {
|
24974 26253 | {
|
24975 26254 | #[allow(unused_mut)]
|
24976 - | let mut http_request = http::Request::builder()
|
26255 + | let mut http_request = ::http_1x::Request::builder()
|
24977 26256 | .uri("/MalformedBoolean/true")
|
24978 26257 | .method("POST")
|
24979 26258 | .header("booleanInHeader", "FALSE")
|
24980 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26259 + | .body(::aws_smithy_http_server::body::boxed(
|
26260 + | ::http_body_util::Empty::new(),
|
26261 + | ))
|
24981 26262 | .unwrap();
|
24982 26263 | #[allow(unused_mut)]
|
24983 26264 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
24984 26265 | let config = crate::service::RestJsonConfig::builder().build();
|
24985 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26266 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
24986 26267 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
24987 26268 | let sender = sender.clone();
|
24988 26269 | async move {
|
24989 26270 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
24990 26271 | sender.send(()).await.expect("receiver dropped early");
|
24991 26272 | result
|
24992 26273 | }
|
24993 26274 | })
|
24994 26275 | .build_unchecked();
|
24995 26276 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
24996 26277 | .await
|
24997 26278 | .expect("unable to make an HTTP request");
|
24998 26279 | ::pretty_assertions::assert_eq!(
|
24999 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26280 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25000 26281 | http_response.status()
|
25001 26282 | );
|
25002 26283 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25003 26284 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25004 26285 | http_response.headers(),
|
25005 26286 | expected_headers,
|
25006 26287 | ));
|
25007 26288 | }
|
25008 26289 | }
|
25009 26290 |
|
25010 26291 | /// Attempted string coercion should result in SerializationException
|
25011 26292 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case13
|
25012 26293 | #[::tokio::test]
|
25013 26294 | #[::tracing_test::traced_test]
|
25014 26295 | async fn rest_json_header_boolean_string_coercion_case13_malformed_request() {
|
25015 26296 | {
|
25016 26297 | #[allow(unused_mut)]
|
25017 - | let mut http_request = http::Request::builder()
|
26298 + | let mut http_request = ::http_1x::Request::builder()
|
25018 26299 | .uri("/MalformedBoolean/true")
|
25019 26300 | .method("POST")
|
25020 26301 | .header("booleanInHeader", "n")
|
25021 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26302 + | .body(::aws_smithy_http_server::body::boxed(
|
26303 + | ::http_body_util::Empty::new(),
|
26304 + | ))
|
25022 26305 | .unwrap();
|
25023 26306 | #[allow(unused_mut)]
|
25024 26307 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25025 26308 | let config = crate::service::RestJsonConfig::builder().build();
|
25026 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26309 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25027 26310 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
25028 26311 | let sender = sender.clone();
|
25029 26312 | async move {
|
25030 26313 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
25031 26314 | sender.send(()).await.expect("receiver dropped early");
|
25032 26315 | result
|
25033 26316 | }
|
25034 26317 | })
|
25035 26318 | .build_unchecked();
|
25036 26319 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25037 26320 | .await
|
25038 26321 | .expect("unable to make an HTTP request");
|
25039 26322 | ::pretty_assertions::assert_eq!(
|
25040 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26323 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25041 26324 | http_response.status()
|
25042 26325 | );
|
25043 26326 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25044 26327 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25045 26328 | http_response.headers(),
|
25046 26329 | expected_headers,
|
25047 26330 | ));
|
25048 26331 | }
|
25049 26332 | }
|
25050 26333 |
|
25051 26334 | /// Attempted string coercion should result in SerializationException
|
25052 26335 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case14
|
25053 26336 | #[::tokio::test]
|
25054 26337 | #[::tracing_test::traced_test]
|
25055 26338 | async fn rest_json_header_boolean_string_coercion_case14_malformed_request() {
|
25056 26339 | {
|
25057 26340 | #[allow(unused_mut)]
|
25058 - | let mut http_request = http::Request::builder()
|
26341 + | let mut http_request = ::http_1x::Request::builder()
|
25059 26342 | .uri("/MalformedBoolean/true")
|
25060 26343 | .method("POST")
|
25061 26344 | .header("booleanInHeader", "N")
|
25062 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26345 + | .body(::aws_smithy_http_server::body::boxed(
|
26346 + | ::http_body_util::Empty::new(),
|
26347 + | ))
|
25063 26348 | .unwrap();
|
25064 26349 | #[allow(unused_mut)]
|
25065 26350 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25066 26351 | let config = crate::service::RestJsonConfig::builder().build();
|
25067 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26352 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25068 26353 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
25069 26354 | let sender = sender.clone();
|
25070 26355 | async move {
|
25071 26356 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
25072 26357 | sender.send(()).await.expect("receiver dropped early");
|
25073 26358 | result
|
25074 26359 | }
|
25075 26360 | })
|
25076 26361 | .build_unchecked();
|
25077 26362 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25078 26363 | .await
|
25079 26364 | .expect("unable to make an HTTP request");
|
25080 26365 | ::pretty_assertions::assert_eq!(
|
25081 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26366 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25082 26367 | http_response.status()
|
25083 26368 | );
|
25084 26369 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25085 26370 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25086 26371 | http_response.headers(),
|
25087 26372 | expected_headers,
|
25088 26373 | ));
|
25089 26374 | }
|
25090 26375 | }
|
25091 26376 |
|
25092 26377 | /// Attempted string coercion should result in SerializationException
|
25093 26378 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case15
|
25094 26379 | #[::tokio::test]
|
25095 26380 | #[::tracing_test::traced_test]
|
25096 26381 | async fn rest_json_header_boolean_string_coercion_case15_malformed_request() {
|
25097 26382 | {
|
25098 26383 | #[allow(unused_mut)]
|
25099 - | let mut http_request = http::Request::builder()
|
26384 + | let mut http_request = ::http_1x::Request::builder()
|
25100 26385 | .uri("/MalformedBoolean/true")
|
25101 26386 | .method("POST")
|
25102 26387 | .header("booleanInHeader", "no")
|
25103 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26388 + | .body(::aws_smithy_http_server::body::boxed(
|
26389 + | ::http_body_util::Empty::new(),
|
26390 + | ))
|
25104 26391 | .unwrap();
|
25105 26392 | #[allow(unused_mut)]
|
25106 26393 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25107 26394 | let config = crate::service::RestJsonConfig::builder().build();
|
25108 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26395 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25109 26396 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
25110 26397 | let sender = sender.clone();
|
25111 26398 | async move {
|
25112 26399 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
25113 26400 | sender.send(()).await.expect("receiver dropped early");
|
25114 26401 | result
|
25115 26402 | }
|
25116 26403 | })
|
25117 26404 | .build_unchecked();
|
25118 26405 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25119 26406 | .await
|
25120 26407 | .expect("unable to make an HTTP request");
|
25121 26408 | ::pretty_assertions::assert_eq!(
|
25122 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26409 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25123 26410 | http_response.status()
|
25124 26411 | );
|
25125 26412 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25126 26413 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25127 26414 | http_response.headers(),
|
25128 26415 | expected_headers,
|
25129 26416 | ));
|
25130 26417 | }
|
25131 26418 | }
|
25132 26419 |
|
25133 26420 | /// Attempted string coercion should result in SerializationException
|
25134 26421 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case16
|
25135 26422 | #[::tokio::test]
|
25136 26423 | #[::tracing_test::traced_test]
|
25137 26424 | async fn rest_json_header_boolean_string_coercion_case16_malformed_request() {
|
25138 26425 | {
|
25139 26426 | #[allow(unused_mut)]
|
25140 - | let mut http_request = http::Request::builder()
|
26427 + | let mut http_request = ::http_1x::Request::builder()
|
25141 26428 | .uri("/MalformedBoolean/true")
|
25142 26429 | .method("POST")
|
25143 26430 | .header("booleanInHeader", "No")
|
25144 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26431 + | .body(::aws_smithy_http_server::body::boxed(
|
26432 + | ::http_body_util::Empty::new(),
|
26433 + | ))
|
25145 26434 | .unwrap();
|
25146 26435 | #[allow(unused_mut)]
|
25147 26436 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25148 26437 | let config = crate::service::RestJsonConfig::builder().build();
|
25149 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26438 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25150 26439 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
25151 26440 | let sender = sender.clone();
|
25152 26441 | async move {
|
25153 26442 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
25154 26443 | sender.send(()).await.expect("receiver dropped early");
|
25155 26444 | result
|
25156 26445 | }
|
25157 26446 | })
|
25158 26447 | .build_unchecked();
|
25159 26448 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25160 26449 | .await
|
25161 26450 | .expect("unable to make an HTTP request");
|
25162 26451 | ::pretty_assertions::assert_eq!(
|
25163 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26452 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25164 26453 | http_response.status()
|
25165 26454 | );
|
25166 26455 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25167 26456 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25168 26457 | http_response.headers(),
|
25169 26458 | expected_headers,
|
25170 26459 | ));
|
25171 26460 | }
|
25172 26461 | }
|
25173 26462 |
|
25174 26463 | /// Attempted string coercion should result in SerializationException
|
25175 26464 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case17
|
25176 26465 | #[::tokio::test]
|
25177 26466 | #[::tracing_test::traced_test]
|
25178 26467 | async fn rest_json_header_boolean_string_coercion_case17_malformed_request() {
|
25179 26468 | {
|
25180 26469 | #[allow(unused_mut)]
|
25181 - | let mut http_request = http::Request::builder()
|
26470 + | let mut http_request = ::http_1x::Request::builder()
|
25182 26471 | .uri("/MalformedBoolean/true")
|
25183 26472 | .method("POST")
|
25184 26473 | .header("booleanInHeader", "NO")
|
25185 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26474 + | .body(::aws_smithy_http_server::body::boxed(
|
26475 + | ::http_body_util::Empty::new(),
|
26476 + | ))
|
25186 26477 | .unwrap();
|
25187 26478 | #[allow(unused_mut)]
|
25188 26479 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25189 26480 | let config = crate::service::RestJsonConfig::builder().build();
|
25190 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26481 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25191 26482 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
25192 26483 | let sender = sender.clone();
|
25193 26484 | async move {
|
25194 26485 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
25195 26486 | sender.send(()).await.expect("receiver dropped early");
|
25196 26487 | result
|
25197 26488 | }
|
25198 26489 | })
|
25199 26490 | .build_unchecked();
|
25200 26491 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25201 26492 | .await
|
25202 26493 | .expect("unable to make an HTTP request");
|
25203 26494 | ::pretty_assertions::assert_eq!(
|
25204 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26495 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25205 26496 | http_response.status()
|
25206 26497 | );
|
25207 26498 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25208 26499 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25209 26500 | http_response.headers(),
|
25210 26501 | expected_headers,
|
25211 26502 | ));
|
25212 26503 | }
|
25213 26504 | }
|
25214 26505 |
|
25215 26506 | /// Attempted string coercion should result in SerializationException
|
25216 26507 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case18
|
25217 26508 | #[::tokio::test]
|
25218 26509 | #[::tracing_test::traced_test]
|
25219 26510 | async fn rest_json_header_boolean_string_coercion_case18_malformed_request() {
|
25220 26511 | {
|
25221 26512 | #[allow(unused_mut)]
|
25222 - | let mut http_request = http::Request::builder()
|
26513 + | let mut http_request = ::http_1x::Request::builder()
|
25223 26514 | .uri("/MalformedBoolean/true")
|
25224 26515 | .method("POST")
|
25225 26516 | .header("booleanInHeader", "0")
|
25226 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26517 + | .body(::aws_smithy_http_server::body::boxed(
|
26518 + | ::http_body_util::Empty::new(),
|
26519 + | ))
|
25227 26520 | .unwrap();
|
25228 26521 | #[allow(unused_mut)]
|
25229 26522 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25230 26523 | let config = crate::service::RestJsonConfig::builder().build();
|
25231 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26524 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25232 26525 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
25233 26526 | let sender = sender.clone();
|
25234 26527 | async move {
|
25235 26528 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
25236 26529 | sender.send(()).await.expect("receiver dropped early");
|
25237 26530 | result
|
25238 26531 | }
|
25239 26532 | })
|
25240 26533 | .build_unchecked();
|
25241 26534 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25242 26535 | .await
|
25243 26536 | .expect("unable to make an HTTP request");
|
25244 26537 | ::pretty_assertions::assert_eq!(
|
25245 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26538 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25246 26539 | http_response.status()
|
25247 26540 | );
|
25248 26541 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25249 26542 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25250 26543 | http_response.headers(),
|
25251 26544 | expected_headers,
|
25252 26545 | ));
|
25253 26546 | }
|
25254 26547 | }
|
25255 26548 |
|
25256 26549 | /// Attempted string coercion should result in SerializationException
|
25257 26550 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case19
|
25258 26551 | #[::tokio::test]
|
25259 26552 | #[::tracing_test::traced_test]
|
25260 26553 | async fn rest_json_header_boolean_string_coercion_case19_malformed_request() {
|
25261 26554 | {
|
25262 26555 | #[allow(unused_mut)]
|
25263 - | let mut http_request = http::Request::builder()
|
26556 + | let mut http_request = ::http_1x::Request::builder()
|
25264 26557 | .uri("/MalformedBoolean/true")
|
25265 26558 | .method("POST")
|
25266 26559 | .header("booleanInHeader", "off")
|
25267 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26560 + | .body(::aws_smithy_http_server::body::boxed(
|
26561 + | ::http_body_util::Empty::new(),
|
26562 + | ))
|
25268 26563 | .unwrap();
|
25269 26564 | #[allow(unused_mut)]
|
25270 26565 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25271 26566 | let config = crate::service::RestJsonConfig::builder().build();
|
25272 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26567 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25273 26568 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
25274 26569 | let sender = sender.clone();
|
25275 26570 | async move {
|
25276 26571 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
25277 26572 | sender.send(()).await.expect("receiver dropped early");
|
25278 26573 | result
|
25279 26574 | }
|
25280 26575 | })
|
25281 26576 | .build_unchecked();
|
25282 26577 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25283 26578 | .await
|
25284 26579 | .expect("unable to make an HTTP request");
|
25285 26580 | ::pretty_assertions::assert_eq!(
|
25286 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26581 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25287 26582 | http_response.status()
|
25288 26583 | );
|
25289 26584 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25290 26585 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25291 26586 | http_response.headers(),
|
25292 26587 | expected_headers,
|
25293 26588 | ));
|
25294 26589 | }
|
25295 26590 | }
|
25296 26591 |
|
25297 26592 | /// Attempted string coercion should result in SerializationException
|
25298 26593 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case20
|
25299 26594 | #[::tokio::test]
|
25300 26595 | #[::tracing_test::traced_test]
|
25301 26596 | async fn rest_json_header_boolean_string_coercion_case20_malformed_request() {
|
25302 26597 | {
|
25303 26598 | #[allow(unused_mut)]
|
25304 - | let mut http_request = http::Request::builder()
|
26599 + | let mut http_request = ::http_1x::Request::builder()
|
25305 26600 | .uri("/MalformedBoolean/true")
|
25306 26601 | .method("POST")
|
25307 26602 | .header("booleanInHeader", "Off")
|
25308 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26603 + | .body(::aws_smithy_http_server::body::boxed(
|
26604 + | ::http_body_util::Empty::new(),
|
26605 + | ))
|
25309 26606 | .unwrap();
|
25310 26607 | #[allow(unused_mut)]
|
25311 26608 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25312 26609 | let config = crate::service::RestJsonConfig::builder().build();
|
25313 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26610 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25314 26611 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
25315 26612 | let sender = sender.clone();
|
25316 26613 | async move {
|
25317 26614 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
25318 26615 | sender.send(()).await.expect("receiver dropped early");
|
25319 26616 | result
|
25320 26617 | }
|
25321 26618 | })
|
25322 26619 | .build_unchecked();
|
25323 26620 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25324 26621 | .await
|
25325 26622 | .expect("unable to make an HTTP request");
|
25326 26623 | ::pretty_assertions::assert_eq!(
|
25327 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26624 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25328 26625 | http_response.status()
|
25329 26626 | );
|
25330 26627 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25331 26628 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25332 26629 | http_response.headers(),
|
25333 26630 | expected_headers,
|
25334 26631 | ));
|
25335 26632 | }
|
25336 26633 | }
|
25337 26634 |
|
25338 26635 | /// Attempted string coercion should result in SerializationException
|
25339 26636 | /// Test ID: RestJsonHeaderBooleanStringCoercion_case21
|
25340 26637 | #[::tokio::test]
|
25341 26638 | #[::tracing_test::traced_test]
|
25342 26639 | async fn rest_json_header_boolean_string_coercion_case21_malformed_request() {
|
25343 26640 | {
|
25344 26641 | #[allow(unused_mut)]
|
25345 - | let mut http_request = http::Request::builder()
|
26642 + | let mut http_request = ::http_1x::Request::builder()
|
25346 26643 | .uri("/MalformedBoolean/true")
|
25347 26644 | .method("POST")
|
25348 26645 | .header("booleanInHeader", "OFF")
|
25349 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26646 + | .body(::aws_smithy_http_server::body::boxed(
|
26647 + | ::http_body_util::Empty::new(),
|
26648 + | ))
|
25350 26649 | .unwrap();
|
25351 26650 | #[allow(unused_mut)]
|
25352 26651 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25353 26652 | let config = crate::service::RestJsonConfig::builder().build();
|
25354 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26653 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25355 26654 | .malformed_boolean(move |input: crate::input::MalformedBooleanInput| {
|
25356 26655 | let sender = sender.clone();
|
25357 26656 | async move {
|
25358 26657 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedBooleanOutput, crate::error::MalformedBooleanError> };
|
25359 26658 | sender.send(()).await.expect("receiver dropped early");
|
25360 26659 | result
|
25361 26660 | }
|
25362 26661 | })
|
25363 26662 | .build_unchecked();
|
25364 26663 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25365 26664 | .await
|
25366 26665 | .expect("unable to make an HTTP request");
|
25367 26666 | ::pretty_assertions::assert_eq!(
|
25368 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26667 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25369 26668 | http_response.status()
|
25370 26669 | );
|
25371 26670 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25372 26671 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25373 26672 | http_response.headers(),
|
25374 26673 | expected_headers,
|
25375 26674 | ));
|
25376 26675 | }
|
25377 26676 | }
|
26677 + |
|
26678 + | /* ProtocolTestGenerator.kt:98 */
|
25378 26679 | }
|
25379 26680 |
|
26681 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
25380 26682 | ::pin_project_lite::pin_project! {
|
25381 26683 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
25382 26684 | /// [`MalformedUnionInput`](crate::input::MalformedUnionInput) using modelled bindings.
|
25383 26685 | pub struct MalformedUnionInputFuture {
|
25384 26686 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedUnionInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
25385 26687 | }
|
25386 26688 | }
|
25387 26689 |
|
25388 26690 | impl std::future::Future for MalformedUnionInputFuture {
|
25389 26691 | type Output = Result<
|
25390 26692 | crate::input::MalformedUnionInput,
|
25391 26693 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
25392 26694 | >;
|
25393 26695 |
|
25394 26696 | fn poll(
|
25395 26697 | self: std::pin::Pin<&mut Self>,
|
25396 26698 | cx: &mut std::task::Context<'_>,
|
25397 26699 | ) -> std::task::Poll<Self::Output> {
|
25398 26700 | let this = self.project();
|
25399 26701 | this.inner.as_mut().poll(cx)
|
25400 26702 | }
|
25401 26703 | }
|
25402 26704 |
|
25403 26705 | impl<B>
|
25404 26706 | ::aws_smithy_http_server::request::FromRequest<
|
25405 26707 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
25406 26708 | B,
|
25407 26709 | > for crate::input::MalformedUnionInput
|
25408 26710 | where
|
25409 26711 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
25410 26712 | B: 'static,
|
25411 26713 |
|
25412 26714 | B::Data: Send,
|
25413 26715 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
25414 26716 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
25415 26717 | {
|
25416 26718 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
25417 26719 | type Future = MalformedUnionInputFuture;
|
25418 26720 |
|
25419 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
26721 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
25420 26722 | let fut = async move {
|
25421 26723 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
25422 26724 | request.headers(),
|
25423 26725 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
25424 26726 | ) {
|
25425 26727 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
25426 26728 | }
|
25427 26729 | crate::protocol_serde::shape_malformed_union::de_malformed_union_http_request(request)
|
25428 26730 | .await
|
25429 26731 | };
|
25430 26732 | use ::futures_util::future::TryFutureExt;
|
25431 26733 | let fut = fut.map_err(
|
25432 26734 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
25433 26735 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
25434 26736 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
25435 26737 | e,
|
25436 26738 | )
|
25437 26739 | },
|
25438 26740 | );
|
25439 26741 | MalformedUnionInputFuture {
|
25440 26742 | inner: Box::pin(fut),
|
25441 26743 | }
|
25442 26744 | }
|
25443 26745 | }
|
26746 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
25444 26747 | impl
|
25445 26748 | ::aws_smithy_http_server::response::IntoResponse<
|
25446 26749 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
25447 26750 | > for crate::output::MalformedUnionOutput
|
25448 26751 | {
|
25449 26752 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
25450 26753 | match crate::protocol_serde::shape_malformed_union::ser_malformed_union_http_response(self)
|
25451 26754 | {
|
25452 26755 | Ok(response) => response,
|
25453 26756 | Err(e) => {
|
25454 26757 | ::tracing::error!(error = %e, "failed to serialize response");
|
25455 26758 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
25456 26759 | }
|
25457 26760 | }
|
25458 26761 | }
|
25459 26762 | }
|
25460 26763 |
|
26764 + | /* RustType.kt:534 */
|
25461 26765 | #[allow(unreachable_code, unused_variables)]
|
26766 + | /* RustType.kt:534 */
|
25462 26767 | #[cfg(test)]
|
26768 + | /* ProtocolTestGenerator.kt:98 */
|
25463 26769 | mod malformed_union_test {
|
25464 26770 |
|
25465 26771 | /// When the union has multiple fields set, the response should be a 400
|
25466 26772 | /// SerializationException.
|
25467 26773 | /// Test ID: RestJsonMalformedUnionMultipleFieldsSet
|
25468 26774 | #[::tokio::test]
|
25469 26775 | #[::tracing_test::traced_test]
|
25470 26776 | async fn rest_json_malformed_union_multiple_fields_set_malformed_request() {
|
25471 26777 | {
|
25472 26778 | #[allow(unused_mut)]
|
25473 - | let mut http_request = http::Request::builder()
|
26779 + | let mut http_request = ::http_1x::Request::builder()
|
25474 26780 | .uri("/MalformedUnion")
|
25475 26781 | .method("POST")
|
25476 26782 | .header("content-type", "application/json")
|
25477 - | .body(::aws_smithy_http_server::body::Body::from(
|
25478 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
25479 - | "{ \"union\" : { \"int\": 2, \"string\": \"three\" } }".as_bytes(),
|
25480 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
26783 + | .body(::aws_smithy_http_server::body::boxed(
|
26784 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
26785 + | &::aws_smithy_protocol_test::decode_body_data(
|
26786 + | "{ \"union\" : { \"int\": 2, \"string\": \"three\" } }".as_bytes(),
|
26787 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
26788 + | ),
|
25481 26789 | )),
|
25482 26790 | ))
|
25483 26791 | .unwrap();
|
25484 26792 | #[allow(unused_mut)]
|
25485 26793 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25486 26794 | let config = crate::service::RestJsonConfig::builder().build();
|
25487 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26795 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25488 26796 | .malformed_union(move |input: crate::input::MalformedUnionInput| {
|
25489 26797 | let sender = sender.clone();
|
25490 26798 | async move {
|
25491 26799 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedUnionOutput };
|
25492 26800 | sender.send(()).await.expect("receiver dropped early");
|
25493 26801 | result
|
25494 26802 | }
|
25495 26803 | })
|
25496 26804 | .build_unchecked();
|
25497 26805 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25498 26806 | .await
|
25499 26807 | .expect("unable to make an HTTP request");
|
25500 26808 | ::pretty_assertions::assert_eq!(
|
25501 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26809 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25502 26810 | http_response.status()
|
25503 26811 | );
|
25504 26812 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25505 26813 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25506 26814 | http_response.headers(),
|
25507 26815 | expected_headers,
|
25508 26816 | ));
|
25509 26817 | }
|
25510 26818 | }
|
25511 26819 |
|
25512 26820 | /// When the union has multiple fields set, even when only one is modeled,
|
25513 26821 | /// the response should be a 400 SerializationException.
|
25514 26822 | /// Test ID: RestJsonMalformedUnionKnownAndUnknownFieldsSet
|
25515 26823 | #[::tokio::test]
|
25516 26824 | #[::tracing_test::traced_test]
|
25517 26825 | async fn rest_json_malformed_union_known_and_unknown_fields_set_malformed_request() {
|
25518 26826 | {
|
25519 26827 | #[allow(unused_mut)]
|
25520 - | let mut http_request = http::Request::builder()
|
26828 + | let mut http_request = ::http_1x::Request::builder()
|
25521 26829 | .uri("/MalformedUnion")
|
25522 26830 | .method("POST")
|
25523 26831 | .header("content-type", "application/json")
|
25524 - | .body(::aws_smithy_http_server::body::Body::from(
|
25525 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
25526 - | "{ \"union\" : { \"int\": 2, \"unknownField\": \"three\" } }".as_bytes(),
|
25527 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
26832 + | .body(::aws_smithy_http_server::body::boxed(
|
26833 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
26834 + | &::aws_smithy_protocol_test::decode_body_data(
|
26835 + | "{ \"union\" : { \"int\": 2, \"unknownField\": \"three\" } }"
|
26836 + | .as_bytes(),
|
26837 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
26838 + | ),
|
25528 26839 | )),
|
25529 26840 | ))
|
25530 26841 | .unwrap();
|
25531 26842 | #[allow(unused_mut)]
|
25532 26843 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25533 26844 | let config = crate::service::RestJsonConfig::builder().build();
|
25534 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26845 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25535 26846 | .malformed_union(move |input: crate::input::MalformedUnionInput| {
|
25536 26847 | let sender = sender.clone();
|
25537 26848 | async move {
|
25538 26849 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedUnionOutput };
|
25539 26850 | sender.send(()).await.expect("receiver dropped early");
|
25540 26851 | result
|
25541 26852 | }
|
25542 26853 | })
|
25543 26854 | .build_unchecked();
|
25544 26855 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25545 26856 | .await
|
25546 26857 | .expect("unable to make an HTTP request");
|
25547 26858 | ::pretty_assertions::assert_eq!(
|
25548 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26859 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25549 26860 | http_response.status()
|
25550 26861 | );
|
25551 26862 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25552 26863 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25553 26864 | http_response.headers(),
|
25554 26865 | expected_headers,
|
25555 26866 | ));
|
25556 26867 | }
|
25557 26868 | }
|
25558 26869 |
|
25559 26870 | /// When the union has no fields set, the response should be a 400
|
25560 26871 | /// SerializationException.
|
25561 26872 | /// Test ID: RestJsonMalformedUnionNoFieldsSet
|
25562 26873 | #[::tokio::test]
|
25563 26874 | #[::tracing_test::traced_test]
|
25564 26875 | async fn rest_json_malformed_union_no_fields_set_malformed_request() {
|
25565 26876 | {
|
25566 26877 | #[allow(unused_mut)]
|
25567 - | let mut http_request = http::Request::builder()
|
26878 + | let mut http_request = ::http_1x::Request::builder()
|
25568 26879 | .uri("/MalformedUnion")
|
25569 26880 | .method("POST")
|
25570 26881 | .header("content-type", "application/json")
|
25571 - | .body(::aws_smithy_http_server::body::Body::from(
|
25572 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
25573 - | "{ \"union\" : { \"int\": null } }".as_bytes(),
|
25574 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
26882 + | .body(::aws_smithy_http_server::body::boxed(
|
26883 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
26884 + | &::aws_smithy_protocol_test::decode_body_data(
|
26885 + | "{ \"union\" : { \"int\": null } }".as_bytes(),
|
26886 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
26887 + | ),
|
25575 26888 | )),
|
25576 26889 | ))
|
25577 26890 | .unwrap();
|
25578 26891 | #[allow(unused_mut)]
|
25579 26892 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25580 26893 | let config = crate::service::RestJsonConfig::builder().build();
|
25581 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26894 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25582 26895 | .malformed_union(move |input: crate::input::MalformedUnionInput| {
|
25583 26896 | let sender = sender.clone();
|
25584 26897 | async move {
|
25585 26898 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedUnionOutput };
|
25586 26899 | sender.send(()).await.expect("receiver dropped early");
|
25587 26900 | result
|
25588 26901 | }
|
25589 26902 | })
|
25590 26903 | .build_unchecked();
|
25591 26904 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25592 26905 | .await
|
25593 26906 | .expect("unable to make an HTTP request");
|
25594 26907 | ::pretty_assertions::assert_eq!(
|
25595 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26908 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25596 26909 | http_response.status()
|
25597 26910 | );
|
25598 26911 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25599 26912 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25600 26913 | http_response.headers(),
|
25601 26914 | expected_headers,
|
25602 26915 | ));
|
25603 26916 | }
|
25604 26917 | }
|
25605 26918 |
|
25606 26919 | /// When the union is an empty object, it has no fields set, so the
|
25607 26920 | /// response should be a 400 SerializationException.
|
25608 26921 | /// Test ID: RestJsonMalformedUnionEmptyObjectNoFieldsSet
|
25609 26922 | #[::tokio::test]
|
25610 26923 | #[::tracing_test::traced_test]
|
25611 26924 | async fn rest_json_malformed_union_empty_object_no_fields_set_malformed_request() {
|
25612 26925 | {
|
25613 26926 | #[allow(unused_mut)]
|
25614 - | let mut http_request = http::Request::builder()
|
26927 + | let mut http_request = ::http_1x::Request::builder()
|
25615 26928 | .uri("/MalformedUnion")
|
25616 26929 | .method("POST")
|
25617 26930 | .header("content-type", "application/json")
|
25618 - | .body(::aws_smithy_http_server::body::Body::from(
|
25619 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
25620 - | "{ \"union\" : { } }".as_bytes(),
|
25621 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
26931 + | .body(::aws_smithy_http_server::body::boxed(
|
26932 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
26933 + | &::aws_smithy_protocol_test::decode_body_data(
|
26934 + | "{ \"union\" : { } }".as_bytes(),
|
26935 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
26936 + | ),
|
25622 26937 | )),
|
25623 26938 | ))
|
25624 26939 | .unwrap();
|
25625 26940 | #[allow(unused_mut)]
|
25626 26941 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25627 26942 | let config = crate::service::RestJsonConfig::builder().build();
|
25628 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26943 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25629 26944 | .malformed_union(move |input: crate::input::MalformedUnionInput| {
|
25630 26945 | let sender = sender.clone();
|
25631 26946 | async move {
|
25632 26947 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedUnionOutput };
|
25633 26948 | sender.send(()).await.expect("receiver dropped early");
|
25634 26949 | result
|
25635 26950 | }
|
25636 26951 | })
|
25637 26952 | .build_unchecked();
|
25638 26953 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25639 26954 | .await
|
25640 26955 | .expect("unable to make an HTTP request");
|
25641 26956 | ::pretty_assertions::assert_eq!(
|
25642 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26957 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25643 26958 | http_response.status()
|
25644 26959 | );
|
25645 26960 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25646 26961 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25647 26962 | http_response.headers(),
|
25648 26963 | expected_headers,
|
25649 26964 | ));
|
25650 26965 | }
|
25651 26966 | }
|
25652 26967 |
|
25653 26968 | /// When the union value is actually an array, the response should be a 400
|
25654 26969 | /// SerializationException.
|
25655 26970 | /// Test ID: RestJsonMalformedUnionValueIsArray
|
25656 26971 | #[::tokio::test]
|
25657 26972 | #[::tracing_test::traced_test]
|
25658 26973 | async fn rest_json_malformed_union_value_is_array_malformed_request() {
|
25659 26974 | {
|
25660 26975 | #[allow(unused_mut)]
|
25661 - | let mut http_request = http::Request::builder()
|
26976 + | let mut http_request = ::http_1x::Request::builder()
|
25662 26977 | .uri("/MalformedUnion")
|
25663 26978 | .method("POST")
|
25664 26979 | .header("content-type", "application/json")
|
25665 - | .body(::aws_smithy_http_server::body::Body::from(
|
25666 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
25667 - | "{ \"union\" : [\"int\"] }".as_bytes(),
|
25668 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
26980 + | .body(::aws_smithy_http_server::body::boxed(
|
26981 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
26982 + | &::aws_smithy_protocol_test::decode_body_data(
|
26983 + | "{ \"union\" : [\"int\"] }".as_bytes(),
|
26984 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
26985 + | ),
|
25669 26986 | )),
|
25670 26987 | ))
|
25671 26988 | .unwrap();
|
25672 26989 | #[allow(unused_mut)]
|
25673 26990 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25674 26991 | let config = crate::service::RestJsonConfig::builder().build();
|
25675 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26992 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25676 26993 | .malformed_union(move |input: crate::input::MalformedUnionInput| {
|
25677 26994 | let sender = sender.clone();
|
25678 26995 | async move {
|
25679 26996 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedUnionOutput };
|
25680 26997 | sender.send(()).await.expect("receiver dropped early");
|
25681 26998 | result
|
25682 26999 | }
|
25683 27000 | })
|
25684 27001 | .build_unchecked();
|
25685 27002 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25686 27003 | .await
|
25687 27004 | .expect("unable to make an HTTP request");
|
25688 27005 | ::pretty_assertions::assert_eq!(
|
25689 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27006 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25690 27007 | http_response.status()
|
25691 27008 | );
|
25692 27009 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25693 27010 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25694 27011 | http_response.headers(),
|
25695 27012 | expected_headers,
|
25696 27013 | ));
|
25697 27014 | }
|
25698 27015 | }
|
25699 27016 |
|
25700 27017 | /// When an unknown union member is received, the response should be a 400
|
25701 27018 | /// SerializationException.
|
25702 27019 | /// Test ID: RestJsonMalformedUnionUnknownMember
|
25703 27020 | #[::tokio::test]
|
25704 27021 | #[::tracing_test::traced_test]
|
25705 27022 | async fn rest_json_malformed_union_unknown_member_malformed_request() {
|
25706 27023 | {
|
25707 27024 | #[allow(unused_mut)]
|
25708 - | let mut http_request = http::Request::builder()
|
27025 + | let mut http_request = ::http_1x::Request::builder()
|
25709 27026 | .uri("/MalformedUnion")
|
25710 27027 | .method("POST")
|
25711 27028 | .header("content-type", "application/json")
|
25712 - | .body(::aws_smithy_http_server::body::Body::from(
|
25713 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
25714 - | "{\n \"union\": {\n \"unknown\": \"hello\"\n }\n}".as_bytes(),
|
25715 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27029 + | .body(::aws_smithy_http_server::body::boxed(
|
27030 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
27031 + | &::aws_smithy_protocol_test::decode_body_data(
|
27032 + | "{\n \"union\": {\n \"unknown\": \"hello\"\n }\n}"
|
27033 + | .as_bytes(),
|
27034 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27035 + | ),
|
25716 27036 | )),
|
25717 27037 | ))
|
25718 27038 | .unwrap();
|
25719 27039 | #[allow(unused_mut)]
|
25720 27040 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25721 27041 | let config = crate::service::RestJsonConfig::builder().build();
|
25722 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27042 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25723 27043 | .malformed_union(move |input: crate::input::MalformedUnionInput| {
|
25724 27044 | let sender = sender.clone();
|
25725 27045 | async move {
|
25726 27046 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedUnionOutput };
|
25727 27047 | sender.send(()).await.expect("receiver dropped early");
|
25728 27048 | result
|
25729 27049 | }
|
25730 27050 | })
|
25731 27051 | .build_unchecked();
|
25732 27052 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25733 27053 | .await
|
25734 27054 | .expect("unable to make an HTTP request");
|
25735 27055 | ::pretty_assertions::assert_eq!(
|
25736 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27056 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25737 27057 | http_response.status()
|
25738 27058 | );
|
25739 27059 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25740 27060 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25741 27061 | http_response.headers(),
|
25742 27062 | expected_headers,
|
25743 27063 | ));
|
25744 27064 | }
|
25745 27065 | }
|
27066 + |
|
27067 + | /* ProtocolTestGenerator.kt:98 */
|
25746 27068 | }
|
25747 27069 |
|
27070 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
25748 27071 | ::pin_project_lite::pin_project! {
|
25749 27072 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
25750 27073 | /// [`MalformedIntegerInput`](crate::input::MalformedIntegerInput) using modelled bindings.
|
25751 27074 | pub struct MalformedIntegerInputFuture {
|
25752 27075 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedIntegerInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
25753 27076 | }
|
25754 27077 | }
|
25755 27078 |
|
25756 27079 | impl std::future::Future for MalformedIntegerInputFuture {
|
25757 27080 | type Output = Result<
|
25758 27081 | crate::input::MalformedIntegerInput,
|
25759 27082 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
25760 27083 | >;
|
25761 27084 |
|
25762 27085 | fn poll(
|
25763 27086 | self: std::pin::Pin<&mut Self>,
|
25764 27087 | cx: &mut std::task::Context<'_>,
|
25765 27088 | ) -> std::task::Poll<Self::Output> {
|
25766 27089 | let this = self.project();
|
25767 27090 | this.inner.as_mut().poll(cx)
|
25768 27091 | }
|
25769 27092 | }
|
25770 27093 |
|
25771 27094 | impl<B>
|
25772 27095 | ::aws_smithy_http_server::request::FromRequest<
|
25773 27096 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
25774 27097 | B,
|
25775 27098 | > for crate::input::MalformedIntegerInput
|
25776 27099 | where
|
25777 27100 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
25778 27101 | B: 'static,
|
25779 27102 |
|
25780 27103 | B::Data: Send,
|
25781 27104 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
25782 27105 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
25783 27106 | {
|
25784 27107 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
25785 27108 | type Future = MalformedIntegerInputFuture;
|
25786 27109 |
|
25787 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
27110 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
25788 27111 | let fut = async move {
|
25789 27112 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
25790 27113 | request.headers(),
|
25791 27114 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
25792 27115 | ) {
|
25793 27116 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
25794 27117 | }
|
25795 27118 | crate::protocol_serde::shape_malformed_integer::de_malformed_integer_http_request(
|
25796 27119 | request,
|
25797 27120 | )
|
25798 27121 | .await
|
25799 27122 | };
|
25800 27123 | use ::futures_util::future::TryFutureExt;
|
25801 27124 | let fut = fut.map_err(
|
25802 27125 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
25803 27126 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
25804 27127 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
25805 27128 | e,
|
25806 27129 | )
|
25807 27130 | },
|
25808 27131 | );
|
25809 27132 | MalformedIntegerInputFuture {
|
25810 27133 | inner: Box::pin(fut),
|
25811 27134 | }
|
25812 27135 | }
|
25813 27136 | }
|
27137 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
25814 27138 | impl
|
25815 27139 | ::aws_smithy_http_server::response::IntoResponse<
|
25816 27140 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
25817 27141 | > for crate::output::MalformedIntegerOutput
|
25818 27142 | {
|
25819 27143 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
25820 27144 | match crate::protocol_serde::shape_malformed_integer::ser_malformed_integer_http_response(
|
25821 27145 | self,
|
25822 27146 | ) {
|
25823 27147 | Ok(response) => response,
|
25824 27148 | Err(e) => {
|
25825 27149 | ::tracing::error!(error = %e, "failed to serialize response");
|
25826 27150 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
25827 27151 | }
|
25828 27152 | }
|
25829 27153 | }
|
25830 27154 | }
|
27155 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
25831 27156 | impl
|
25832 27157 | ::aws_smithy_http_server::response::IntoResponse<
|
25833 27158 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
25834 27159 | > for crate::error::MalformedIntegerError
|
25835 27160 | {
|
25836 27161 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
25837 27162 | match crate::protocol_serde::shape_malformed_integer::ser_malformed_integer_http_error(
|
25838 27163 | &self,
|
25839 27164 | ) {
|
25840 27165 | Ok(mut response) => {
|
25841 27166 | response.extensions_mut().insert(
|
25842 27167 | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
25843 27168 | );
|
25844 27169 | response
|
25845 27170 | }
|
25846 27171 | Err(e) => {
|
25847 27172 | ::tracing::error!(error = %e, "failed to serialize response");
|
25848 27173 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
25849 27174 | }
|
25850 27175 | }
|
25851 27176 | }
|
25852 27177 | }
|
25853 27178 |
|
27179 + | /* RustType.kt:534 */
|
25854 27180 | #[allow(unreachable_code, unused_variables)]
|
27181 + | /* RustType.kt:534 */
|
25855 27182 | #[cfg(test)]
|
27183 + | /* ProtocolTestGenerator.kt:98 */
|
25856 27184 | mod malformed_integer_test {
|
25857 27185 |
|
25858 27186 | /// Underflow or overflow should result in SerializationException
|
25859 27187 | /// Test ID: RestJsonBodyIntegerUnderflowOverflow_case0
|
25860 27188 | #[::tokio::test]
|
25861 27189 | #[::tracing_test::traced_test]
|
25862 27190 | async fn rest_json_body_integer_underflow_overflow_case0_malformed_request() {
|
25863 27191 | {
|
25864 27192 | #[allow(unused_mut)]
|
25865 - | let mut http_request = http::Request::builder()
|
27193 + | let mut http_request = ::http_1x::Request::builder()
|
25866 27194 | .uri("/MalformedInteger/1")
|
25867 27195 | .method("POST")
|
25868 27196 | .header("content-type", "application/json")
|
25869 - | .body(::aws_smithy_http_server::body::Body::from(
|
25870 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
25871 - | "{ \"integerInBody\" : -9223372000000000000 }".as_bytes(),
|
25872 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27197 + | .body(::aws_smithy_http_server::body::boxed(
|
27198 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
27199 + | &::aws_smithy_protocol_test::decode_body_data(
|
27200 + | "{ \"integerInBody\" : -9223372000000000000 }".as_bytes(),
|
27201 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27202 + | ),
|
25873 27203 | )),
|
25874 27204 | ))
|
25875 27205 | .unwrap();
|
25876 27206 | #[allow(unused_mut)]
|
25877 27207 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25878 27208 | let config = crate::service::RestJsonConfig::builder().build();
|
25879 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27209 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25880 27210 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
25881 27211 | let sender = sender.clone();
|
25882 27212 | async move {
|
25883 27213 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
25884 27214 | sender.send(()).await.expect("receiver dropped early");
|
25885 27215 | result
|
25886 27216 | }
|
25887 27217 | })
|
25888 27218 | .build_unchecked();
|
25889 27219 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25890 27220 | .await
|
25891 27221 | .expect("unable to make an HTTP request");
|
25892 27222 | ::pretty_assertions::assert_eq!(
|
25893 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27223 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25894 27224 | http_response.status()
|
25895 27225 | );
|
25896 27226 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25897 27227 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25898 27228 | http_response.headers(),
|
25899 27229 | expected_headers,
|
25900 27230 | ));
|
25901 27231 | }
|
25902 27232 | }
|
25903 27233 |
|
25904 27234 | /// Underflow or overflow should result in SerializationException
|
25905 27235 | /// Test ID: RestJsonBodyIntegerUnderflowOverflow_case1
|
25906 27236 | #[::tokio::test]
|
25907 27237 | #[::tracing_test::traced_test]
|
25908 27238 | async fn rest_json_body_integer_underflow_overflow_case1_malformed_request() {
|
25909 27239 | {
|
25910 27240 | #[allow(unused_mut)]
|
25911 - | let mut http_request = http::Request::builder()
|
27241 + | let mut http_request = ::http_1x::Request::builder()
|
25912 27242 | .uri("/MalformedInteger/1")
|
25913 27243 | .method("POST")
|
25914 27244 | .header("content-type", "application/json")
|
25915 - | .body(::aws_smithy_http_server::body::Body::from(
|
25916 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
25917 - | "{ \"integerInBody\" : 9223372000000000000 }".as_bytes(),
|
25918 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27245 + | .body(::aws_smithy_http_server::body::boxed(
|
27246 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
27247 + | &::aws_smithy_protocol_test::decode_body_data(
|
27248 + | "{ \"integerInBody\" : 9223372000000000000 }".as_bytes(),
|
27249 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27250 + | ),
|
25919 27251 | )),
|
25920 27252 | ))
|
25921 27253 | .unwrap();
|
25922 27254 | #[allow(unused_mut)]
|
25923 27255 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25924 27256 | let config = crate::service::RestJsonConfig::builder().build();
|
25925 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27257 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25926 27258 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
25927 27259 | let sender = sender.clone();
|
25928 27260 | async move {
|
25929 27261 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
25930 27262 | sender.send(()).await.expect("receiver dropped early");
|
25931 27263 | result
|
25932 27264 | }
|
25933 27265 | })
|
25934 27266 | .build_unchecked();
|
25935 27267 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25936 27268 | .await
|
25937 27269 | .expect("unable to make an HTTP request");
|
25938 27270 | ::pretty_assertions::assert_eq!(
|
25939 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27271 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25940 27272 | http_response.status()
|
25941 27273 | );
|
25942 27274 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25943 27275 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25944 27276 | http_response.headers(),
|
25945 27277 | expected_headers,
|
25946 27278 | ));
|
25947 27279 | }
|
25948 27280 | }
|
25949 27281 |
|
25950 27282 | /// Underflow or overflow should result in SerializationException
|
25951 27283 | /// Test ID: RestJsonBodyIntegerUnderflowOverflow_case2
|
25952 27284 | #[::tokio::test]
|
25953 27285 | #[::tracing_test::traced_test]
|
25954 27286 | async fn rest_json_body_integer_underflow_overflow_case2_malformed_request() {
|
25955 27287 | {
|
25956 27288 | #[allow(unused_mut)]
|
25957 - | let mut http_request = http::Request::builder()
|
27289 + | let mut http_request = ::http_1x::Request::builder()
|
25958 27290 | .uri("/MalformedInteger/1")
|
25959 27291 | .method("POST")
|
25960 27292 | .header("content-type", "application/json")
|
25961 - | .body(::aws_smithy_http_server::body::Body::from(
|
25962 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
25963 - | "{ \"integerInBody\" : 123000000000000000000000 }".as_bytes(),
|
25964 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27293 + | .body(::aws_smithy_http_server::body::boxed(
|
27294 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
27295 + | &::aws_smithy_protocol_test::decode_body_data(
|
27296 + | "{ \"integerInBody\" : 123000000000000000000000 }".as_bytes(),
|
27297 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27298 + | ),
|
25965 27299 | )),
|
25966 27300 | ))
|
25967 27301 | .unwrap();
|
25968 27302 | #[allow(unused_mut)]
|
25969 27303 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
25970 27304 | let config = crate::service::RestJsonConfig::builder().build();
|
25971 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27305 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
25972 27306 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
25973 27307 | let sender = sender.clone();
|
25974 27308 | async move {
|
25975 27309 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
25976 27310 | sender.send(()).await.expect("receiver dropped early");
|
25977 27311 | result
|
25978 27312 | }
|
25979 27313 | })
|
25980 27314 | .build_unchecked();
|
25981 27315 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
25982 27316 | .await
|
25983 27317 | .expect("unable to make an HTTP request");
|
25984 27318 | ::pretty_assertions::assert_eq!(
|
25985 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27319 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
25986 27320 | http_response.status()
|
25987 27321 | );
|
25988 27322 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
25989 27323 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
25990 27324 | http_response.headers(),
|
25991 27325 | expected_headers,
|
25992 27326 | ));
|
25993 27327 | }
|
25994 27328 | }
|
25995 27329 |
|
25996 27330 | /// Underflow or overflow should result in SerializationException
|
25997 27331 | /// Test ID: RestJsonPathIntegerUnderflowOverflow_case0
|
25998 27332 | #[::tokio::test]
|
25999 27333 | #[::tracing_test::traced_test]
|
26000 27334 | async fn rest_json_path_integer_underflow_overflow_case0_malformed_request() {
|
26001 27335 | {
|
26002 27336 | #[allow(unused_mut)]
|
26003 - | let mut http_request = http::Request::builder()
|
27337 + | let mut http_request = ::http_1x::Request::builder()
|
26004 27338 | .uri("/MalformedInteger/-9223372000000000000")
|
26005 27339 | .method("POST")
|
26006 - | .body(::aws_smithy_http_server::body::Body::empty())
|
27340 + | .body(::aws_smithy_http_server::body::boxed(
|
27341 + | ::http_body_util::Empty::new(),
|
27342 + | ))
|
26007 27343 | .unwrap();
|
26008 27344 | #[allow(unused_mut)]
|
26009 27345 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26010 27346 | let config = crate::service::RestJsonConfig::builder().build();
|
26011 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27347 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26012 27348 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26013 27349 | let sender = sender.clone();
|
26014 27350 | async move {
|
26015 27351 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26016 27352 | sender.send(()).await.expect("receiver dropped early");
|
26017 27353 | result
|
26018 27354 | }
|
26019 27355 | })
|
26020 27356 | .build_unchecked();
|
26021 27357 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26022 27358 | .await
|
26023 27359 | .expect("unable to make an HTTP request");
|
26024 27360 | ::pretty_assertions::assert_eq!(
|
26025 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27361 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26026 27362 | http_response.status()
|
26027 27363 | );
|
26028 27364 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26029 27365 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26030 27366 | http_response.headers(),
|
26031 27367 | expected_headers,
|
26032 27368 | ));
|
26033 27369 | }
|
26034 27370 | }
|
26035 27371 |
|
26036 27372 | /// Underflow or overflow should result in SerializationException
|
26037 27373 | /// Test ID: RestJsonPathIntegerUnderflowOverflow_case1
|
26038 27374 | #[::tokio::test]
|
26039 27375 | #[::tracing_test::traced_test]
|
26040 27376 | async fn rest_json_path_integer_underflow_overflow_case1_malformed_request() {
|
26041 27377 | {
|
26042 27378 | #[allow(unused_mut)]
|
26043 - | let mut http_request = http::Request::builder()
|
27379 + | let mut http_request = ::http_1x::Request::builder()
|
26044 27380 | .uri("/MalformedInteger/9223372000000000000")
|
26045 27381 | .method("POST")
|
26046 - | .body(::aws_smithy_http_server::body::Body::empty())
|
27382 + | .body(::aws_smithy_http_server::body::boxed(
|
27383 + | ::http_body_util::Empty::new(),
|
27384 + | ))
|
26047 27385 | .unwrap();
|
26048 27386 | #[allow(unused_mut)]
|
26049 27387 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26050 27388 | let config = crate::service::RestJsonConfig::builder().build();
|
26051 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27389 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26052 27390 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26053 27391 | let sender = sender.clone();
|
26054 27392 | async move {
|
26055 27393 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26056 27394 | sender.send(()).await.expect("receiver dropped early");
|
26057 27395 | result
|
26058 27396 | }
|
26059 27397 | })
|
26060 27398 | .build_unchecked();
|
26061 27399 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26062 27400 | .await
|
26063 27401 | .expect("unable to make an HTTP request");
|
26064 27402 | ::pretty_assertions::assert_eq!(
|
26065 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27403 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26066 27404 | http_response.status()
|
26067 27405 | );
|
26068 27406 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26069 27407 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26070 27408 | http_response.headers(),
|
26071 27409 | expected_headers,
|
26072 27410 | ));
|
26073 27411 | }
|
26074 27412 | }
|
26075 27413 |
|
26076 27414 | /// Underflow or overflow should result in SerializationException
|
26077 27415 | /// Test ID: RestJsonPathIntegerUnderflowOverflow_case2
|
26078 27416 | #[::tokio::test]
|
26079 27417 | #[::tracing_test::traced_test]
|
26080 27418 | async fn rest_json_path_integer_underflow_overflow_case2_malformed_request() {
|
26081 27419 | {
|
26082 27420 | #[allow(unused_mut)]
|
26083 - | let mut http_request = http::Request::builder()
|
27421 + | let mut http_request = ::http_1x::Request::builder()
|
26084 27422 | .uri("/MalformedInteger/123000000000000000000000")
|
26085 27423 | .method("POST")
|
26086 - | .body(::aws_smithy_http_server::body::Body::empty())
|
27424 + | .body(::aws_smithy_http_server::body::boxed(
|
27425 + | ::http_body_util::Empty::new(),
|
27426 + | ))
|
26087 27427 | .unwrap();
|
26088 27428 | #[allow(unused_mut)]
|
26089 27429 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26090 27430 | let config = crate::service::RestJsonConfig::builder().build();
|
26091 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27431 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26092 27432 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26093 27433 | let sender = sender.clone();
|
26094 27434 | async move {
|
26095 27435 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26096 27436 | sender.send(()).await.expect("receiver dropped early");
|
26097 27437 | result
|
26098 27438 | }
|
26099 27439 | })
|
26100 27440 | .build_unchecked();
|
26101 27441 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26102 27442 | .await
|
26103 27443 | .expect("unable to make an HTTP request");
|
26104 27444 | ::pretty_assertions::assert_eq!(
|
26105 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27445 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26106 27446 | http_response.status()
|
26107 27447 | );
|
26108 27448 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26109 27449 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26110 27450 | http_response.headers(),
|
26111 27451 | expected_headers,
|
26112 27452 | ));
|
26113 27453 | }
|
26114 27454 | }
|
26115 27455 |
|
26116 27456 | /// Underflow or overflow should result in SerializationException
|
26117 27457 | /// Test ID: RestJsonQueryIntegerUnderflowOverflow_case0
|
26118 27458 | #[::tokio::test]
|
26119 27459 | #[::tracing_test::traced_test]
|
26120 27460 | async fn rest_json_query_integer_underflow_overflow_case0_malformed_request() {
|
26121 27461 | {
|
26122 27462 | #[allow(unused_mut)]
|
26123 - | let mut http_request = http::Request::builder()
|
27463 + | let mut http_request = ::http_1x::Request::builder()
|
26124 27464 | .uri("/MalformedInteger/1")
|
26125 27465 | .method("POST")
|
26126 - | .body(::aws_smithy_http_server::body::Body::empty())
|
27466 + | .body(::aws_smithy_http_server::body::boxed(
|
27467 + | ::http_body_util::Empty::new(),
|
27468 + | ))
|
26127 27469 | .unwrap();
|
26128 27470 | *http_request.uri_mut() = "/MalformedInteger/1?integerInQuery=-9223372000000000000"
|
26129 27471 | .parse()
|
26130 27472 | .unwrap();
|
26131 27473 | #[allow(unused_mut)]
|
26132 27474 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26133 27475 | let config = crate::service::RestJsonConfig::builder().build();
|
26134 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27476 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26135 27477 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26136 27478 | let sender = sender.clone();
|
26137 27479 | async move {
|
26138 27480 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26139 27481 | sender.send(()).await.expect("receiver dropped early");
|
26140 27482 | result
|
26141 27483 | }
|
26142 27484 | })
|
26143 27485 | .build_unchecked();
|
26144 27486 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26145 27487 | .await
|
26146 27488 | .expect("unable to make an HTTP request");
|
26147 27489 | ::pretty_assertions::assert_eq!(
|
26148 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27490 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26149 27491 | http_response.status()
|
26150 27492 | );
|
26151 27493 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26152 27494 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26153 27495 | http_response.headers(),
|
26154 27496 | expected_headers,
|
26155 27497 | ));
|
26156 27498 | }
|
26157 27499 | }
|
26158 27500 |
|
26159 27501 | /// Underflow or overflow should result in SerializationException
|
26160 27502 | /// Test ID: RestJsonQueryIntegerUnderflowOverflow_case1
|
26161 27503 | #[::tokio::test]
|
26162 27504 | #[::tracing_test::traced_test]
|
26163 27505 | async fn rest_json_query_integer_underflow_overflow_case1_malformed_request() {
|
26164 27506 | {
|
26165 27507 | #[allow(unused_mut)]
|
26166 - | let mut http_request = http::Request::builder()
|
27508 + | let mut http_request = ::http_1x::Request::builder()
|
26167 27509 | .uri("/MalformedInteger/1")
|
26168 27510 | .method("POST")
|
26169 - | .body(::aws_smithy_http_server::body::Body::empty())
|
27511 + | .body(::aws_smithy_http_server::body::boxed(
|
27512 + | ::http_body_util::Empty::new(),
|
27513 + | ))
|
26170 27514 | .unwrap();
|
26171 27515 | *http_request.uri_mut() = "/MalformedInteger/1?integerInQuery=9223372000000000000"
|
26172 27516 | .parse()
|
26173 27517 | .unwrap();
|
26174 27518 | #[allow(unused_mut)]
|
26175 27519 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26176 27520 | let config = crate::service::RestJsonConfig::builder().build();
|
26177 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27521 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26178 27522 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26179 27523 | let sender = sender.clone();
|
26180 27524 | async move {
|
26181 27525 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26182 27526 | sender.send(()).await.expect("receiver dropped early");
|
26183 27527 | result
|
26184 27528 | }
|
26185 27529 | })
|
26186 27530 | .build_unchecked();
|
26187 27531 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26188 27532 | .await
|
26189 27533 | .expect("unable to make an HTTP request");
|
26190 27534 | ::pretty_assertions::assert_eq!(
|
26191 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27535 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26192 27536 | http_response.status()
|
26193 27537 | );
|
26194 27538 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26195 27539 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26196 27540 | http_response.headers(),
|
26197 27541 | expected_headers,
|
26198 27542 | ));
|
26199 27543 | }
|
26200 27544 | }
|
26201 27545 |
|
26202 27546 | /// Underflow or overflow should result in SerializationException
|
26203 27547 | /// Test ID: RestJsonQueryIntegerUnderflowOverflow_case2
|
26204 27548 | #[::tokio::test]
|
26205 27549 | #[::tracing_test::traced_test]
|
26206 27550 | async fn rest_json_query_integer_underflow_overflow_case2_malformed_request() {
|
26207 27551 | {
|
26208 27552 | #[allow(unused_mut)]
|
26209 - | let mut http_request = http::Request::builder()
|
27553 + | let mut http_request = ::http_1x::Request::builder()
|
26210 27554 | .uri("/MalformedInteger/1")
|
26211 27555 | .method("POST")
|
26212 - | .body(::aws_smithy_http_server::body::Body::empty())
|
27556 + | .body(::aws_smithy_http_server::body::boxed(
|
27557 + | ::http_body_util::Empty::new(),
|
27558 + | ))
|
26213 27559 | .unwrap();
|
26214 27560 | *http_request.uri_mut() = "/MalformedInteger/1?integerInQuery=123000000000000000000000"
|
26215 27561 | .parse()
|
26216 27562 | .unwrap();
|
26217 27563 | #[allow(unused_mut)]
|
26218 27564 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26219 27565 | let config = crate::service::RestJsonConfig::builder().build();
|
26220 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27566 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26221 27567 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26222 27568 | let sender = sender.clone();
|
26223 27569 | async move {
|
26224 27570 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26225 27571 | sender.send(()).await.expect("receiver dropped early");
|
26226 27572 | result
|
26227 27573 | }
|
26228 27574 | })
|
26229 27575 | .build_unchecked();
|
26230 27576 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26231 27577 | .await
|
26232 27578 | .expect("unable to make an HTTP request");
|
26233 27579 | ::pretty_assertions::assert_eq!(
|
26234 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27580 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26235 27581 | http_response.status()
|
26236 27582 | );
|
26237 27583 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26238 27584 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26239 27585 | http_response.headers(),
|
26240 27586 | expected_headers,
|
26241 27587 | ));
|
26242 27588 | }
|
26243 27589 | }
|
26244 27590 |
|
26245 27591 | /// Underflow or overflow should result in SerializationException
|
26246 27592 | /// Test ID: RestJsonHeaderIntegerUnderflowOverflow_case0
|
26247 27593 | #[::tokio::test]
|
26248 27594 | #[::tracing_test::traced_test]
|
26249 27595 | async fn rest_json_header_integer_underflow_overflow_case0_malformed_request() {
|
26250 27596 | {
|
26251 27597 | #[allow(unused_mut)]
|
26252 - | let mut http_request = http::Request::builder()
|
27598 + | let mut http_request = ::http_1x::Request::builder()
|
26253 27599 | .uri("/MalformedInteger/1")
|
26254 27600 | .method("POST")
|
26255 27601 | .header("integerInHeader", "-9223372000000000000")
|
26256 - | .body(::aws_smithy_http_server::body::Body::empty())
|
27602 + | .body(::aws_smithy_http_server::body::boxed(
|
27603 + | ::http_body_util::Empty::new(),
|
27604 + | ))
|
26257 27605 | .unwrap();
|
26258 27606 | #[allow(unused_mut)]
|
26259 27607 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26260 27608 | let config = crate::service::RestJsonConfig::builder().build();
|
26261 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27609 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26262 27610 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26263 27611 | let sender = sender.clone();
|
26264 27612 | async move {
|
26265 27613 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26266 27614 | sender.send(()).await.expect("receiver dropped early");
|
26267 27615 | result
|
26268 27616 | }
|
26269 27617 | })
|
26270 27618 | .build_unchecked();
|
26271 27619 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26272 27620 | .await
|
26273 27621 | .expect("unable to make an HTTP request");
|
26274 27622 | ::pretty_assertions::assert_eq!(
|
26275 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27623 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26276 27624 | http_response.status()
|
26277 27625 | );
|
26278 27626 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26279 27627 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26280 27628 | http_response.headers(),
|
26281 27629 | expected_headers,
|
26282 27630 | ));
|
26283 27631 | }
|
26284 27632 | }
|
26285 27633 |
|
26286 27634 | /// Underflow or overflow should result in SerializationException
|
26287 27635 | /// Test ID: RestJsonHeaderIntegerUnderflowOverflow_case1
|
26288 27636 | #[::tokio::test]
|
26289 27637 | #[::tracing_test::traced_test]
|
26290 27638 | async fn rest_json_header_integer_underflow_overflow_case1_malformed_request() {
|
26291 27639 | {
|
26292 27640 | #[allow(unused_mut)]
|
26293 - | let mut http_request = http::Request::builder()
|
27641 + | let mut http_request = ::http_1x::Request::builder()
|
26294 27642 | .uri("/MalformedInteger/1")
|
26295 27643 | .method("POST")
|
26296 27644 | .header("integerInHeader", "9223372000000000000")
|
26297 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26298 - | .unwrap();
|
26299 - | #[allow(unused_mut)]
|
26300 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26301 - | let config = crate::service::RestJsonConfig::builder().build();
|
26302 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26303 - | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26304 - | let sender = sender.clone();
|
26305 - | async move {
|
26306 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26307 - | sender.send(()).await.expect("receiver dropped early");
|
26308 - | result
|
26309 - | }
|
26310 - | })
|
26311 - | .build_unchecked();
|
26312 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26313 - | .await
|
26314 - | .expect("unable to make an HTTP request");
|
26315 - | ::pretty_assertions::assert_eq!(
|
26316 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26317 - | http_response.status()
|
26318 - | );
|
26319 - | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26320 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26321 - | http_response.headers(),
|
26322 - | expected_headers,
|
26323 - | ));
|
26324 - | }
|
26325 - | }
|
26326 - |
|
26327 - | /// Underflow or overflow should result in SerializationException
|
26328 - | /// Test ID: RestJsonHeaderIntegerUnderflowOverflow_case2
|
26329 - | #[::tokio::test]
|
26330 - | #[::tracing_test::traced_test]
|
26331 - | async fn rest_json_header_integer_underflow_overflow_case2_malformed_request() {
|
26332 - | {
|
26333 - | #[allow(unused_mut)]
|
26334 - | let mut http_request = http::Request::builder()
|
26335 - | .uri("/MalformedInteger/1")
|
26336 - | .method("POST")
|
26337 - | .header("integerInHeader", "123000000000000000000000")
|
26338 - | .body(::aws_smithy_http_server::body::Body::empty())
|
26339 - | .unwrap();
|
26340 - | #[allow(unused_mut)]
|
26341 - | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26342 - | let config = crate::service::RestJsonConfig::builder().build();
|
26343 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
26344 - | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26345 - | let sender = sender.clone();
|
26346 - | async move {
|
26347 - | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26348 - | sender.send(()).await.expect("receiver dropped early");
|
26349 - | result
|
26350 - | }
|
26351 - | })
|
26352 - | .build_unchecked();
|
26353 - | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26354 - | .await
|
26355 - | .expect("unable to make an HTTP request");
|
26356 - | ::pretty_assertions::assert_eq!(
|
26357 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26358 - | http_response.status()
|
26359 - | );
|
26360 - | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26361 - | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26362 - | http_response.headers(),
|
26363 - | expected_headers,
|
26364 - | ));
|
26365 - | }
|
26366 - | }
|
26367 - |
|
26368 - | /// Malformed values in the body should be rejected
|
26369 - | /// Test ID: RestJsonBodyIntegerMalformedValueRejected_case0
|
26370 - | #[::tokio::test]
|
26371 - | #[::tracing_test::traced_test]
|
26372 - | async fn rest_json_body_integer_malformed_value_rejected_case0_malformed_request() {
|
26373 - | {
|
26374 - | #[allow(unused_mut)]
|
26375 - | let mut http_request = http::Request::builder()
|
26376 - | .uri("/MalformedInteger/1")
|
26377 - | .method("POST")
|
26378 - | .header("content-type", "application/json")
|
26379 - | .body(::aws_smithy_http_server::body::Body::from(
|
26380 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
26381 - | "{ \"integerInBody\" : \"123\" }".as_bytes(),
|
26382 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
26383 - | )),
|
27645 + | .body(::aws_smithy_http_server::body::boxed(
|
27646 + | ::http_body_util::Empty::new(),
|
26384 27647 | ))
|
26385 27648 | .unwrap();
|
26386 27649 | #[allow(unused_mut)]
|
26387 27650 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26388 27651 | let config = crate::service::RestJsonConfig::builder().build();
|
26389 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27652 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26390 27653 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26391 27654 | let sender = sender.clone();
|
26392 27655 | async move {
|
26393 27656 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26394 27657 | sender.send(()).await.expect("receiver dropped early");
|
26395 27658 | result
|
26396 27659 | }
|
26397 27660 | })
|
26398 27661 | .build_unchecked();
|
26399 27662 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26400 27663 | .await
|
26401 27664 | .expect("unable to make an HTTP request");
|
26402 27665 | ::pretty_assertions::assert_eq!(
|
26403 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27666 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27667 + | http_response.status()
|
27668 + | );
|
27669 + | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27670 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27671 + | http_response.headers(),
|
27672 + | expected_headers,
|
27673 + | ));
|
27674 + | }
|
27675 + | }
|
27676 + |
|
27677 + | /// Underflow or overflow should result in SerializationException
|
27678 + | /// Test ID: RestJsonHeaderIntegerUnderflowOverflow_case2
|
27679 + | #[::tokio::test]
|
27680 + | #[::tracing_test::traced_test]
|
27681 + | async fn rest_json_header_integer_underflow_overflow_case2_malformed_request() {
|
27682 + | {
|
27683 + | #[allow(unused_mut)]
|
27684 + | let mut http_request = ::http_1x::Request::builder()
|
27685 + | .uri("/MalformedInteger/1")
|
27686 + | .method("POST")
|
27687 + | .header("integerInHeader", "123000000000000000000000")
|
27688 + | .body(::aws_smithy_http_server::body::boxed(
|
27689 + | ::http_body_util::Empty::new(),
|
27690 + | ))
|
27691 + | .unwrap();
|
27692 + | #[allow(unused_mut)]
|
27693 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27694 + | let config = crate::service::RestJsonConfig::builder().build();
|
27695 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27696 + | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27697 + | let sender = sender.clone();
|
27698 + | async move {
|
27699 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27700 + | sender.send(()).await.expect("receiver dropped early");
|
27701 + | result
|
27702 + | }
|
27703 + | })
|
27704 + | .build_unchecked();
|
27705 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27706 + | .await
|
27707 + | .expect("unable to make an HTTP request");
|
27708 + | ::pretty_assertions::assert_eq!(
|
27709 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27710 + | http_response.status()
|
27711 + | );
|
27712 + | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27713 + | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27714 + | http_response.headers(),
|
27715 + | expected_headers,
|
27716 + | ));
|
27717 + | }
|
27718 + | }
|
27719 + |
|
27720 + | /// Malformed values in the body should be rejected
|
27721 + | /// Test ID: RestJsonBodyIntegerMalformedValueRejected_case0
|
27722 + | #[::tokio::test]
|
27723 + | #[::tracing_test::traced_test]
|
27724 + | async fn rest_json_body_integer_malformed_value_rejected_case0_malformed_request() {
|
27725 + | {
|
27726 + | #[allow(unused_mut)]
|
27727 + | let mut http_request = ::http_1x::Request::builder()
|
27728 + | .uri("/MalformedInteger/1")
|
27729 + | .method("POST")
|
27730 + | .header("content-type", "application/json")
|
27731 + | .body(::aws_smithy_http_server::body::boxed(
|
27732 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
27733 + | &::aws_smithy_protocol_test::decode_body_data(
|
27734 + | "{ \"integerInBody\" : \"123\" }".as_bytes(),
|
27735 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27736 + | ),
|
27737 + | )),
|
27738 + | ))
|
27739 + | .unwrap();
|
27740 + | #[allow(unused_mut)]
|
27741 + | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27742 + | let config = crate::service::RestJsonConfig::builder().build();
|
27743 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27744 + | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27745 + | let sender = sender.clone();
|
27746 + | async move {
|
27747 + | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27748 + | sender.send(()).await.expect("receiver dropped early");
|
27749 + | result
|
27750 + | }
|
27751 + | })
|
27752 + | .build_unchecked();
|
27753 + | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27754 + | .await
|
27755 + | .expect("unable to make an HTTP request");
|
27756 + | ::pretty_assertions::assert_eq!(
|
27757 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26404 27758 | http_response.status()
|
26405 27759 | );
|
26406 27760 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26407 27761 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26408 27762 | http_response.headers(),
|
26409 27763 | expected_headers,
|
26410 27764 | ));
|
26411 27765 | }
|
26412 27766 | }
|
26413 27767 |
|
26414 27768 | /// Malformed values in the body should be rejected
|
26415 27769 | /// Test ID: RestJsonBodyIntegerMalformedValueRejected_case1
|
26416 27770 | #[::tokio::test]
|
26417 27771 | #[::tracing_test::traced_test]
|
26418 27772 | async fn rest_json_body_integer_malformed_value_rejected_case1_malformed_request() {
|
26419 27773 | {
|
26420 27774 | #[allow(unused_mut)]
|
26421 - | let mut http_request = http::Request::builder()
|
27775 + | let mut http_request = ::http_1x::Request::builder()
|
26422 27776 | .uri("/MalformedInteger/1")
|
26423 27777 | .method("POST")
|
26424 27778 | .header("content-type", "application/json")
|
26425 - | .body(::aws_smithy_http_server::body::Body::from(
|
26426 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
26427 - | "{ \"integerInBody\" : true }".as_bytes(),
|
26428 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27779 + | .body(::aws_smithy_http_server::body::boxed(
|
27780 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
27781 + | &::aws_smithy_protocol_test::decode_body_data(
|
27782 + | "{ \"integerInBody\" : true }".as_bytes(),
|
27783 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27784 + | ),
|
26429 27785 | )),
|
26430 27786 | ))
|
26431 27787 | .unwrap();
|
26432 27788 | #[allow(unused_mut)]
|
26433 27789 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26434 27790 | let config = crate::service::RestJsonConfig::builder().build();
|
26435 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27791 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26436 27792 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26437 27793 | let sender = sender.clone();
|
26438 27794 | async move {
|
26439 27795 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26440 27796 | sender.send(()).await.expect("receiver dropped early");
|
26441 27797 | result
|
26442 27798 | }
|
26443 27799 | })
|
26444 27800 | .build_unchecked();
|
26445 27801 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26446 27802 | .await
|
26447 27803 | .expect("unable to make an HTTP request");
|
26448 27804 | ::pretty_assertions::assert_eq!(
|
26449 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27805 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26450 27806 | http_response.status()
|
26451 27807 | );
|
26452 27808 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26453 27809 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26454 27810 | http_response.headers(),
|
26455 27811 | expected_headers,
|
26456 27812 | ));
|
26457 27813 | }
|
26458 27814 | }
|
26459 27815 |
|
26460 27816 | /// Malformed values in the body should be rejected
|
26461 27817 | /// Test ID: RestJsonBodyIntegerMalformedValueRejected_case2
|
26462 27818 | #[::tokio::test]
|
26463 27819 | #[::tracing_test::traced_test]
|
26464 27820 | async fn rest_json_body_integer_malformed_value_rejected_case2_malformed_request() {
|
26465 27821 | {
|
26466 27822 | #[allow(unused_mut)]
|
26467 - | let mut http_request = http::Request::builder()
|
27823 + | let mut http_request = ::http_1x::Request::builder()
|
26468 27824 | .uri("/MalformedInteger/1")
|
26469 27825 | .method("POST")
|
26470 27826 | .header("content-type", "application/json")
|
26471 - | .body(::aws_smithy_http_server::body::Body::from(
|
26472 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
26473 - | "{ \"integerInBody\" : 1.001 }".as_bytes(),
|
26474 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27827 + | .body(::aws_smithy_http_server::body::boxed(
|
27828 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
27829 + | &::aws_smithy_protocol_test::decode_body_data(
|
27830 + | "{ \"integerInBody\" : 1.001 }".as_bytes(),
|
27831 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27832 + | ),
|
26475 27833 | )),
|
26476 27834 | ))
|
26477 27835 | .unwrap();
|
26478 27836 | #[allow(unused_mut)]
|
26479 27837 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26480 27838 | let config = crate::service::RestJsonConfig::builder().build();
|
26481 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27839 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26482 27840 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26483 27841 | let sender = sender.clone();
|
26484 27842 | async move {
|
26485 27843 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26486 27844 | sender.send(()).await.expect("receiver dropped early");
|
26487 27845 | result
|
26488 27846 | }
|
26489 27847 | })
|
26490 27848 | .build_unchecked();
|
26491 27849 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26492 27850 | .await
|
26493 27851 | .expect("unable to make an HTTP request");
|
26494 27852 | ::pretty_assertions::assert_eq!(
|
26495 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27853 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26496 27854 | http_response.status()
|
26497 27855 | );
|
26498 27856 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26499 27857 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26500 27858 | http_response.headers(),
|
26501 27859 | expected_headers,
|
26502 27860 | ));
|
26503 27861 | }
|
26504 27862 | }
|
26505 27863 |
|
26506 27864 | /// Malformed values in the body should be rejected
|
26507 27865 | /// Test ID: RestJsonBodyIntegerMalformedValueRejected_case3
|
26508 27866 | #[::tokio::test]
|
26509 27867 | #[::tracing_test::traced_test]
|
26510 27868 | async fn rest_json_body_integer_malformed_value_rejected_case3_malformed_request() {
|
26511 27869 | {
|
26512 27870 | #[allow(unused_mut)]
|
26513 - | let mut http_request = http::Request::builder()
|
27871 + | let mut http_request = ::http_1x::Request::builder()
|
26514 27872 | .uri("/MalformedInteger/1")
|
26515 27873 | .method("POST")
|
26516 27874 | .header("content-type", "application/json")
|
26517 - | .body(::aws_smithy_http_server::body::Body::from(
|
26518 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
26519 - | "{ \"integerInBody\" : 2ABC }".as_bytes(),
|
26520 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27875 + | .body(::aws_smithy_http_server::body::boxed(
|
27876 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
27877 + | &::aws_smithy_protocol_test::decode_body_data(
|
27878 + | "{ \"integerInBody\" : 2ABC }".as_bytes(),
|
27879 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27880 + | ),
|
26521 27881 | )),
|
26522 27882 | ))
|
26523 27883 | .unwrap();
|
26524 27884 | #[allow(unused_mut)]
|
26525 27885 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26526 27886 | let config = crate::service::RestJsonConfig::builder().build();
|
26527 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27887 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26528 27888 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26529 27889 | let sender = sender.clone();
|
26530 27890 | async move {
|
26531 27891 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26532 27892 | sender.send(()).await.expect("receiver dropped early");
|
26533 27893 | result
|
26534 27894 | }
|
26535 27895 | })
|
26536 27896 | .build_unchecked();
|
26537 27897 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26538 27898 | .await
|
26539 27899 | .expect("unable to make an HTTP request");
|
26540 27900 | ::pretty_assertions::assert_eq!(
|
26541 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27901 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26542 27902 | http_response.status()
|
26543 27903 | );
|
26544 27904 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26545 27905 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26546 27906 | http_response.headers(),
|
26547 27907 | expected_headers,
|
26548 27908 | ));
|
26549 27909 | }
|
26550 27910 | }
|
26551 27911 |
|
26552 27912 | /// Malformed values in the body should be rejected
|
26553 27913 | /// Test ID: RestJsonBodyIntegerMalformedValueRejected_case4
|
26554 27914 | #[::tokio::test]
|
26555 27915 | #[::tracing_test::traced_test]
|
26556 27916 | async fn rest_json_body_integer_malformed_value_rejected_case4_malformed_request() {
|
26557 27917 | {
|
26558 27918 | #[allow(unused_mut)]
|
26559 - | let mut http_request = http::Request::builder()
|
27919 + | let mut http_request = ::http_1x::Request::builder()
|
26560 27920 | .uri("/MalformedInteger/1")
|
26561 27921 | .method("POST")
|
26562 27922 | .header("content-type", "application/json")
|
26563 - | .body(::aws_smithy_http_server::body::Body::from(
|
26564 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
26565 - | "{ \"integerInBody\" : 0x42 }".as_bytes(),
|
26566 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27923 + | .body(::aws_smithy_http_server::body::boxed(
|
27924 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
27925 + | &::aws_smithy_protocol_test::decode_body_data(
|
27926 + | "{ \"integerInBody\" : 0x42 }".as_bytes(),
|
27927 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27928 + | ),
|
26567 27929 | )),
|
26568 27930 | ))
|
26569 27931 | .unwrap();
|
26570 27932 | #[allow(unused_mut)]
|
26571 27933 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26572 27934 | let config = crate::service::RestJsonConfig::builder().build();
|
26573 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27935 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26574 27936 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26575 27937 | let sender = sender.clone();
|
26576 27938 | async move {
|
26577 27939 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26578 27940 | sender.send(()).await.expect("receiver dropped early");
|
26579 27941 | result
|
26580 27942 | }
|
26581 27943 | })
|
26582 27944 | .build_unchecked();
|
26583 27945 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26584 27946 | .await
|
26585 27947 | .expect("unable to make an HTTP request");
|
26586 27948 | ::pretty_assertions::assert_eq!(
|
26587 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27949 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26588 27950 | http_response.status()
|
26589 27951 | );
|
26590 27952 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26591 27953 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26592 27954 | http_response.headers(),
|
26593 27955 | expected_headers,
|
26594 27956 | ));
|
26595 27957 | }
|
26596 27958 | }
|
26597 27959 |
|
26598 27960 | /// Malformed values in the body should be rejected
|
26599 27961 | /// Test ID: RestJsonBodyIntegerMalformedValueRejected_case5
|
26600 27962 | #[::tokio::test]
|
26601 27963 | #[::tracing_test::traced_test]
|
26602 27964 | async fn rest_json_body_integer_malformed_value_rejected_case5_malformed_request() {
|
26603 27965 | {
|
26604 27966 | #[allow(unused_mut)]
|
26605 - | let mut http_request = http::Request::builder()
|
27967 + | let mut http_request = ::http_1x::Request::builder()
|
26606 27968 | .uri("/MalformedInteger/1")
|
26607 27969 | .method("POST")
|
26608 27970 | .header("content-type", "application/json")
|
26609 - | .body(::aws_smithy_http_server::body::Body::from(
|
26610 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
26611 - | "{ \"integerInBody\" : Infinity }".as_bytes(),
|
26612 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27971 + | .body(::aws_smithy_http_server::body::boxed(
|
27972 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
27973 + | &::aws_smithy_protocol_test::decode_body_data(
|
27974 + | "{ \"integerInBody\" : Infinity }".as_bytes(),
|
27975 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
27976 + | ),
|
26613 27977 | )),
|
26614 27978 | ))
|
26615 27979 | .unwrap();
|
26616 27980 | #[allow(unused_mut)]
|
26617 27981 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26618 27982 | let config = crate::service::RestJsonConfig::builder().build();
|
26619 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
27983 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26620 27984 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26621 27985 | let sender = sender.clone();
|
26622 27986 | async move {
|
26623 27987 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26624 27988 | sender.send(()).await.expect("receiver dropped early");
|
26625 27989 | result
|
26626 27990 | }
|
26627 27991 | })
|
26628 27992 | .build_unchecked();
|
26629 27993 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26630 27994 | .await
|
26631 27995 | .expect("unable to make an HTTP request");
|
26632 27996 | ::pretty_assertions::assert_eq!(
|
26633 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27997 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26634 27998 | http_response.status()
|
26635 27999 | );
|
26636 28000 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26637 28001 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26638 28002 | http_response.headers(),
|
26639 28003 | expected_headers,
|
26640 28004 | ));
|
26641 28005 | }
|
26642 28006 | }
|
26643 28007 |
|
26644 28008 | /// Malformed values in the body should be rejected
|
26645 28009 | /// Test ID: RestJsonBodyIntegerMalformedValueRejected_case6
|
26646 28010 | #[::tokio::test]
|
26647 28011 | #[::tracing_test::traced_test]
|
26648 28012 | async fn rest_json_body_integer_malformed_value_rejected_case6_malformed_request() {
|
26649 28013 | {
|
26650 28014 | #[allow(unused_mut)]
|
26651 - | let mut http_request = http::Request::builder()
|
28015 + | let mut http_request = ::http_1x::Request::builder()
|
26652 28016 | .uri("/MalformedInteger/1")
|
26653 28017 | .method("POST")
|
26654 28018 | .header("content-type", "application/json")
|
26655 - | .body(::aws_smithy_http_server::body::Body::from(
|
26656 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
26657 - | "{ \"integerInBody\" : \"Infinity\" }".as_bytes(),
|
26658 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
28019 + | .body(::aws_smithy_http_server::body::boxed(
|
28020 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
28021 + | &::aws_smithy_protocol_test::decode_body_data(
|
28022 + | "{ \"integerInBody\" : \"Infinity\" }".as_bytes(),
|
28023 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
28024 + | ),
|
26659 28025 | )),
|
26660 28026 | ))
|
26661 28027 | .unwrap();
|
26662 28028 | #[allow(unused_mut)]
|
26663 28029 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26664 28030 | let config = crate::service::RestJsonConfig::builder().build();
|
26665 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28031 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26666 28032 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26667 28033 | let sender = sender.clone();
|
26668 28034 | async move {
|
26669 28035 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26670 28036 | sender.send(()).await.expect("receiver dropped early");
|
26671 28037 | result
|
26672 28038 | }
|
26673 28039 | })
|
26674 28040 | .build_unchecked();
|
26675 28041 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26676 28042 | .await
|
26677 28043 | .expect("unable to make an HTTP request");
|
26678 28044 | ::pretty_assertions::assert_eq!(
|
26679 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28045 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26680 28046 | http_response.status()
|
26681 28047 | );
|
26682 28048 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26683 28049 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26684 28050 | http_response.headers(),
|
26685 28051 | expected_headers,
|
26686 28052 | ));
|
26687 28053 | }
|
26688 28054 | }
|
26689 28055 |
|
26690 28056 | /// Malformed values in the body should be rejected
|
26691 28057 | /// Test ID: RestJsonBodyIntegerMalformedValueRejected_case7
|
26692 28058 | #[::tokio::test]
|
26693 28059 | #[::tracing_test::traced_test]
|
26694 28060 | async fn rest_json_body_integer_malformed_value_rejected_case7_malformed_request() {
|
26695 28061 | {
|
26696 28062 | #[allow(unused_mut)]
|
26697 - | let mut http_request = http::Request::builder()
|
28063 + | let mut http_request = ::http_1x::Request::builder()
|
26698 28064 | .uri("/MalformedInteger/1")
|
26699 28065 | .method("POST")
|
26700 28066 | .header("content-type", "application/json")
|
26701 - | .body(::aws_smithy_http_server::body::Body::from(
|
26702 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
26703 - | "{ \"integerInBody\" : -Infinity }".as_bytes(),
|
26704 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
28067 + | .body(::aws_smithy_http_server::body::boxed(
|
28068 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
28069 + | &::aws_smithy_protocol_test::decode_body_data(
|
28070 + | "{ \"integerInBody\" : -Infinity }".as_bytes(),
|
28071 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
28072 + | ),
|
26705 28073 | )),
|
26706 28074 | ))
|
26707 28075 | .unwrap();
|
26708 28076 | #[allow(unused_mut)]
|
26709 28077 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26710 28078 | let config = crate::service::RestJsonConfig::builder().build();
|
26711 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28079 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26712 28080 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26713 28081 | let sender = sender.clone();
|
26714 28082 | async move {
|
26715 28083 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26716 28084 | sender.send(()).await.expect("receiver dropped early");
|
26717 28085 | result
|
26718 28086 | }
|
26719 28087 | })
|
26720 28088 | .build_unchecked();
|
26721 28089 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26722 28090 | .await
|
26723 28091 | .expect("unable to make an HTTP request");
|
26724 28092 | ::pretty_assertions::assert_eq!(
|
26725 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28093 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26726 28094 | http_response.status()
|
26727 28095 | );
|
26728 28096 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26729 28097 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26730 28098 | http_response.headers(),
|
26731 28099 | expected_headers,
|
26732 28100 | ));
|
26733 28101 | }
|
26734 28102 | }
|
26735 28103 |
|
26736 28104 | /// Malformed values in the body should be rejected
|
26737 28105 | /// Test ID: RestJsonBodyIntegerMalformedValueRejected_case8
|
26738 28106 | #[::tokio::test]
|
26739 28107 | #[::tracing_test::traced_test]
|
26740 28108 | async fn rest_json_body_integer_malformed_value_rejected_case8_malformed_request() {
|
26741 28109 | {
|
26742 28110 | #[allow(unused_mut)]
|
26743 - | let mut http_request = http::Request::builder()
|
28111 + | let mut http_request = ::http_1x::Request::builder()
|
26744 28112 | .uri("/MalformedInteger/1")
|
26745 28113 | .method("POST")
|
26746 28114 | .header("content-type", "application/json")
|
26747 - | .body(::aws_smithy_http_server::body::Body::from(
|
26748 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
26749 - | "{ \"integerInBody\" : \"-Infinity\" }".as_bytes(),
|
26750 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
28115 + | .body(::aws_smithy_http_server::body::boxed(
|
28116 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
28117 + | &::aws_smithy_protocol_test::decode_body_data(
|
28118 + | "{ \"integerInBody\" : \"-Infinity\" }".as_bytes(),
|
28119 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
28120 + | ),
|
26751 28121 | )),
|
26752 28122 | ))
|
26753 28123 | .unwrap();
|
26754 28124 | #[allow(unused_mut)]
|
26755 28125 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26756 28126 | let config = crate::service::RestJsonConfig::builder().build();
|
26757 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28127 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26758 28128 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26759 28129 | let sender = sender.clone();
|
26760 28130 | async move {
|
26761 28131 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26762 28132 | sender.send(()).await.expect("receiver dropped early");
|
26763 28133 | result
|
26764 28134 | }
|
26765 28135 | })
|
26766 28136 | .build_unchecked();
|
26767 28137 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26768 28138 | .await
|
26769 28139 | .expect("unable to make an HTTP request");
|
26770 28140 | ::pretty_assertions::assert_eq!(
|
26771 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28141 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26772 28142 | http_response.status()
|
26773 28143 | );
|
26774 28144 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26775 28145 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26776 28146 | http_response.headers(),
|
26777 28147 | expected_headers,
|
26778 28148 | ));
|
26779 28149 | }
|
26780 28150 | }
|
26781 28151 |
|
26782 28152 | /// Malformed values in the body should be rejected
|
26783 28153 | /// Test ID: RestJsonBodyIntegerMalformedValueRejected_case9
|
26784 28154 | #[::tokio::test]
|
26785 28155 | #[::tracing_test::traced_test]
|
26786 28156 | async fn rest_json_body_integer_malformed_value_rejected_case9_malformed_request() {
|
26787 28157 | {
|
26788 28158 | #[allow(unused_mut)]
|
26789 - | let mut http_request = http::Request::builder()
|
28159 + | let mut http_request = ::http_1x::Request::builder()
|
26790 28160 | .uri("/MalformedInteger/1")
|
26791 28161 | .method("POST")
|
26792 28162 | .header("content-type", "application/json")
|
26793 - | .body(::aws_smithy_http_server::body::Body::from(
|
26794 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
26795 - | "{ \"integerInBody\" : NaN }".as_bytes(),
|
26796 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
28163 + | .body(::aws_smithy_http_server::body::boxed(
|
28164 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
28165 + | &::aws_smithy_protocol_test::decode_body_data(
|
28166 + | "{ \"integerInBody\" : NaN }".as_bytes(),
|
28167 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
28168 + | ),
|
26797 28169 | )),
|
26798 28170 | ))
|
26799 28171 | .unwrap();
|
26800 28172 | #[allow(unused_mut)]
|
26801 28173 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26802 28174 | let config = crate::service::RestJsonConfig::builder().build();
|
26803 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28175 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26804 28176 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26805 28177 | let sender = sender.clone();
|
26806 28178 | async move {
|
26807 28179 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26808 28180 | sender.send(()).await.expect("receiver dropped early");
|
26809 28181 | result
|
26810 28182 | }
|
26811 28183 | })
|
26812 28184 | .build_unchecked();
|
26813 28185 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26814 28186 | .await
|
26815 28187 | .expect("unable to make an HTTP request");
|
26816 28188 | ::pretty_assertions::assert_eq!(
|
26817 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28189 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26818 28190 | http_response.status()
|
26819 28191 | );
|
26820 28192 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26821 28193 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26822 28194 | http_response.headers(),
|
26823 28195 | expected_headers,
|
26824 28196 | ));
|
26825 28197 | }
|
26826 28198 | }
|
26827 28199 |
|
26828 28200 | /// Malformed values in the body should be rejected
|
26829 28201 | /// Test ID: RestJsonBodyIntegerMalformedValueRejected_case10
|
26830 28202 | #[::tokio::test]
|
26831 28203 | #[::tracing_test::traced_test]
|
26832 28204 | async fn rest_json_body_integer_malformed_value_rejected_case10_malformed_request() {
|
26833 28205 | {
|
26834 28206 | #[allow(unused_mut)]
|
26835 - | let mut http_request = http::Request::builder()
|
28207 + | let mut http_request = ::http_1x::Request::builder()
|
26836 28208 | .uri("/MalformedInteger/1")
|
26837 28209 | .method("POST")
|
26838 28210 | .header("content-type", "application/json")
|
26839 - | .body(::aws_smithy_http_server::body::Body::from(
|
26840 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
26841 - | "{ \"integerInBody\" : \"NaN\" }".as_bytes(),
|
26842 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
28211 + | .body(::aws_smithy_http_server::body::boxed(
|
28212 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
28213 + | &::aws_smithy_protocol_test::decode_body_data(
|
28214 + | "{ \"integerInBody\" : \"NaN\" }".as_bytes(),
|
28215 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
28216 + | ),
|
26843 28217 | )),
|
26844 28218 | ))
|
26845 28219 | .unwrap();
|
26846 28220 | #[allow(unused_mut)]
|
26847 28221 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26848 28222 | let config = crate::service::RestJsonConfig::builder().build();
|
26849 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28223 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26850 28224 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26851 28225 | let sender = sender.clone();
|
26852 28226 | async move {
|
26853 28227 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26854 28228 | sender.send(()).await.expect("receiver dropped early");
|
26855 28229 | result
|
26856 28230 | }
|
26857 28231 | })
|
26858 28232 | .build_unchecked();
|
26859 28233 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26860 28234 | .await
|
26861 28235 | .expect("unable to make an HTTP request");
|
26862 28236 | ::pretty_assertions::assert_eq!(
|
26863 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28237 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26864 28238 | http_response.status()
|
26865 28239 | );
|
26866 28240 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26867 28241 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26868 28242 | http_response.headers(),
|
26869 28243 | expected_headers,
|
26870 28244 | ));
|
26871 28245 | }
|
26872 28246 | }
|
26873 28247 |
|
26874 28248 | /// Malformed values in the path should be rejected
|
26875 28249 | /// Test ID: RestJsonPathIntegerMalformedValueRejected_case0
|
26876 28250 | #[::tokio::test]
|
26877 28251 | #[::tracing_test::traced_test]
|
26878 28252 | async fn rest_json_path_integer_malformed_value_rejected_case0_malformed_request() {
|
26879 28253 | {
|
26880 28254 | #[allow(unused_mut)]
|
26881 - | let mut http_request = http::Request::builder()
|
28255 + | let mut http_request = ::http_1x::Request::builder()
|
26882 28256 | .uri("/MalformedInteger/true")
|
26883 28257 | .method("POST")
|
26884 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28258 + | .body(::aws_smithy_http_server::body::boxed(
|
28259 + | ::http_body_util::Empty::new(),
|
28260 + | ))
|
26885 28261 | .unwrap();
|
26886 28262 | #[allow(unused_mut)]
|
26887 28263 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26888 28264 | let config = crate::service::RestJsonConfig::builder().build();
|
26889 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28265 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26890 28266 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26891 28267 | let sender = sender.clone();
|
26892 28268 | async move {
|
26893 28269 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26894 28270 | sender.send(()).await.expect("receiver dropped early");
|
26895 28271 | result
|
26896 28272 | }
|
26897 28273 | })
|
26898 28274 | .build_unchecked();
|
26899 28275 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26900 28276 | .await
|
26901 28277 | .expect("unable to make an HTTP request");
|
26902 28278 | ::pretty_assertions::assert_eq!(
|
26903 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28279 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26904 28280 | http_response.status()
|
26905 28281 | );
|
26906 28282 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26907 28283 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26908 28284 | http_response.headers(),
|
26909 28285 | expected_headers,
|
26910 28286 | ));
|
26911 28287 | }
|
26912 28288 | }
|
26913 28289 |
|
26914 28290 | /// Malformed values in the path should be rejected
|
26915 28291 | /// Test ID: RestJsonPathIntegerMalformedValueRejected_case1
|
26916 28292 | #[::tokio::test]
|
26917 28293 | #[::tracing_test::traced_test]
|
26918 28294 | async fn rest_json_path_integer_malformed_value_rejected_case1_malformed_request() {
|
26919 28295 | {
|
26920 28296 | #[allow(unused_mut)]
|
26921 - | let mut http_request = http::Request::builder()
|
28297 + | let mut http_request = ::http_1x::Request::builder()
|
26922 28298 | .uri("/MalformedInteger/1.001")
|
26923 28299 | .method("POST")
|
26924 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28300 + | .body(::aws_smithy_http_server::body::boxed(
|
28301 + | ::http_body_util::Empty::new(),
|
28302 + | ))
|
26925 28303 | .unwrap();
|
26926 28304 | #[allow(unused_mut)]
|
26927 28305 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26928 28306 | let config = crate::service::RestJsonConfig::builder().build();
|
26929 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28307 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26930 28308 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26931 28309 | let sender = sender.clone();
|
26932 28310 | async move {
|
26933 28311 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26934 28312 | sender.send(()).await.expect("receiver dropped early");
|
26935 28313 | result
|
26936 28314 | }
|
26937 28315 | })
|
26938 28316 | .build_unchecked();
|
26939 28317 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26940 28318 | .await
|
26941 28319 | .expect("unable to make an HTTP request");
|
26942 28320 | ::pretty_assertions::assert_eq!(
|
26943 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28321 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26944 28322 | http_response.status()
|
26945 28323 | );
|
26946 28324 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26947 28325 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26948 28326 | http_response.headers(),
|
26949 28327 | expected_headers,
|
26950 28328 | ));
|
26951 28329 | }
|
26952 28330 | }
|
26953 28331 |
|
26954 28332 | /// Malformed values in the path should be rejected
|
26955 28333 | /// Test ID: RestJsonPathIntegerMalformedValueRejected_case2
|
26956 28334 | #[::tokio::test]
|
26957 28335 | #[::tracing_test::traced_test]
|
26958 28336 | async fn rest_json_path_integer_malformed_value_rejected_case2_malformed_request() {
|
26959 28337 | {
|
26960 28338 | #[allow(unused_mut)]
|
26961 - | let mut http_request = http::Request::builder()
|
28339 + | let mut http_request = ::http_1x::Request::builder()
|
26962 28340 | .uri("/MalformedInteger/2ABC")
|
26963 28341 | .method("POST")
|
26964 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28342 + | .body(::aws_smithy_http_server::body::boxed(
|
28343 + | ::http_body_util::Empty::new(),
|
28344 + | ))
|
26965 28345 | .unwrap();
|
26966 28346 | #[allow(unused_mut)]
|
26967 28347 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
26968 28348 | let config = crate::service::RestJsonConfig::builder().build();
|
26969 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28349 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
26970 28350 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
26971 28351 | let sender = sender.clone();
|
26972 28352 | async move {
|
26973 28353 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
26974 28354 | sender.send(()).await.expect("receiver dropped early");
|
26975 28355 | result
|
26976 28356 | }
|
26977 28357 | })
|
26978 28358 | .build_unchecked();
|
26979 28359 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
26980 28360 | .await
|
26981 28361 | .expect("unable to make an HTTP request");
|
26982 28362 | ::pretty_assertions::assert_eq!(
|
26983 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28363 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
26984 28364 | http_response.status()
|
26985 28365 | );
|
26986 28366 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
26987 28367 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
26988 28368 | http_response.headers(),
|
26989 28369 | expected_headers,
|
26990 28370 | ));
|
26991 28371 | }
|
26992 28372 | }
|
26993 28373 |
|
26994 28374 | /// Malformed values in the path should be rejected
|
26995 28375 | /// Test ID: RestJsonPathIntegerMalformedValueRejected_case3
|
26996 28376 | #[::tokio::test]
|
26997 28377 | #[::tracing_test::traced_test]
|
26998 28378 | async fn rest_json_path_integer_malformed_value_rejected_case3_malformed_request() {
|
26999 28379 | {
|
27000 28380 | #[allow(unused_mut)]
|
27001 - | let mut http_request = http::Request::builder()
|
28381 + | let mut http_request = ::http_1x::Request::builder()
|
27002 28382 | .uri("/MalformedInteger/0x42")
|
27003 28383 | .method("POST")
|
27004 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28384 + | .body(::aws_smithy_http_server::body::boxed(
|
28385 + | ::http_body_util::Empty::new(),
|
28386 + | ))
|
27005 28387 | .unwrap();
|
27006 28388 | #[allow(unused_mut)]
|
27007 28389 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27008 28390 | let config = crate::service::RestJsonConfig::builder().build();
|
27009 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28391 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27010 28392 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27011 28393 | let sender = sender.clone();
|
27012 28394 | async move {
|
27013 28395 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27014 28396 | sender.send(()).await.expect("receiver dropped early");
|
27015 28397 | result
|
27016 28398 | }
|
27017 28399 | })
|
27018 28400 | .build_unchecked();
|
27019 28401 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27020 28402 | .await
|
27021 28403 | .expect("unable to make an HTTP request");
|
27022 28404 | ::pretty_assertions::assert_eq!(
|
27023 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28405 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27024 28406 | http_response.status()
|
27025 28407 | );
|
27026 28408 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27027 28409 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27028 28410 | http_response.headers(),
|
27029 28411 | expected_headers,
|
27030 28412 | ));
|
27031 28413 | }
|
27032 28414 | }
|
27033 28415 |
|
27034 28416 | /// Malformed values in the path should be rejected
|
27035 28417 | /// Test ID: RestJsonPathIntegerMalformedValueRejected_case4
|
27036 28418 | #[::tokio::test]
|
27037 28419 | #[::tracing_test::traced_test]
|
27038 28420 | async fn rest_json_path_integer_malformed_value_rejected_case4_malformed_request() {
|
27039 28421 | {
|
27040 28422 | #[allow(unused_mut)]
|
27041 - | let mut http_request = http::Request::builder()
|
28423 + | let mut http_request = ::http_1x::Request::builder()
|
27042 28424 | .uri("/MalformedInteger/Infinity")
|
27043 28425 | .method("POST")
|
27044 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28426 + | .body(::aws_smithy_http_server::body::boxed(
|
28427 + | ::http_body_util::Empty::new(),
|
28428 + | ))
|
27045 28429 | .unwrap();
|
27046 28430 | #[allow(unused_mut)]
|
27047 28431 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27048 28432 | let config = crate::service::RestJsonConfig::builder().build();
|
27049 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28433 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27050 28434 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27051 28435 | let sender = sender.clone();
|
27052 28436 | async move {
|
27053 28437 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27054 28438 | sender.send(()).await.expect("receiver dropped early");
|
27055 28439 | result
|
27056 28440 | }
|
27057 28441 | })
|
27058 28442 | .build_unchecked();
|
27059 28443 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27060 28444 | .await
|
27061 28445 | .expect("unable to make an HTTP request");
|
27062 28446 | ::pretty_assertions::assert_eq!(
|
27063 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28447 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27064 28448 | http_response.status()
|
27065 28449 | );
|
27066 28450 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27067 28451 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27068 28452 | http_response.headers(),
|
27069 28453 | expected_headers,
|
27070 28454 | ));
|
27071 28455 | }
|
27072 28456 | }
|
27073 28457 |
|
27074 28458 | /// Malformed values in the path should be rejected
|
27075 28459 | /// Test ID: RestJsonPathIntegerMalformedValueRejected_case5
|
27076 28460 | #[::tokio::test]
|
27077 28461 | #[::tracing_test::traced_test]
|
27078 28462 | async fn rest_json_path_integer_malformed_value_rejected_case5_malformed_request() {
|
27079 28463 | {
|
27080 28464 | #[allow(unused_mut)]
|
27081 - | let mut http_request = http::Request::builder()
|
28465 + | let mut http_request = ::http_1x::Request::builder()
|
27082 28466 | .uri("/MalformedInteger/-Infinity")
|
27083 28467 | .method("POST")
|
27084 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28468 + | .body(::aws_smithy_http_server::body::boxed(
|
28469 + | ::http_body_util::Empty::new(),
|
28470 + | ))
|
27085 28471 | .unwrap();
|
27086 28472 | #[allow(unused_mut)]
|
27087 28473 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27088 28474 | let config = crate::service::RestJsonConfig::builder().build();
|
27089 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28475 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27090 28476 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27091 28477 | let sender = sender.clone();
|
27092 28478 | async move {
|
27093 28479 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27094 28480 | sender.send(()).await.expect("receiver dropped early");
|
27095 28481 | result
|
27096 28482 | }
|
27097 28483 | })
|
27098 28484 | .build_unchecked();
|
27099 28485 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27100 28486 | .await
|
27101 28487 | .expect("unable to make an HTTP request");
|
27102 28488 | ::pretty_assertions::assert_eq!(
|
27103 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28489 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27104 28490 | http_response.status()
|
27105 28491 | );
|
27106 28492 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27107 28493 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27108 28494 | http_response.headers(),
|
27109 28495 | expected_headers,
|
27110 28496 | ));
|
27111 28497 | }
|
27112 28498 | }
|
27113 28499 |
|
27114 28500 | /// Malformed values in the path should be rejected
|
27115 28501 | /// Test ID: RestJsonPathIntegerMalformedValueRejected_case6
|
27116 28502 | #[::tokio::test]
|
27117 28503 | #[::tracing_test::traced_test]
|
27118 28504 | async fn rest_json_path_integer_malformed_value_rejected_case6_malformed_request() {
|
27119 28505 | {
|
27120 28506 | #[allow(unused_mut)]
|
27121 - | let mut http_request = http::Request::builder()
|
28507 + | let mut http_request = ::http_1x::Request::builder()
|
27122 28508 | .uri("/MalformedInteger/NaN")
|
27123 28509 | .method("POST")
|
27124 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28510 + | .body(::aws_smithy_http_server::body::boxed(
|
28511 + | ::http_body_util::Empty::new(),
|
28512 + | ))
|
27125 28513 | .unwrap();
|
27126 28514 | #[allow(unused_mut)]
|
27127 28515 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27128 28516 | let config = crate::service::RestJsonConfig::builder().build();
|
27129 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28517 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27130 28518 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27131 28519 | let sender = sender.clone();
|
27132 28520 | async move {
|
27133 28521 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27134 28522 | sender.send(()).await.expect("receiver dropped early");
|
27135 28523 | result
|
27136 28524 | }
|
27137 28525 | })
|
27138 28526 | .build_unchecked();
|
27139 28527 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27140 28528 | .await
|
27141 28529 | .expect("unable to make an HTTP request");
|
27142 28530 | ::pretty_assertions::assert_eq!(
|
27143 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28531 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27144 28532 | http_response.status()
|
27145 28533 | );
|
27146 28534 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27147 28535 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27148 28536 | http_response.headers(),
|
27149 28537 | expected_headers,
|
27150 28538 | ));
|
27151 28539 | }
|
27152 28540 | }
|
27153 28541 |
|
27154 28542 | /// Malformed values in query parameters should be rejected
|
27155 28543 | /// Test ID: RestJsonQueryIntegerMalformedValueRejected_case0
|
27156 28544 | #[::tokio::test]
|
27157 28545 | #[::tracing_test::traced_test]
|
27158 28546 | async fn rest_json_query_integer_malformed_value_rejected_case0_malformed_request() {
|
27159 28547 | {
|
27160 28548 | #[allow(unused_mut)]
|
27161 - | let mut http_request = http::Request::builder()
|
28549 + | let mut http_request = ::http_1x::Request::builder()
|
27162 28550 | .uri("/MalformedInteger/1")
|
27163 28551 | .method("POST")
|
27164 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28552 + | .body(::aws_smithy_http_server::body::boxed(
|
28553 + | ::http_body_util::Empty::new(),
|
28554 + | ))
|
27165 28555 | .unwrap();
|
27166 28556 | *http_request.uri_mut() = "/MalformedInteger/1?integerInQuery=true".parse().unwrap();
|
27167 28557 | #[allow(unused_mut)]
|
27168 28558 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27169 28559 | let config = crate::service::RestJsonConfig::builder().build();
|
27170 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28560 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27171 28561 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27172 28562 | let sender = sender.clone();
|
27173 28563 | async move {
|
27174 28564 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27175 28565 | sender.send(()).await.expect("receiver dropped early");
|
27176 28566 | result
|
27177 28567 | }
|
27178 28568 | })
|
27179 28569 | .build_unchecked();
|
27180 28570 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27181 28571 | .await
|
27182 28572 | .expect("unable to make an HTTP request");
|
27183 28573 | ::pretty_assertions::assert_eq!(
|
27184 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28574 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27185 28575 | http_response.status()
|
27186 28576 | );
|
27187 28577 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27188 28578 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27189 28579 | http_response.headers(),
|
27190 28580 | expected_headers,
|
27191 28581 | ));
|
27192 28582 | }
|
27193 28583 | }
|
27194 28584 |
|
27195 28585 | /// Malformed values in query parameters should be rejected
|
27196 28586 | /// Test ID: RestJsonQueryIntegerMalformedValueRejected_case1
|
27197 28587 | #[::tokio::test]
|
27198 28588 | #[::tracing_test::traced_test]
|
27199 28589 | async fn rest_json_query_integer_malformed_value_rejected_case1_malformed_request() {
|
27200 28590 | {
|
27201 28591 | #[allow(unused_mut)]
|
27202 - | let mut http_request = http::Request::builder()
|
28592 + | let mut http_request = ::http_1x::Request::builder()
|
27203 28593 | .uri("/MalformedInteger/1")
|
27204 28594 | .method("POST")
|
27205 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28595 + | .body(::aws_smithy_http_server::body::boxed(
|
28596 + | ::http_body_util::Empty::new(),
|
28597 + | ))
|
27206 28598 | .unwrap();
|
27207 28599 | *http_request.uri_mut() = "/MalformedInteger/1?integerInQuery=1.001".parse().unwrap();
|
27208 28600 | #[allow(unused_mut)]
|
27209 28601 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27210 28602 | let config = crate::service::RestJsonConfig::builder().build();
|
27211 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28603 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27212 28604 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27213 28605 | let sender = sender.clone();
|
27214 28606 | async move {
|
27215 28607 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27216 28608 | sender.send(()).await.expect("receiver dropped early");
|
27217 28609 | result
|
27218 28610 | }
|
27219 28611 | })
|
27220 28612 | .build_unchecked();
|
27221 28613 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27222 28614 | .await
|
27223 28615 | .expect("unable to make an HTTP request");
|
27224 28616 | ::pretty_assertions::assert_eq!(
|
27225 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28617 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27226 28618 | http_response.status()
|
27227 28619 | );
|
27228 28620 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27229 28621 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27230 28622 | http_response.headers(),
|
27231 28623 | expected_headers,
|
27232 28624 | ));
|
27233 28625 | }
|
27234 28626 | }
|
27235 28627 |
|
27236 28628 | /// Malformed values in query parameters should be rejected
|
27237 28629 | /// Test ID: RestJsonQueryIntegerMalformedValueRejected_case2
|
27238 28630 | #[::tokio::test]
|
27239 28631 | #[::tracing_test::traced_test]
|
27240 28632 | async fn rest_json_query_integer_malformed_value_rejected_case2_malformed_request() {
|
27241 28633 | {
|
27242 28634 | #[allow(unused_mut)]
|
27243 - | let mut http_request = http::Request::builder()
|
28635 + | let mut http_request = ::http_1x::Request::builder()
|
27244 28636 | .uri("/MalformedInteger/1")
|
27245 28637 | .method("POST")
|
27246 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28638 + | .body(::aws_smithy_http_server::body::boxed(
|
28639 + | ::http_body_util::Empty::new(),
|
28640 + | ))
|
27247 28641 | .unwrap();
|
27248 28642 | *http_request.uri_mut() = "/MalformedInteger/1?integerInQuery=2ABC".parse().unwrap();
|
27249 28643 | #[allow(unused_mut)]
|
27250 28644 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27251 28645 | let config = crate::service::RestJsonConfig::builder().build();
|
27252 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28646 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27253 28647 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27254 28648 | let sender = sender.clone();
|
27255 28649 | async move {
|
27256 28650 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27257 28651 | sender.send(()).await.expect("receiver dropped early");
|
27258 28652 | result
|
27259 28653 | }
|
27260 28654 | })
|
27261 28655 | .build_unchecked();
|
27262 28656 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27263 28657 | .await
|
27264 28658 | .expect("unable to make an HTTP request");
|
27265 28659 | ::pretty_assertions::assert_eq!(
|
27266 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28660 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27267 28661 | http_response.status()
|
27268 28662 | );
|
27269 28663 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27270 28664 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27271 28665 | http_response.headers(),
|
27272 28666 | expected_headers,
|
27273 28667 | ));
|
27274 28668 | }
|
27275 28669 | }
|
27276 28670 |
|
27277 28671 | /// Malformed values in query parameters should be rejected
|
27278 28672 | /// Test ID: RestJsonQueryIntegerMalformedValueRejected_case3
|
27279 28673 | #[::tokio::test]
|
27280 28674 | #[::tracing_test::traced_test]
|
27281 28675 | async fn rest_json_query_integer_malformed_value_rejected_case3_malformed_request() {
|
27282 28676 | {
|
27283 28677 | #[allow(unused_mut)]
|
27284 - | let mut http_request = http::Request::builder()
|
28678 + | let mut http_request = ::http_1x::Request::builder()
|
27285 28679 | .uri("/MalformedInteger/1")
|
27286 28680 | .method("POST")
|
27287 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28681 + | .body(::aws_smithy_http_server::body::boxed(
|
28682 + | ::http_body_util::Empty::new(),
|
28683 + | ))
|
27288 28684 | .unwrap();
|
27289 28685 | *http_request.uri_mut() = "/MalformedInteger/1?integerInQuery=0x42".parse().unwrap();
|
27290 28686 | #[allow(unused_mut)]
|
27291 28687 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27292 28688 | let config = crate::service::RestJsonConfig::builder().build();
|
27293 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28689 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27294 28690 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27295 28691 | let sender = sender.clone();
|
27296 28692 | async move {
|
27297 28693 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27298 28694 | sender.send(()).await.expect("receiver dropped early");
|
27299 28695 | result
|
27300 28696 | }
|
27301 28697 | })
|
27302 28698 | .build_unchecked();
|
27303 28699 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27304 28700 | .await
|
27305 28701 | .expect("unable to make an HTTP request");
|
27306 28702 | ::pretty_assertions::assert_eq!(
|
27307 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28703 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27308 28704 | http_response.status()
|
27309 28705 | );
|
27310 28706 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27311 28707 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27312 28708 | http_response.headers(),
|
27313 28709 | expected_headers,
|
27314 28710 | ));
|
27315 28711 | }
|
27316 28712 | }
|
27317 28713 |
|
27318 28714 | /// Malformed values in query parameters should be rejected
|
27319 28715 | /// Test ID: RestJsonQueryIntegerMalformedValueRejected_case4
|
27320 28716 | #[::tokio::test]
|
27321 28717 | #[::tracing_test::traced_test]
|
27322 28718 | async fn rest_json_query_integer_malformed_value_rejected_case4_malformed_request() {
|
27323 28719 | {
|
27324 28720 | #[allow(unused_mut)]
|
27325 - | let mut http_request = http::Request::builder()
|
28721 + | let mut http_request = ::http_1x::Request::builder()
|
27326 28722 | .uri("/MalformedInteger/1")
|
27327 28723 | .method("POST")
|
27328 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28724 + | .body(::aws_smithy_http_server::body::boxed(
|
28725 + | ::http_body_util::Empty::new(),
|
28726 + | ))
|
27329 28727 | .unwrap();
|
27330 28728 | *http_request.uri_mut() = "/MalformedInteger/1?integerInQuery=Infinity"
|
27331 28729 | .parse()
|
27332 28730 | .unwrap();
|
27333 28731 | #[allow(unused_mut)]
|
27334 28732 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27335 28733 | let config = crate::service::RestJsonConfig::builder().build();
|
27336 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28734 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27337 28735 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27338 28736 | let sender = sender.clone();
|
27339 28737 | async move {
|
27340 28738 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27341 28739 | sender.send(()).await.expect("receiver dropped early");
|
27342 28740 | result
|
27343 28741 | }
|
27344 28742 | })
|
27345 28743 | .build_unchecked();
|
27346 28744 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27347 28745 | .await
|
27348 28746 | .expect("unable to make an HTTP request");
|
27349 28747 | ::pretty_assertions::assert_eq!(
|
27350 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28748 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27351 28749 | http_response.status()
|
27352 28750 | );
|
27353 28751 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27354 28752 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27355 28753 | http_response.headers(),
|
27356 28754 | expected_headers,
|
27357 28755 | ));
|
27358 28756 | }
|
27359 28757 | }
|
27360 28758 |
|
27361 28759 | /// Malformed values in query parameters should be rejected
|
27362 28760 | /// Test ID: RestJsonQueryIntegerMalformedValueRejected_case5
|
27363 28761 | #[::tokio::test]
|
27364 28762 | #[::tracing_test::traced_test]
|
27365 28763 | async fn rest_json_query_integer_malformed_value_rejected_case5_malformed_request() {
|
27366 28764 | {
|
27367 28765 | #[allow(unused_mut)]
|
27368 - | let mut http_request = http::Request::builder()
|
28766 + | let mut http_request = ::http_1x::Request::builder()
|
27369 28767 | .uri("/MalformedInteger/1")
|
27370 28768 | .method("POST")
|
27371 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28769 + | .body(::aws_smithy_http_server::body::boxed(
|
28770 + | ::http_body_util::Empty::new(),
|
28771 + | ))
|
27372 28772 | .unwrap();
|
27373 28773 | *http_request.uri_mut() = "/MalformedInteger/1?integerInQuery=-Infinity"
|
27374 28774 | .parse()
|
27375 28775 | .unwrap();
|
27376 28776 | #[allow(unused_mut)]
|
27377 28777 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27378 28778 | let config = crate::service::RestJsonConfig::builder().build();
|
27379 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28779 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27380 28780 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27381 28781 | let sender = sender.clone();
|
27382 28782 | async move {
|
27383 28783 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27384 28784 | sender.send(()).await.expect("receiver dropped early");
|
27385 28785 | result
|
27386 28786 | }
|
27387 28787 | })
|
27388 28788 | .build_unchecked();
|
27389 28789 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27390 28790 | .await
|
27391 28791 | .expect("unable to make an HTTP request");
|
27392 28792 | ::pretty_assertions::assert_eq!(
|
27393 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28793 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27394 28794 | http_response.status()
|
27395 28795 | );
|
27396 28796 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27397 28797 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27398 28798 | http_response.headers(),
|
27399 28799 | expected_headers,
|
27400 28800 | ));
|
27401 28801 | }
|
27402 28802 | }
|
27403 28803 |
|
27404 28804 | /// Malformed values in query parameters should be rejected
|
27405 28805 | /// Test ID: RestJsonQueryIntegerMalformedValueRejected_case6
|
27406 28806 | #[::tokio::test]
|
27407 28807 | #[::tracing_test::traced_test]
|
27408 28808 | async fn rest_json_query_integer_malformed_value_rejected_case6_malformed_request() {
|
27409 28809 | {
|
27410 28810 | #[allow(unused_mut)]
|
27411 - | let mut http_request = http::Request::builder()
|
28811 + | let mut http_request = ::http_1x::Request::builder()
|
27412 28812 | .uri("/MalformedInteger/1")
|
27413 28813 | .method("POST")
|
27414 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28814 + | .body(::aws_smithy_http_server::body::boxed(
|
28815 + | ::http_body_util::Empty::new(),
|
28816 + | ))
|
27415 28817 | .unwrap();
|
27416 28818 | *http_request.uri_mut() = "/MalformedInteger/1?integerInQuery=NaN".parse().unwrap();
|
27417 28819 | #[allow(unused_mut)]
|
27418 28820 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27419 28821 | let config = crate::service::RestJsonConfig::builder().build();
|
27420 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28822 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27421 28823 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27422 28824 | let sender = sender.clone();
|
27423 28825 | async move {
|
27424 28826 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27425 28827 | sender.send(()).await.expect("receiver dropped early");
|
27426 28828 | result
|
27427 28829 | }
|
27428 28830 | })
|
27429 28831 | .build_unchecked();
|
27430 28832 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27431 28833 | .await
|
27432 28834 | .expect("unable to make an HTTP request");
|
27433 28835 | ::pretty_assertions::assert_eq!(
|
27434 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28836 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27435 28837 | http_response.status()
|
27436 28838 | );
|
27437 28839 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27438 28840 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27439 28841 | http_response.headers(),
|
27440 28842 | expected_headers,
|
27441 28843 | ));
|
27442 28844 | }
|
27443 28845 | }
|
27444 28846 |
|
27445 28847 | /// Malformed values in headers should be rejected
|
27446 28848 | /// Test ID: RestJsonHeaderIntegerMalformedValueRejected_case0
|
27447 28849 | #[::tokio::test]
|
27448 28850 | #[::tracing_test::traced_test]
|
27449 28851 | async fn rest_json_header_integer_malformed_value_rejected_case0_malformed_request() {
|
27450 28852 | {
|
27451 28853 | #[allow(unused_mut)]
|
27452 - | let mut http_request = http::Request::builder()
|
28854 + | let mut http_request = ::http_1x::Request::builder()
|
27453 28855 | .uri("/MalformedInteger/1")
|
27454 28856 | .method("POST")
|
27455 28857 | .header("integerInHeader", "true")
|
27456 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28858 + | .body(::aws_smithy_http_server::body::boxed(
|
28859 + | ::http_body_util::Empty::new(),
|
28860 + | ))
|
27457 28861 | .unwrap();
|
27458 28862 | #[allow(unused_mut)]
|
27459 28863 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27460 28864 | let config = crate::service::RestJsonConfig::builder().build();
|
27461 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28865 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27462 28866 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27463 28867 | let sender = sender.clone();
|
27464 28868 | async move {
|
27465 28869 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27466 28870 | sender.send(()).await.expect("receiver dropped early");
|
27467 28871 | result
|
27468 28872 | }
|
27469 28873 | })
|
27470 28874 | .build_unchecked();
|
27471 28875 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27472 28876 | .await
|
27473 28877 | .expect("unable to make an HTTP request");
|
27474 28878 | ::pretty_assertions::assert_eq!(
|
27475 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28879 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27476 28880 | http_response.status()
|
27477 28881 | );
|
27478 28882 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27479 28883 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27480 28884 | http_response.headers(),
|
27481 28885 | expected_headers,
|
27482 28886 | ));
|
27483 28887 | }
|
27484 28888 | }
|
27485 28889 |
|
27486 28890 | /// Malformed values in headers should be rejected
|
27487 28891 | /// Test ID: RestJsonHeaderIntegerMalformedValueRejected_case1
|
27488 28892 | #[::tokio::test]
|
27489 28893 | #[::tracing_test::traced_test]
|
27490 28894 | async fn rest_json_header_integer_malformed_value_rejected_case1_malformed_request() {
|
27491 28895 | {
|
27492 28896 | #[allow(unused_mut)]
|
27493 - | let mut http_request = http::Request::builder()
|
28897 + | let mut http_request = ::http_1x::Request::builder()
|
27494 28898 | .uri("/MalformedInteger/1")
|
27495 28899 | .method("POST")
|
27496 28900 | .header("integerInHeader", "1.001")
|
27497 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28901 + | .body(::aws_smithy_http_server::body::boxed(
|
28902 + | ::http_body_util::Empty::new(),
|
28903 + | ))
|
27498 28904 | .unwrap();
|
27499 28905 | #[allow(unused_mut)]
|
27500 28906 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27501 28907 | let config = crate::service::RestJsonConfig::builder().build();
|
27502 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28908 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27503 28909 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27504 28910 | let sender = sender.clone();
|
27505 28911 | async move {
|
27506 28912 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27507 28913 | sender.send(()).await.expect("receiver dropped early");
|
27508 28914 | result
|
27509 28915 | }
|
27510 28916 | })
|
27511 28917 | .build_unchecked();
|
27512 28918 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27513 28919 | .await
|
27514 28920 | .expect("unable to make an HTTP request");
|
27515 28921 | ::pretty_assertions::assert_eq!(
|
27516 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28922 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27517 28923 | http_response.status()
|
27518 28924 | );
|
27519 28925 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27520 28926 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27521 28927 | http_response.headers(),
|
27522 28928 | expected_headers,
|
27523 28929 | ));
|
27524 28930 | }
|
27525 28931 | }
|
27526 28932 |
|
27527 28933 | /// Malformed values in headers should be rejected
|
27528 28934 | /// Test ID: RestJsonHeaderIntegerMalformedValueRejected_case2
|
27529 28935 | #[::tokio::test]
|
27530 28936 | #[::tracing_test::traced_test]
|
27531 28937 | async fn rest_json_header_integer_malformed_value_rejected_case2_malformed_request() {
|
27532 28938 | {
|
27533 28939 | #[allow(unused_mut)]
|
27534 - | let mut http_request = http::Request::builder()
|
28940 + | let mut http_request = ::http_1x::Request::builder()
|
27535 28941 | .uri("/MalformedInteger/1")
|
27536 28942 | .method("POST")
|
27537 28943 | .header("integerInHeader", "2ABC")
|
27538 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28944 + | .body(::aws_smithy_http_server::body::boxed(
|
28945 + | ::http_body_util::Empty::new(),
|
28946 + | ))
|
27539 28947 | .unwrap();
|
27540 28948 | #[allow(unused_mut)]
|
27541 28949 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27542 28950 | let config = crate::service::RestJsonConfig::builder().build();
|
27543 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28951 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27544 28952 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27545 28953 | let sender = sender.clone();
|
27546 28954 | async move {
|
27547 28955 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27548 28956 | sender.send(()).await.expect("receiver dropped early");
|
27549 28957 | result
|
27550 28958 | }
|
27551 28959 | })
|
27552 28960 | .build_unchecked();
|
27553 28961 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27554 28962 | .await
|
27555 28963 | .expect("unable to make an HTTP request");
|
27556 28964 | ::pretty_assertions::assert_eq!(
|
27557 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28965 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27558 28966 | http_response.status()
|
27559 28967 | );
|
27560 28968 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27561 28969 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27562 28970 | http_response.headers(),
|
27563 28971 | expected_headers,
|
27564 28972 | ));
|
27565 28973 | }
|
27566 28974 | }
|
27567 28975 |
|
27568 28976 | /// Malformed values in headers should be rejected
|
27569 28977 | /// Test ID: RestJsonHeaderIntegerMalformedValueRejected_case3
|
27570 28978 | #[::tokio::test]
|
27571 28979 | #[::tracing_test::traced_test]
|
27572 28980 | async fn rest_json_header_integer_malformed_value_rejected_case3_malformed_request() {
|
27573 28981 | {
|
27574 28982 | #[allow(unused_mut)]
|
27575 - | let mut http_request = http::Request::builder()
|
28983 + | let mut http_request = ::http_1x::Request::builder()
|
27576 28984 | .uri("/MalformedInteger/1")
|
27577 28985 | .method("POST")
|
27578 28986 | .header("integerInHeader", "0x42")
|
27579 - | .body(::aws_smithy_http_server::body::Body::empty())
|
28987 + | .body(::aws_smithy_http_server::body::boxed(
|
28988 + | ::http_body_util::Empty::new(),
|
28989 + | ))
|
27580 28990 | .unwrap();
|
27581 28991 | #[allow(unused_mut)]
|
27582 28992 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27583 28993 | let config = crate::service::RestJsonConfig::builder().build();
|
27584 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28994 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27585 28995 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27586 28996 | let sender = sender.clone();
|
27587 28997 | async move {
|
27588 28998 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27589 28999 | sender.send(()).await.expect("receiver dropped early");
|
27590 29000 | result
|
27591 29001 | }
|
27592 29002 | })
|
27593 29003 | .build_unchecked();
|
27594 29004 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27595 29005 | .await
|
27596 29006 | .expect("unable to make an HTTP request");
|
27597 29007 | ::pretty_assertions::assert_eq!(
|
27598 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
29008 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27599 29009 | http_response.status()
|
27600 29010 | );
|
27601 29011 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27602 29012 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27603 29013 | http_response.headers(),
|
27604 29014 | expected_headers,
|
27605 29015 | ));
|
27606 29016 | }
|
27607 29017 | }
|
27608 29018 |
|
27609 29019 | /// Malformed values in headers should be rejected
|
27610 29020 | /// Test ID: RestJsonHeaderIntegerMalformedValueRejected_case4
|
27611 29021 | #[::tokio::test]
|
27612 29022 | #[::tracing_test::traced_test]
|
27613 29023 | async fn rest_json_header_integer_malformed_value_rejected_case4_malformed_request() {
|
27614 29024 | {
|
27615 29025 | #[allow(unused_mut)]
|
27616 - | let mut http_request = http::Request::builder()
|
29026 + | let mut http_request = ::http_1x::Request::builder()
|
27617 29027 | .uri("/MalformedInteger/1")
|
27618 29028 | .method("POST")
|
27619 29029 | .header("integerInHeader", "Infinity")
|
27620 - | .body(::aws_smithy_http_server::body::Body::empty())
|
29030 + | .body(::aws_smithy_http_server::body::boxed(
|
29031 + | ::http_body_util::Empty::new(),
|
29032 + | ))
|
27621 29033 | .unwrap();
|
27622 29034 | #[allow(unused_mut)]
|
27623 29035 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27624 29036 | let config = crate::service::RestJsonConfig::builder().build();
|
27625 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29037 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27626 29038 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27627 29039 | let sender = sender.clone();
|
27628 29040 | async move {
|
27629 29041 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27630 29042 | sender.send(()).await.expect("receiver dropped early");
|
27631 29043 | result
|
27632 29044 | }
|
27633 29045 | })
|
27634 29046 | .build_unchecked();
|
27635 29047 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27636 29048 | .await
|
27637 29049 | .expect("unable to make an HTTP request");
|
27638 29050 | ::pretty_assertions::assert_eq!(
|
27639 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
29051 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27640 29052 | http_response.status()
|
27641 29053 | );
|
27642 29054 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27643 29055 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27644 29056 | http_response.headers(),
|
27645 29057 | expected_headers,
|
27646 29058 | ));
|
27647 29059 | }
|
27648 29060 | }
|
27649 29061 |
|
27650 29062 | /// Malformed values in headers should be rejected
|
27651 29063 | /// Test ID: RestJsonHeaderIntegerMalformedValueRejected_case5
|
27652 29064 | #[::tokio::test]
|
27653 29065 | #[::tracing_test::traced_test]
|
27654 29066 | async fn rest_json_header_integer_malformed_value_rejected_case5_malformed_request() {
|
27655 29067 | {
|
27656 29068 | #[allow(unused_mut)]
|
27657 - | let mut http_request = http::Request::builder()
|
29069 + | let mut http_request = ::http_1x::Request::builder()
|
27658 29070 | .uri("/MalformedInteger/1")
|
27659 29071 | .method("POST")
|
27660 29072 | .header("integerInHeader", "-Infinity")
|
27661 - | .body(::aws_smithy_http_server::body::Body::empty())
|
29073 + | .body(::aws_smithy_http_server::body::boxed(
|
29074 + | ::http_body_util::Empty::new(),
|
29075 + | ))
|
27662 29076 | .unwrap();
|
27663 29077 | #[allow(unused_mut)]
|
27664 29078 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27665 29079 | let config = crate::service::RestJsonConfig::builder().build();
|
27666 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29080 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27667 29081 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27668 29082 | let sender = sender.clone();
|
27669 29083 | async move {
|
27670 29084 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27671 29085 | sender.send(()).await.expect("receiver dropped early");
|
27672 29086 | result
|
27673 29087 | }
|
27674 29088 | })
|
27675 29089 | .build_unchecked();
|
27676 29090 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27677 29091 | .await
|
27678 29092 | .expect("unable to make an HTTP request");
|
27679 29093 | ::pretty_assertions::assert_eq!(
|
27680 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
29094 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27681 29095 | http_response.status()
|
27682 29096 | );
|
27683 29097 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27684 29098 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27685 29099 | http_response.headers(),
|
27686 29100 | expected_headers,
|
27687 29101 | ));
|
27688 29102 | }
|
27689 29103 | }
|
27690 29104 |
|
27691 29105 | /// Malformed values in headers should be rejected
|
27692 29106 | /// Test ID: RestJsonHeaderIntegerMalformedValueRejected_case6
|
27693 29107 | #[::tokio::test]
|
27694 29108 | #[::tracing_test::traced_test]
|
27695 29109 | async fn rest_json_header_integer_malformed_value_rejected_case6_malformed_request() {
|
27696 29110 | {
|
27697 29111 | #[allow(unused_mut)]
|
27698 - | let mut http_request = http::Request::builder()
|
29112 + | let mut http_request = ::http_1x::Request::builder()
|
27699 29113 | .uri("/MalformedInteger/1")
|
27700 29114 | .method("POST")
|
27701 29115 | .header("integerInHeader", "NaN")
|
27702 - | .body(::aws_smithy_http_server::body::Body::empty())
|
29116 + | .body(::aws_smithy_http_server::body::boxed(
|
29117 + | ::http_body_util::Empty::new(),
|
29118 + | ))
|
27703 29119 | .unwrap();
|
27704 29120 | #[allow(unused_mut)]
|
27705 29121 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27706 29122 | let config = crate::service::RestJsonConfig::builder().build();
|
27707 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29123 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27708 29124 | .malformed_integer(move |input: crate::input::MalformedIntegerInput| {
|
27709 29125 | let sender = sender.clone();
|
27710 29126 | async move {
|
27711 29127 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as Result<crate::output::MalformedIntegerOutput, crate::error::MalformedIntegerError> };
|
27712 29128 | sender.send(()).await.expect("receiver dropped early");
|
27713 29129 | result
|
27714 29130 | }
|
27715 29131 | })
|
27716 29132 | .build_unchecked();
|
27717 29133 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27718 29134 | .await
|
27719 29135 | .expect("unable to make an HTTP request");
|
27720 29136 | ::pretty_assertions::assert_eq!(
|
27721 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
29137 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27722 29138 | http_response.status()
|
27723 29139 | );
|
27724 29140 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27725 29141 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27726 29142 | http_response.headers(),
|
27727 29143 | expected_headers,
|
27728 29144 | ));
|
27729 29145 | }
|
27730 29146 | }
|
29147 + |
|
29148 + | /* ProtocolTestGenerator.kt:98 */
|
27731 29149 | }
|
27732 29150 |
|
29151 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
27733 29152 | ::pin_project_lite::pin_project! {
|
27734 29153 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
27735 29154 | /// [`MalformedRequestBodyInput`](crate::input::MalformedRequestBodyInput) using modelled bindings.
|
27736 29155 | pub struct MalformedRequestBodyInputFuture {
|
27737 29156 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::MalformedRequestBodyInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
27738 29157 | }
|
27739 29158 | }
|
27740 29159 |
|
27741 29160 | impl std::future::Future for MalformedRequestBodyInputFuture {
|
27742 29161 | type Output = Result<
|
27743 29162 | crate::input::MalformedRequestBodyInput,
|
27744 29163 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
27745 29164 | >;
|
27746 29165 |
|
27747 29166 | fn poll(
|
27748 29167 | self: std::pin::Pin<&mut Self>,
|
27749 29168 | cx: &mut std::task::Context<'_>,
|
27750 29169 | ) -> std::task::Poll<Self::Output> {
|
27751 29170 | let this = self.project();
|
27752 29171 | this.inner.as_mut().poll(cx)
|
27753 29172 | }
|
27754 29173 | }
|
27755 29174 |
|
27756 29175 | impl<B>
|
27757 29176 | ::aws_smithy_http_server::request::FromRequest<
|
27758 29177 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
27759 29178 | B,
|
27760 29179 | > for crate::input::MalformedRequestBodyInput
|
27761 29180 | where
|
27762 29181 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
27763 29182 | B: 'static,
|
27764 29183 |
|
27765 29184 | B::Data: Send,
|
27766 29185 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
27767 29186 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
27768 29187 | {
|
27769 29188 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
27770 29189 | type Future = MalformedRequestBodyInputFuture;
|
27771 29190 |
|
27772 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
29191 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
27773 29192 | let fut = async move {
|
27774 29193 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
27775 29194 | request.headers(),
|
27776 29195 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
27777 29196 | ) {
|
27778 29197 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
27779 29198 | }
|
27780 29199 | crate::protocol_serde::shape_malformed_request_body::de_malformed_request_body_http_request(request)
|
27781 29200 | .await
|
27782 29201 | };
|
27783 29202 | use ::futures_util::future::TryFutureExt;
|
27784 29203 | let fut = fut.map_err(
|
27785 29204 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
27786 29205 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
27787 29206 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
27788 29207 | e,
|
27789 29208 | )
|
27790 29209 | },
|
27791 29210 | );
|
27792 29211 | MalformedRequestBodyInputFuture {
|
27793 29212 | inner: Box::pin(fut),
|
27794 29213 | }
|
27795 29214 | }
|
27796 29215 | }
|
29216 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
27797 29217 | impl
|
27798 29218 | ::aws_smithy_http_server::response::IntoResponse<
|
27799 29219 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
27800 29220 | > for crate::output::MalformedRequestBodyOutput
|
27801 29221 | {
|
27802 29222 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
27803 29223 | match crate::protocol_serde::shape_malformed_request_body::ser_malformed_request_body_http_response(self) {
|
27804 29224 | Ok(response) => response,
|
27805 29225 | Err(e) => {
|
27806 29226 | ::tracing::error!(error = %e, "failed to serialize response");
|
27807 29227 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
27808 29228 | }
|
27809 29229 | }
|
27810 29230 | }
|
27811 29231 | }
|
27812 29232 |
|
29233 + | /* RustType.kt:534 */
|
27813 29234 | #[allow(unreachable_code, unused_variables)]
|
29235 + | /* RustType.kt:534 */
|
27814 29236 | #[cfg(test)]
|
29237 + | /* ProtocolTestGenerator.kt:98 */
|
27815 29238 | mod malformed_request_body_test {
|
27816 29239 |
|
27817 29240 | /// When the request body is not valid JSON, the response should be a 400
|
27818 29241 | /// SerializationException.
|
27819 29242 | /// Test ID: RestJsonInvalidJsonBody_case0
|
27820 29243 | #[::tokio::test]
|
27821 29244 | #[::tracing_test::traced_test]
|
27822 29245 | async fn rest_json_invalid_json_body_case0_malformed_request() {
|
27823 29246 | {
|
27824 29247 | #[allow(unused_mut)]
|
27825 - | let mut http_request = http::Request::builder()
|
29248 + | let mut http_request = ::http_1x::Request::builder()
|
27826 29249 | .uri("/MalformedRequestBody")
|
27827 29250 | .method("POST")
|
27828 29251 | .header("content-type", "application/json")
|
27829 - | .body(::aws_smithy_http_server::body::Body::from(
|
27830 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
27831 - | "{[".as_bytes(),
|
27832 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29252 + | .body(::aws_smithy_http_server::body::boxed(
|
29253 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
29254 + | &::aws_smithy_protocol_test::decode_body_data(
|
29255 + | "{[".as_bytes(),
|
29256 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29257 + | ),
|
27833 29258 | )),
|
27834 29259 | ))
|
27835 29260 | .unwrap();
|
27836 29261 | #[allow(unused_mut)]
|
27837 29262 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27838 29263 | let config = crate::service::RestJsonConfig::builder().build();
|
27839 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29264 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27840 29265 | .malformed_request_body(move |input: crate::input::MalformedRequestBodyInput| {
|
27841 29266 | let sender = sender.clone();
|
27842 29267 | async move {
|
27843 29268 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedRequestBodyOutput };
|
27844 29269 | sender.send(()).await.expect("receiver dropped early");
|
27845 29270 | result
|
27846 29271 | }
|
27847 29272 | })
|
27848 29273 | .build_unchecked();
|
27849 29274 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27850 29275 | .await
|
27851 29276 | .expect("unable to make an HTTP request");
|
27852 29277 | ::pretty_assertions::assert_eq!(
|
27853 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
29278 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27854 29279 | http_response.status()
|
27855 29280 | );
|
27856 29281 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27857 29282 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27858 29283 | http_response.headers(),
|
27859 29284 | expected_headers,
|
27860 29285 | ));
|
27861 29286 | }
|
27862 29287 | }
|
27863 29288 |
|
27864 29289 | /// When the request body is not valid JSON, the response should be a 400
|
27865 29290 | /// SerializationException.
|
27866 29291 | /// Test ID: RestJsonInvalidJsonBody_case1
|
27867 29292 | #[::tokio::test]
|
27868 29293 | #[::tracing_test::traced_test]
|
27869 29294 | async fn rest_json_invalid_json_body_case1_malformed_request() {
|
27870 29295 | {
|
27871 29296 | #[allow(unused_mut)]
|
27872 - | let mut http_request = http::Request::builder()
|
29297 + | let mut http_request = ::http_1x::Request::builder()
|
27873 29298 | .uri("/MalformedRequestBody")
|
27874 29299 | .method("POST")
|
27875 29300 | .header("content-type", "application/json")
|
27876 - | .body(::aws_smithy_http_server::body::Body::from(
|
27877 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
27878 - | "{ \"int\": 10 }abc".as_bytes(),
|
27879 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29301 + | .body(::aws_smithy_http_server::body::boxed(
|
29302 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
29303 + | &::aws_smithy_protocol_test::decode_body_data(
|
29304 + | "{ \"int\": 10 }abc".as_bytes(),
|
29305 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29306 + | ),
|
27880 29307 | )),
|
27881 29308 | ))
|
27882 29309 | .unwrap();
|
27883 29310 | #[allow(unused_mut)]
|
27884 29311 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27885 29312 | let config = crate::service::RestJsonConfig::builder().build();
|
27886 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29313 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27887 29314 | .malformed_request_body(move |input: crate::input::MalformedRequestBodyInput| {
|
27888 29315 | let sender = sender.clone();
|
27889 29316 | async move {
|
27890 29317 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedRequestBodyOutput };
|
27891 29318 | sender.send(()).await.expect("receiver dropped early");
|
27892 29319 | result
|
27893 29320 | }
|
27894 29321 | })
|
27895 29322 | .build_unchecked();
|
27896 29323 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27897 29324 | .await
|
27898 29325 | .expect("unable to make an HTTP request");
|
27899 29326 | ::pretty_assertions::assert_eq!(
|
27900 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
29327 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27901 29328 | http_response.status()
|
27902 29329 | );
|
27903 29330 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27904 29331 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27905 29332 | http_response.headers(),
|
27906 29333 | expected_headers,
|
27907 29334 | ));
|
27908 29335 | }
|
27909 29336 | }
|
27910 29337 |
|
27911 29338 | /// When the request body is not valid JSON, the response should be a 400
|
27912 29339 | /// SerializationException.
|
27913 29340 | /// Test ID: RestJsonInvalidJsonBody_case2
|
27914 29341 | #[::tokio::test]
|
27915 29342 | #[::tracing_test::traced_test]
|
27916 29343 | async fn rest_json_invalid_json_body_case2_malformed_request() {
|
27917 29344 | {
|
27918 29345 | #[allow(unused_mut)]
|
27919 - | let mut http_request = http::Request::builder()
|
29346 + | let mut http_request = ::http_1x::Request::builder()
|
27920 29347 | .uri("/MalformedRequestBody")
|
27921 29348 | .method("POST")
|
27922 29349 | .header("content-type", "application/json")
|
27923 - | .body(::aws_smithy_http_server::body::Body::from(
|
27924 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
27925 - | "abc{ \"int\": 10 }".as_bytes(),
|
27926 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29350 + | .body(::aws_smithy_http_server::body::boxed(
|
29351 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
29352 + | &::aws_smithy_protocol_test::decode_body_data(
|
29353 + | "abc{ \"int\": 10 }".as_bytes(),
|
29354 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29355 + | ),
|
27927 29356 | )),
|
27928 29357 | ))
|
27929 29358 | .unwrap();
|
27930 29359 | #[allow(unused_mut)]
|
27931 29360 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27932 29361 | let config = crate::service::RestJsonConfig::builder().build();
|
27933 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29362 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27934 29363 | .malformed_request_body(move |input: crate::input::MalformedRequestBodyInput| {
|
27935 29364 | let sender = sender.clone();
|
27936 29365 | async move {
|
27937 29366 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedRequestBodyOutput };
|
27938 29367 | sender.send(()).await.expect("receiver dropped early");
|
27939 29368 | result
|
27940 29369 | }
|
27941 29370 | })
|
27942 29371 | .build_unchecked();
|
27943 29372 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27944 29373 | .await
|
27945 29374 | .expect("unable to make an HTTP request");
|
27946 29375 | ::pretty_assertions::assert_eq!(
|
27947 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
29376 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27948 29377 | http_response.status()
|
27949 29378 | );
|
27950 29379 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27951 29380 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27952 29381 | http_response.headers(),
|
27953 29382 | expected_headers,
|
27954 29383 | ));
|
27955 29384 | }
|
27956 29385 | }
|
27957 29386 |
|
27958 29387 | /// When the request body is not valid JSON, the response should be a 400
|
27959 29388 | /// SerializationException.
|
27960 29389 | /// Test ID: RestJsonInvalidJsonBody_case3
|
27961 29390 | #[::tokio::test]
|
27962 29391 | #[::tracing_test::traced_test]
|
27963 29392 | async fn rest_json_invalid_json_body_case3_malformed_request() {
|
27964 29393 | {
|
27965 29394 | #[allow(unused_mut)]
|
27966 - | let mut http_request = http::Request::builder()
|
29395 + | let mut http_request = ::http_1x::Request::builder()
|
27967 29396 | .uri("/MalformedRequestBody")
|
27968 29397 | .method("POST")
|
27969 29398 | .header("content-type", "application/json")
|
27970 - | .body(::aws_smithy_http_server::body::Body::from(
|
27971 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
27972 - | "{\n \"int\": 10 // the integer should be 10\n}".as_bytes(),
|
27973 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29399 + | .body(::aws_smithy_http_server::body::boxed(
|
29400 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
29401 + | &::aws_smithy_protocol_test::decode_body_data(
|
29402 + | "{\n \"int\": 10 // the integer should be 10\n}".as_bytes(),
|
29403 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29404 + | ),
|
27974 29405 | )),
|
27975 29406 | ))
|
27976 29407 | .unwrap();
|
27977 29408 | #[allow(unused_mut)]
|
27978 29409 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
27979 29410 | let config = crate::service::RestJsonConfig::builder().build();
|
27980 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29411 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
27981 29412 | .malformed_request_body(move |input: crate::input::MalformedRequestBodyInput| {
|
27982 29413 | let sender = sender.clone();
|
27983 29414 | async move {
|
27984 29415 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedRequestBodyOutput };
|
27985 29416 | sender.send(()).await.expect("receiver dropped early");
|
27986 29417 | result
|
27987 29418 | }
|
27988 29419 | })
|
27989 29420 | .build_unchecked();
|
27990 29421 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
27991 29422 | .await
|
27992 29423 | .expect("unable to make an HTTP request");
|
27993 29424 | ::pretty_assertions::assert_eq!(
|
27994 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
29425 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
27995 29426 | http_response.status()
|
27996 29427 | );
|
27997 29428 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
27998 29429 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
27999 29430 | http_response.headers(),
|
28000 29431 | expected_headers,
|
28001 29432 | ));
|
28002 29433 | }
|
28003 29434 | }
|
28004 29435 |
|
28005 29436 | /// When the request body is not valid JSON, the response should be a 400
|
28006 29437 | /// SerializationException.
|
28007 29438 | /// Test ID: RestJsonInvalidJsonBody_case4
|
28008 29439 | #[::tokio::test]
|
28009 29440 | #[::tracing_test::traced_test]
|
28010 29441 | async fn rest_json_invalid_json_body_case4_malformed_request() {
|
28011 29442 | {
|
28012 29443 | #[allow(unused_mut)]
|
28013 - | let mut http_request = http::Request::builder()
|
29444 + | let mut http_request = ::http_1x::Request::builder()
|
28014 29445 | .uri("/MalformedRequestBody")
|
28015 29446 | .method("POST")
|
28016 29447 | .header("content-type", "application/json")
|
28017 - | .body(::aws_smithy_http_server::body::Body::from(
|
28018 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
28019 - | "{\n \"int\": 10 /* the integer should be 10 */\n}".as_bytes(),
|
28020 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29448 + | .body(::aws_smithy_http_server::body::boxed(
|
29449 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
29450 + | &::aws_smithy_protocol_test::decode_body_data(
|
29451 + | "{\n \"int\": 10 /* the integer should be 10 */\n}".as_bytes(),
|
29452 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29453 + | ),
|
28021 29454 | )),
|
28022 29455 | ))
|
28023 29456 | .unwrap();
|
28024 29457 | #[allow(unused_mut)]
|
28025 29458 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
28026 29459 | let config = crate::service::RestJsonConfig::builder().build();
|
28027 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29460 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
28028 29461 | .malformed_request_body(move |input: crate::input::MalformedRequestBodyInput| {
|
28029 29462 | let sender = sender.clone();
|
28030 29463 | async move {
|
28031 29464 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedRequestBodyOutput };
|
28032 29465 | sender.send(()).await.expect("receiver dropped early");
|
28033 29466 | result
|
28034 29467 | }
|
28035 29468 | })
|
28036 29469 | .build_unchecked();
|
28037 29470 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
28038 29471 | .await
|
28039 29472 | .expect("unable to make an HTTP request");
|
28040 29473 | ::pretty_assertions::assert_eq!(
|
28041 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
29474 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28042 29475 | http_response.status()
|
28043 29476 | );
|
28044 29477 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
28045 29478 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
28046 29479 | http_response.headers(),
|
28047 29480 | expected_headers,
|
28048 29481 | ));
|
28049 29482 | }
|
28050 29483 | }
|
28051 29484 |
|
28052 29485 | /// When the request body is not valid JSON, the response should be a 400
|
28053 29486 | /// SerializationException.
|
28054 29487 | /// Test ID: RestJsonInvalidJsonBody_case5
|
28055 29488 | #[::tokio::test]
|
28056 29489 | #[::tracing_test::traced_test]
|
28057 29490 | async fn rest_json_invalid_json_body_case5_malformed_request() {
|
28058 29491 | {
|
28059 29492 | #[allow(unused_mut)]
|
28060 - | let mut http_request = http::Request::builder()
|
29493 + | let mut http_request = ::http_1x::Request::builder()
|
28061 29494 | .uri("/MalformedRequestBody")
|
28062 29495 | .method("POST")
|
28063 29496 | .header("content-type", "application/json")
|
28064 - | .body(::aws_smithy_http_server::body::Body::from(
|
28065 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
28066 - | "{\"int\" :\\u{000c}10}".as_bytes(),
|
28067 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29497 + | .body(::aws_smithy_http_server::body::boxed(
|
29498 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
29499 + | &::aws_smithy_protocol_test::decode_body_data(
|
29500 + | "{\"int\" :\\u{000c}10}".as_bytes(),
|
29501 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29502 + | ),
|
28068 29503 | )),
|
28069 29504 | ))
|
28070 29505 | .unwrap();
|
28071 29506 | #[allow(unused_mut)]
|
28072 29507 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
28073 29508 | let config = crate::service::RestJsonConfig::builder().build();
|
28074 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29509 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
28075 29510 | .malformed_request_body(move |input: crate::input::MalformedRequestBodyInput| {
|
28076 29511 | let sender = sender.clone();
|
28077 29512 | async move {
|
28078 29513 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedRequestBodyOutput };
|
28079 29514 | sender.send(()).await.expect("receiver dropped early");
|
28080 29515 | result
|
28081 29516 | }
|
28082 29517 | })
|
28083 29518 | .build_unchecked();
|
28084 29519 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
28085 29520 | .await
|
28086 29521 | .expect("unable to make an HTTP request");
|
28087 29522 | ::pretty_assertions::assert_eq!(
|
28088 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
29523 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28089 29524 | http_response.status()
|
28090 29525 | );
|
28091 29526 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
28092 29527 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
28093 29528 | http_response.headers(),
|
28094 29529 | expected_headers,
|
28095 29530 | ));
|
28096 29531 | }
|
28097 29532 | }
|
28098 29533 |
|
28099 29534 | /// When the request body is not valid JSON, the response should be a 400
|
28100 29535 | /// SerializationException.
|
28101 29536 | /// Test ID: RestJsonInvalidJsonBody_case6
|
28102 29537 | #[::tokio::test]
|
28103 29538 | #[::tracing_test::traced_test]
|
28104 29539 | async fn rest_json_invalid_json_body_case6_malformed_request() {
|
28105 29540 | {
|
28106 29541 | #[allow(unused_mut)]
|
28107 - | let mut http_request = http::Request::builder()
|
29542 + | let mut http_request = ::http_1x::Request::builder()
|
28108 29543 | .uri("/MalformedRequestBody")
|
28109 29544 | .method("POST")
|
28110 29545 | .header("content-type", "application/json")
|
28111 - | .body(::aws_smithy_http_server::body::Body::from(
|
28112 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
28113 - | "{'int': 10}".as_bytes(),
|
28114 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29546 + | .body(::aws_smithy_http_server::body::boxed(
|
29547 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
29548 + | &::aws_smithy_protocol_test::decode_body_data(
|
29549 + | "{'int': 10}".as_bytes(),
|
29550 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29551 + | ),
|
28115 29552 | )),
|
28116 29553 | ))
|
28117 29554 | .unwrap();
|
28118 29555 | #[allow(unused_mut)]
|
28119 29556 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
28120 29557 | let config = crate::service::RestJsonConfig::builder().build();
|
28121 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29558 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
28122 29559 | .malformed_request_body(move |input: crate::input::MalformedRequestBodyInput| {
|
28123 29560 | let sender = sender.clone();
|
28124 29561 | async move {
|
28125 29562 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedRequestBodyOutput };
|
28126 29563 | sender.send(()).await.expect("receiver dropped early");
|
28127 29564 | result
|
28128 29565 | }
|
28129 29566 | })
|
28130 29567 | .build_unchecked();
|
28131 29568 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
28132 29569 | .await
|
28133 29570 | .expect("unable to make an HTTP request");
|
28134 29571 | ::pretty_assertions::assert_eq!(
|
28135 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
29572 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28136 29573 | http_response.status()
|
28137 29574 | );
|
28138 29575 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
28139 29576 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
28140 29577 | http_response.headers(),
|
28141 29578 | expected_headers,
|
28142 29579 | ));
|
28143 29580 | }
|
28144 29581 | }
|
28145 29582 |
|
28146 29583 | /// When the request body is not valid JSON, the response should be a 400
|
28147 29584 | /// SerializationException.
|
28148 29585 | /// Test ID: RestJsonInvalidJsonBody_case7
|
28149 29586 | #[::tokio::test]
|
28150 29587 | #[::tracing_test::traced_test]
|
28151 29588 | async fn rest_json_invalid_json_body_case7_malformed_request() {
|
28152 29589 | {
|
28153 29590 | #[allow(unused_mut)]
|
28154 - | let mut http_request = http::Request::builder()
|
29591 + | let mut http_request = ::http_1x::Request::builder()
|
28155 29592 | .uri("/MalformedRequestBody")
|
28156 29593 | .method("POST")
|
28157 29594 | .header("content-type", "application/json")
|
28158 - | .body(::aws_smithy_http_server::body::Body::from(
|
28159 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
28160 - | "{\"int\": 10,}".as_bytes(),
|
28161 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29595 + | .body(::aws_smithy_http_server::body::boxed(
|
29596 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
29597 + | &::aws_smithy_protocol_test::decode_body_data(
|
29598 + | "{\"int\": 10,}".as_bytes(),
|
29599 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29600 + | ),
|
28162 29601 | )),
|
28163 29602 | ))
|
28164 29603 | .unwrap();
|
28165 29604 | #[allow(unused_mut)]
|
28166 29605 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
28167 29606 | let config = crate::service::RestJsonConfig::builder().build();
|
28168 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29607 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
28169 29608 | .malformed_request_body(move |input: crate::input::MalformedRequestBodyInput| {
|
28170 29609 | let sender = sender.clone();
|
28171 29610 | async move {
|
28172 29611 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedRequestBodyOutput };
|
28173 29612 | sender.send(()).await.expect("receiver dropped early");
|
28174 29613 | result
|
28175 29614 | }
|
28176 29615 | })
|
28177 29616 | .build_unchecked();
|
28178 29617 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
28179 29618 | .await
|
28180 29619 | .expect("unable to make an HTTP request");
|
28181 29620 | ::pretty_assertions::assert_eq!(
|
28182 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
29621 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28183 29622 | http_response.status()
|
28184 29623 | );
|
28185 29624 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
28186 29625 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
28187 29626 | http_response.headers(),
|
28188 29627 | expected_headers,
|
28189 29628 | ));
|
28190 29629 | }
|
28191 29630 | }
|
28192 29631 |
|
28193 29632 | /// When the request body is technically valid, but cannot map to a Smithy structure,
|
28194 29633 | /// the response should be a 400 SerializationException.
|
28195 29634 | /// Test ID: RestJsonTechnicallyValidJsonBody_case0
|
28196 29635 | #[::tokio::test]
|
28197 29636 | #[::tracing_test::traced_test]
|
28198 29637 | async fn rest_json_technically_valid_json_body_case0_malformed_request() {
|
28199 29638 | {
|
28200 29639 | #[allow(unused_mut)]
|
28201 - | let mut http_request = http::Request::builder()
|
29640 + | let mut http_request = ::http_1x::Request::builder()
|
28202 29641 | .uri("/MalformedRequestBody")
|
28203 29642 | .method("POST")
|
28204 29643 | .header("content-type", "application/json")
|
28205 - | .body(::aws_smithy_http_server::body::Body::from(
|
28206 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
28207 - | "[{ \"int\": 10}]".as_bytes(),
|
28208 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29644 + | .body(::aws_smithy_http_server::body::boxed(
|
29645 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
29646 + | &::aws_smithy_protocol_test::decode_body_data(
|
29647 + | "[{ \"int\": 10}]".as_bytes(),
|
29648 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29649 + | ),
|
28209 29650 | )),
|
28210 29651 | ))
|
28211 29652 | .unwrap();
|
28212 29653 | #[allow(unused_mut)]
|
28213 29654 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
28214 29655 | let config = crate::service::RestJsonConfig::builder().build();
|
28215 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29656 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
28216 29657 | .malformed_request_body(move |input: crate::input::MalformedRequestBodyInput| {
|
28217 29658 | let sender = sender.clone();
|
28218 29659 | async move {
|
28219 29660 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedRequestBodyOutput };
|
28220 29661 | sender.send(()).await.expect("receiver dropped early");
|
28221 29662 | result
|
28222 29663 | }
|
28223 29664 | })
|
28224 29665 | .build_unchecked();
|
28225 29666 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
28226 29667 | .await
|
28227 29668 | .expect("unable to make an HTTP request");
|
28228 29669 | ::pretty_assertions::assert_eq!(
|
28229 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
29670 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28230 29671 | http_response.status()
|
28231 29672 | );
|
28232 29673 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
28233 29674 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
28234 29675 | http_response.headers(),
|
28235 29676 | expected_headers,
|
28236 29677 | ));
|
28237 29678 | }
|
28238 29679 | }
|
28239 29680 |
|
28240 29681 | /// When the request body is technically valid, but cannot map to a Smithy structure,
|
28241 29682 | /// the response should be a 400 SerializationException.
|
28242 29683 | /// Test ID: RestJsonTechnicallyValidJsonBody_case1
|
28243 29684 | #[::tokio::test]
|
28244 29685 | #[::tracing_test::traced_test]
|
28245 29686 | async fn rest_json_technically_valid_json_body_case1_malformed_request() {
|
28246 29687 | {
|
28247 29688 | #[allow(unused_mut)]
|
28248 - | let mut http_request = http::Request::builder()
|
29689 + | let mut http_request = ::http_1x::Request::builder()
|
28249 29690 | .uri("/MalformedRequestBody")
|
28250 29691 | .method("POST")
|
28251 29692 | .header("content-type", "application/json")
|
28252 - | .body(::aws_smithy_http_server::body::Body::from(
|
28253 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
28254 - | "10".as_bytes(),
|
28255 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29693 + | .body(::aws_smithy_http_server::body::boxed(
|
29694 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
29695 + | &::aws_smithy_protocol_test::decode_body_data(
|
29696 + | "10".as_bytes(),
|
29697 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29698 + | ),
|
28256 29699 | )),
|
28257 29700 | ))
|
28258 29701 | .unwrap();
|
28259 29702 | #[allow(unused_mut)]
|
28260 29703 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
28261 29704 | let config = crate::service::RestJsonConfig::builder().build();
|
28262 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29705 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
28263 29706 | .malformed_request_body(move |input: crate::input::MalformedRequestBodyInput| {
|
28264 29707 | let sender = sender.clone();
|
28265 29708 | async move {
|
28266 29709 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedRequestBodyOutput };
|
28267 29710 | sender.send(()).await.expect("receiver dropped early");
|
28268 29711 | result
|
28269 29712 | }
|
28270 29713 | })
|
28271 29714 | .build_unchecked();
|
28272 29715 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
28273 29716 | .await
|
28274 29717 | .expect("unable to make an HTTP request");
|
28275 29718 | ::pretty_assertions::assert_eq!(
|
28276 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
29719 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28277 29720 | http_response.status()
|
28278 29721 | );
|
28279 29722 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
28280 29723 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
28281 29724 | http_response.headers(),
|
28282 29725 | expected_headers,
|
28283 29726 | ));
|
28284 29727 | }
|
28285 29728 | }
|
28286 29729 |
|
28287 29730 | /// When the request body is technically valid, but cannot map to a Smithy structure,
|
28288 29731 | /// the response should be a 400 SerializationException.
|
28289 29732 | /// Test ID: RestJsonTechnicallyValidJsonBody_case2
|
28290 29733 | #[::tokio::test]
|
28291 29734 | #[::tracing_test::traced_test]
|
28292 29735 | async fn rest_json_technically_valid_json_body_case2_malformed_request() {
|
28293 29736 | {
|
28294 29737 | #[allow(unused_mut)]
|
28295 - | let mut http_request = http::Request::builder()
|
29738 + | let mut http_request = ::http_1x::Request::builder()
|
28296 29739 | .uri("/MalformedRequestBody")
|
28297 29740 | .method("POST")
|
28298 29741 | .header("content-type", "application/json")
|
28299 - | .body(::aws_smithy_http_server::body::Body::from(
|
28300 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
28301 - | "null".as_bytes(),
|
28302 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29742 + | .body(::aws_smithy_http_server::body::boxed(
|
29743 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
29744 + | &::aws_smithy_protocol_test::decode_body_data(
|
29745 + | "null".as_bytes(),
|
29746 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
29747 + | ),
|
28303 29748 | )),
|
28304 29749 | ))
|
28305 29750 | .unwrap();
|
28306 29751 | #[allow(unused_mut)]
|
28307 29752 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
28308 29753 | let config = crate::service::RestJsonConfig::builder().build();
|
28309 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29754 + | let service = crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(config)
|
28310 29755 | .malformed_request_body(move |input: crate::input::MalformedRequestBodyInput| {
|
28311 29756 | let sender = sender.clone();
|
28312 29757 | async move {
|
28313 29758 | let result = { panic!("request should have been rejected, but we accepted it; we parsed operation input `{:?}`", &input) as crate::output::MalformedRequestBodyOutput };
|
28314 29759 | sender.send(()).await.expect("receiver dropped early");
|
28315 29760 | result
|
28316 29761 | }
|
28317 29762 | })
|
28318 29763 | .build_unchecked();
|
28319 29764 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
28320 29765 | .await
|
28321 29766 | .expect("unable to make an HTTP request");
|
28322 29767 | ::pretty_assertions::assert_eq!(
|
28323 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
29768 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
28324 29769 | http_response.status()
|
28325 29770 | );
|
28326 29771 | let expected_headers = [("x-amzn-errortype", "SerializationException")];
|
28327 29772 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
28328 29773 | http_response.headers(),
|
28329 29774 | expected_headers,
|
28330 29775 | ));
|
28331 29776 | }
|
28332 29777 | }
|
29778 + |
|
29779 + | /* ProtocolTestGenerator.kt:98 */
|
28333 29780 | }
|
28334 29781 |
|
29782 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
28335 29783 | ::pin_project_lite::pin_project! {
|
28336 29784 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
28337 29785 | /// [`HttpChecksumRequiredInput`](crate::input::HttpChecksumRequiredInput) using modelled bindings.
|
28338 29786 | pub struct HttpChecksumRequiredInputFuture {
|
28339 29787 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::HttpChecksumRequiredInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
28340 29788 | }
|
28341 29789 | }
|
28342 29790 |
|
28343 29791 | impl std::future::Future for HttpChecksumRequiredInputFuture {
|
28344 29792 | type Output = Result<
|
28345 29793 | crate::input::HttpChecksumRequiredInput,
|
28346 29794 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
28347 29795 | >;
|
28348 29796 |
|
28349 29797 | fn poll(
|
28350 29798 | self: std::pin::Pin<&mut Self>,
|
28351 29799 | cx: &mut std::task::Context<'_>,
|
28352 29800 | ) -> std::task::Poll<Self::Output> {
|
28353 29801 | let this = self.project();
|
28354 29802 | this.inner.as_mut().poll(cx)
|
28355 29803 | }
|
28356 29804 | }
|
28357 29805 |
|
28358 29806 | impl<B>
|
28359 29807 | ::aws_smithy_http_server::request::FromRequest<
|
28360 29808 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
28361 29809 | B,
|
28362 29810 | > for crate::input::HttpChecksumRequiredInput
|
28363 29811 | where
|
28364 29812 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
28365 29813 | B: 'static,
|
28366 29814 |
|
28367 29815 | B::Data: Send,
|
28368 29816 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
28369 29817 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
28370 29818 | {
|
28371 29819 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
28372 29820 | type Future = HttpChecksumRequiredInputFuture;
|
28373 29821 |
|
28374 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
29822 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
28375 29823 | let fut = async move {
|
28376 29824 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
28377 29825 | request.headers(),
|
28378 29826 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
28379 29827 | ) {
|
28380 29828 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
28381 29829 | }
|
28382 29830 | crate::protocol_serde::shape_http_checksum_required::de_http_checksum_required_http_request(request)
|
28383 29831 | .await
|
28384 29832 | };
|
28385 29833 | use ::futures_util::future::TryFutureExt;
|
28386 29834 | let fut = fut.map_err(
|
28387 29835 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
28388 29836 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
28389 29837 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
28390 29838 | e,
|
28391 29839 | )
|
28392 29840 | },
|
28393 29841 | );
|
28394 29842 | HttpChecksumRequiredInputFuture {
|
28395 29843 | inner: Box::pin(fut),
|
28396 29844 | }
|
28397 29845 | }
|
28398 29846 | }
|
29847 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
28399 29848 | impl
|
28400 29849 | ::aws_smithy_http_server::response::IntoResponse<
|
28401 29850 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
28402 29851 | > for crate::output::HttpChecksumRequiredOutput
|
28403 29852 | {
|
28404 29853 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
28405 29854 | match crate::protocol_serde::shape_http_checksum_required::ser_http_checksum_required_http_response(self) {
|
28406 29855 | Ok(response) => response,
|
28407 29856 | Err(e) => {
|
28408 29857 | ::tracing::error!(error = %e, "failed to serialize response");
|
28409 29858 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
28410 29859 | }
|
28411 29860 | }
|
28412 29861 | }
|
28413 29862 | }
|
28414 29863 |
|
29864 + | /* RustType.kt:534 */
|
28415 29865 | #[allow(unreachable_code, unused_variables)]
|
29866 + | /* RustType.kt:534 */
|
28416 29867 | #[cfg(test)]
|
29868 + | /* ProtocolTestGenerator.kt:98 */
|
28417 29869 | mod http_checksum_required_test {
|
28418 29870 |
|
28419 29871 | /// Adds Content-MD5 header
|
28420 29872 | /// Test ID: RestJsonHttpChecksumRequired
|
28421 29873 | #[::tokio::test]
|
28422 29874 | #[::tracing_test::traced_test]
|
28423 29875 | async fn rest_json_http_checksum_required_request() {
|
28424 29876 | #[allow(unused_mut)]
|
28425 - | let mut http_request = http::Request::builder()
|
29877 + | let mut http_request = ::http_1x::Request::builder()
|
28426 29878 | .uri("/HttpChecksumRequired")
|
28427 29879 | .method("POST")
|
28428 29880 | .header("Content-MD5", "iB0/3YSo7maijL0IGOgA9g==")
|
28429 29881 | .header("Content-Type", "application/json")
|
28430 - | .body(::aws_smithy_http_server::body::Body::from(
|
28431 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
28432 - | "{\n \"foo\":\"base64 encoded md5 checksum\"\n}\n".as_bytes(),
|
28433 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
29882 + | .body(::aws_smithy_http_server::body::boxed(
|
29883 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
29884 + | &::aws_smithy_protocol_test::decode_body_data(
|
29885 + | "{\n \"foo\":\"base64 encoded md5 checksum\"\n}\n".as_bytes(),
|
29886 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
29887 + | ),
|
28434 29888 | )),
|
28435 29889 | ))
|
28436 29890 | .unwrap();
|
28437 29891 | #[allow(unused_mut)]
|
28438 29892 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
28439 29893 | let config = crate::service::RestJsonConfig::builder().build();
|
28440 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
28441 - | .http_checksum_required(move |input: crate::input::HttpChecksumRequiredInput| {
|
28442 - | let sender = sender.clone();
|
28443 - | async move {
|
28444 - | let result = {
|
28445 - | let expected = crate::input::HttpChecksumRequiredInput {
|
28446 - | foo: ::std::option::Option::Some(
|
28447 - | "base64 encoded md5 checksum".to_owned(),
|
28448 - | ),
|
28449 - | };
|
28450 - | ::pretty_assertions::assert_eq!(input, expected);
|
28451 - | let output = crate::output::HttpChecksumRequiredOutput {
|
28452 - | foo: ::std::option::Option::None,
|
28453 - | };
|
28454 - | output
|
29894 + | let service = crate::service::RestJson::builder::<
|
29895 + | ::aws_smithy_http_server::body::BoxBody,
|
29896 + | _,
|
29897 + | _,
|
29898 + | _,
|
29899 + | >(config)
|
29900 + | .http_checksum_required(move |input: crate::input::HttpChecksumRequiredInput| {
|
29901 + | let sender = sender.clone();
|
29902 + | async move {
|
29903 + | let result = {
|
29904 + | let expected = crate::input::HttpChecksumRequiredInput {
|
29905 + | foo: ::std::option::Option::Some("base64 encoded md5 checksum".to_owned()),
|
28455 29906 | };
|
28456 - | sender.send(()).await.expect("receiver dropped early");
|
28457 - | result
|
28458 - | }
|
28459 - | })
|
28460 - | .build_unchecked();
|
29907 + | ::pretty_assertions::assert_eq!(input, expected);
|
29908 + | let output = crate::output::HttpChecksumRequiredOutput {
|
29909 + | foo: ::std::option::Option::None,
|
29910 + | };
|
29911 + | output
|
29912 + | };
|
29913 + | sender.send(()).await.expect("receiver dropped early");
|
29914 + | result
|
29915 + | }
|
29916 + | })
|
29917 + | .build_unchecked();
|
28461 29918 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
28462 29919 | .await
|
28463 29920 | .expect("unable to make an HTTP request");
|
28464 29921 | assert!(
|
28465 29922 | receiver.recv().await.is_some(),
|
28466 29923 | "we expected operation handler to be invoked but it was not entered"
|
28467 29924 | );
|
28468 29925 | }
|
29926 + |
|
29927 + | /* ProtocolTestGenerator.kt:98 */
|
28469 29928 | }
|
28470 29929 |
|
29930 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
28471 29931 | ::pin_project_lite::pin_project! {
|
28472 29932 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
28473 29933 | /// [`HostWithPathOperationInput`](crate::input::HostWithPathOperationInput) using modelled bindings.
|
28474 29934 | pub struct HostWithPathOperationInputFuture {
|
28475 29935 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::HostWithPathOperationInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
28476 29936 | }
|
28477 29937 | }
|
28478 29938 |
|
28479 29939 | impl std::future::Future for HostWithPathOperationInputFuture {
|
28480 29940 | type Output = Result<
|
28481 29941 | crate::input::HostWithPathOperationInput,
|
28482 29942 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
28483 29943 | >;
|
28484 29944 |
|
28485 29945 | fn poll(
|
28486 29946 | self: std::pin::Pin<&mut Self>,
|
28487 29947 | cx: &mut std::task::Context<'_>,
|
28488 29948 | ) -> std::task::Poll<Self::Output> {
|
28489 29949 | let this = self.project();
|
28490 29950 | this.inner.as_mut().poll(cx)
|
28491 29951 | }
|
28492 29952 | }
|
28493 29953 |
|
28494 29954 | impl<B>
|
28495 29955 | ::aws_smithy_http_server::request::FromRequest<
|
28496 29956 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
28497 29957 | B,
|
28498 29958 | > for crate::input::HostWithPathOperationInput
|
28499 29959 | where
|
28500 29960 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
28501 29961 | B: 'static,
|
28502 29962 |
|
28503 29963 | B::Data: Send,
|
28504 29964 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
28505 29965 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
28506 29966 | {
|
28507 29967 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
28508 29968 | type Future = HostWithPathOperationInputFuture;
|
28509 29969 |
|
28510 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
29970 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
28511 29971 | let fut = async move {
|
28512 29972 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
28513 29973 | request.headers(),
|
28514 29974 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
28515 29975 | ) {
|
28516 29976 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
28517 29977 | }
|
28518 29978 | crate::protocol_serde::shape_host_with_path_operation::de_host_with_path_operation_http_request(request)
|
28519 29979 | .await
|
28520 29980 | };
|
28521 29981 | use ::futures_util::future::TryFutureExt;
|
28522 29982 | let fut = fut.map_err(
|
28523 29983 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
28524 29984 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
28525 29985 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
28526 29986 | e,
|
28527 29987 | )
|
28528 29988 | },
|
28529 29989 | );
|
28530 29990 | HostWithPathOperationInputFuture {
|
28531 29991 | inner: Box::pin(fut),
|
28532 29992 | }
|
28533 29993 | }
|
28534 29994 | }
|
29995 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
28535 29996 | impl
|
28536 29997 | ::aws_smithy_http_server::response::IntoResponse<
|
28537 29998 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
28538 29999 | > for crate::output::HostWithPathOperationOutput
|
28539 30000 | {
|
28540 30001 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
28541 30002 | match crate::protocol_serde::shape_host_with_path_operation::ser_host_with_path_operation_http_response(self) {
|
28542 30003 | Ok(response) => response,
|
28543 30004 | Err(e) => {
|
28544 30005 | ::tracing::error!(error = %e, "failed to serialize response");
|
28545 30006 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
28546 30007 | }
|
28547 30008 | }
|
28548 30009 | }
|
28549 30010 | }
|
28550 30011 |
|
30012 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
28551 30013 | ::pin_project_lite::pin_project! {
|
28552 30014 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
28553 30015 | /// [`EndpointWithHostLabelOperationInput`](crate::input::EndpointWithHostLabelOperationInput) using modelled bindings.
|
28554 30016 | pub struct EndpointWithHostLabelOperationInputFuture {
|
28555 30017 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EndpointWithHostLabelOperationInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
28556 30018 | }
|
28557 30019 | }
|
28558 30020 |
|
28559 30021 | impl std::future::Future for EndpointWithHostLabelOperationInputFuture {
|
28560 30022 | type Output = Result<
|
28561 30023 | crate::input::EndpointWithHostLabelOperationInput,
|
28562 30024 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
28563 30025 | >;
|
28564 30026 |
|
28565 30027 | fn poll(
|
28566 30028 | self: std::pin::Pin<&mut Self>,
|
28567 30029 | cx: &mut std::task::Context<'_>,
|
28568 30030 | ) -> std::task::Poll<Self::Output> {
|
28569 30031 | let this = self.project();
|
28570 30032 | this.inner.as_mut().poll(cx)
|
28571 30033 | }
|
28572 30034 | }
|
28573 30035 |
|
28574 30036 | impl<B>
|
28575 30037 | ::aws_smithy_http_server::request::FromRequest<
|
28576 30038 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
28577 30039 | B,
|
28578 30040 | > for crate::input::EndpointWithHostLabelOperationInput
|
28579 30041 | where
|
28580 30042 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
28581 30043 | B: 'static,
|
28582 30044 |
|
28583 30045 | B::Data: Send,
|
28584 30046 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
28585 30047 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
28586 30048 | {
|
28587 30049 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
28588 30050 | type Future = EndpointWithHostLabelOperationInputFuture;
|
28589 30051 |
|
28590 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
30052 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
28591 30053 | let fut = async move {
|
28592 30054 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
28593 30055 | request.headers(),
|
28594 30056 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
28595 30057 | ) {
|
28596 30058 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
28597 30059 | }
|
28598 30060 | crate::protocol_serde::shape_endpoint_with_host_label_operation::de_endpoint_with_host_label_operation_http_request(request)
|
28599 30061 | .await
|
28600 30062 | };
|
28601 30063 | use ::futures_util::future::TryFutureExt;
|
28602 30064 | let fut = fut.map_err(
|
28603 30065 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
28604 30066 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
28605 30067 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
28606 30068 | e,
|
28607 30069 | )
|
28608 30070 | },
|
28609 30071 | );
|
28610 30072 | EndpointWithHostLabelOperationInputFuture {
|
28611 30073 | inner: Box::pin(fut),
|
28612 30074 | }
|
28613 30075 | }
|
28614 30076 | }
|
30077 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
28615 30078 | impl
|
28616 30079 | ::aws_smithy_http_server::response::IntoResponse<
|
28617 30080 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
28618 30081 | > for crate::output::EndpointWithHostLabelOperationOutput
|
28619 30082 | {
|
28620 30083 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
28621 30084 | match crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_http_response(self) {
|
28622 30085 | Ok(response) => response,
|
28623 30086 | Err(e) => {
|
28624 30087 | ::tracing::error!(error = %e, "failed to serialize response");
|
28625 30088 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
28626 30089 | }
|
28627 30090 | }
|
28628 30091 | }
|
28629 30092 | }
|
30093 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
28630 30094 | impl
|
28631 30095 | ::aws_smithy_http_server::response::IntoResponse<
|
28632 30096 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
28633 30097 | > for crate::error::EndpointWithHostLabelOperationError
|
28634 30098 | {
|
28635 30099 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
28636 30100 | match crate::protocol_serde::shape_endpoint_with_host_label_operation::ser_endpoint_with_host_label_operation_http_error(&self) {
|
28637 30101 | Ok(mut response) => {
|
28638 30102 | response.extensions_mut().insert(::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()));
|
28639 30103 | response
|
28640 30104 | },
|
28641 30105 | Err(e) => {
|
28642 30106 | ::tracing::error!(error = %e, "failed to serialize response");
|
28643 30107 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
28644 30108 | }
|
28645 30109 | }
|
28646 30110 | }
|
28647 30111 | }
|
28648 30112 |
|
30113 + | /* RustType.kt:534 */
|
28649 30114 | #[allow(unreachable_code, unused_variables)]
|
30115 + | /* RustType.kt:534 */
|
28650 30116 | #[cfg(test)]
|
30117 + | /* ProtocolTestGenerator.kt:98 */
|
28651 30118 | mod endpoint_with_host_label_operation_test {
|
28652 30119 |
|
28653 30120 | /// Operations can prepend to the given host if they define the
|
28654 30121 | /// endpoint trait, and can use the host label trait to define
|
28655 30122 | /// further customization based on user input.
|
28656 30123 | /// Test ID: RestJsonEndpointTraitWithHostLabel
|
28657 30124 | #[::tokio::test]
|
28658 30125 | #[::tracing_test::traced_test]
|
28659 30126 | #[should_panic]
|
28660 30127 | async fn rest_json_endpoint_trait_with_host_label_request() {
|
28661 30128 | #[allow(unused_mut)]
|
28662 - | let mut http_request = http::Request::builder()
|
30129 + | let mut http_request = ::http_1x::Request::builder()
|
28663 30130 | .uri("/EndpointWithHostLabelOperation")
|
28664 30131 | .method("POST")
|
28665 - | .body(::aws_smithy_http_server::body::Body::from(
|
28666 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
28667 - | "{\"label\": \"bar\"}".as_bytes(),
|
28668 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30132 + | .body(::aws_smithy_http_server::body::boxed(
|
30133 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
30134 + | &::aws_smithy_protocol_test::decode_body_data(
|
30135 + | "{\"label\": \"bar\"}".as_bytes(),
|
30136 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30137 + | ),
|
28669 30138 | )),
|
28670 30139 | ))
|
28671 30140 | .unwrap();
|
28672 30141 | todo!("endpoint trait not supported yet");
|
28673 30142 | #[allow(unused_mut)]
|
28674 30143 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
28675 30144 | let config = crate::service::RestJsonConfig::builder().build();
|
28676 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
30145 + | let service =
|
30146 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
30147 + | config,
|
30148 + | )
|
28677 30149 | .endpoint_with_host_label_operation(
|
28678 30150 | move |input: crate::input::EndpointWithHostLabelOperationInput| {
|
28679 30151 | let sender = sender.clone();
|
28680 30152 | async move {
|
28681 30153 | let result = {
|
28682 30154 | let expected = crate::input::EndpointWithHostLabelOperationInput {
|
28683 30155 | label: "bar".to_owned(),
|
28684 30156 | };
|
28685 30157 | ::pretty_assertions::assert_eq!(input, expected);
|
28686 30158 | let output = crate::output::EndpointWithHostLabelOperationOutput {};
|
28687 30159 | Ok(output)
|
28688 30160 | };
|
28689 30161 | sender.send(()).await.expect("receiver dropped early");
|
28690 30162 | result
|
28691 30163 | }
|
28692 30164 | },
|
28693 30165 | )
|
28694 30166 | .build_unchecked();
|
28695 30167 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
28696 30168 | .await
|
28697 30169 | .expect("unable to make an HTTP request");
|
28698 30170 | assert!(
|
28699 30171 | receiver.recv().await.is_some(),
|
28700 30172 | "we expected operation handler to be invoked but it was not entered"
|
28701 30173 | );
|
28702 30174 | }
|
30175 + |
|
30176 + | /* ProtocolTestGenerator.kt:98 */
|
28703 30177 | }
|
28704 30178 |
|
30179 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
28705 30180 | ::pin_project_lite::pin_project! {
|
28706 30181 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
28707 30182 | /// [`EndpointOperationInput`](crate::input::EndpointOperationInput) using modelled bindings.
|
28708 30183 | pub struct EndpointOperationInputFuture {
|
28709 30184 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EndpointOperationInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
28710 30185 | }
|
28711 30186 | }
|
28712 30187 |
|
28713 30188 | impl std::future::Future for EndpointOperationInputFuture {
|
28714 30189 | type Output = Result<
|
28715 30190 | crate::input::EndpointOperationInput,
|
28716 30191 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
28717 30192 | >;
|
28718 30193 |
|
28719 30194 | fn poll(
|
28720 30195 | self: std::pin::Pin<&mut Self>,
|
28721 30196 | cx: &mut std::task::Context<'_>,
|
28722 30197 | ) -> std::task::Poll<Self::Output> {
|
28723 30198 | let this = self.project();
|
28724 30199 | this.inner.as_mut().poll(cx)
|
28725 30200 | }
|
28726 30201 | }
|
28727 30202 |
|
28728 30203 | impl<B>
|
28729 30204 | ::aws_smithy_http_server::request::FromRequest<
|
28730 30205 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
28731 30206 | B,
|
28732 30207 | > for crate::input::EndpointOperationInput
|
28733 30208 | where
|
28734 30209 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
28735 30210 | B: 'static,
|
28736 30211 |
|
28737 30212 | B::Data: Send,
|
28738 30213 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
28739 30214 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
28740 30215 | {
|
28741 30216 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
28742 30217 | type Future = EndpointOperationInputFuture;
|
28743 30218 |
|
28744 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
30219 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
28745 30220 | let fut = async move {
|
28746 30221 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
28747 30222 | request.headers(),
|
28748 30223 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
28749 30224 | ) {
|
28750 30225 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
28751 30226 | }
|
28752 30227 | crate::protocol_serde::shape_endpoint_operation::de_endpoint_operation_http_request(
|
28753 30228 | request,
|
28754 30229 | )
|
28755 30230 | .await
|
28756 30231 | };
|
28757 30232 | use ::futures_util::future::TryFutureExt;
|
28758 30233 | let fut = fut.map_err(
|
28759 30234 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
28760 30235 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
28761 30236 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
28762 30237 | e,
|
28763 30238 | )
|
28764 30239 | },
|
28765 30240 | );
|
28766 30241 | EndpointOperationInputFuture {
|
28767 30242 | inner: Box::pin(fut),
|
28768 30243 | }
|
28769 30244 | }
|
28770 30245 | }
|
30246 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
28771 30247 | impl
|
28772 30248 | ::aws_smithy_http_server::response::IntoResponse<
|
28773 30249 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
28774 30250 | > for crate::output::EndpointOperationOutput
|
28775 30251 | {
|
28776 30252 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
28777 30253 | match crate::protocol_serde::shape_endpoint_operation::ser_endpoint_operation_http_response(
|
28778 30254 | self,
|
28779 30255 | ) {
|
28780 30256 | Ok(response) => response,
|
28781 30257 | Err(e) => {
|
28782 30258 | ::tracing::error!(error = %e, "failed to serialize response");
|
28783 30259 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
28784 30260 | }
|
28785 30261 | }
|
28786 30262 | }
|
28787 30263 | }
|
28788 30264 |
|
30265 + | /* RustType.kt:534 */
|
28789 30266 | #[allow(unreachable_code, unused_variables)]
|
30267 + | /* RustType.kt:534 */
|
28790 30268 | #[cfg(test)]
|
30269 + | /* ProtocolTestGenerator.kt:98 */
|
28791 30270 | mod endpoint_operation_test {
|
28792 30271 |
|
28793 30272 | /// Operations can prepend to the given host if they define the
|
28794 30273 | /// endpoint trait.
|
28795 30274 | /// Test ID: RestJsonEndpointTrait
|
28796 30275 | #[::tokio::test]
|
28797 30276 | #[::tracing_test::traced_test]
|
28798 30277 | #[should_panic]
|
28799 30278 | async fn rest_json_endpoint_trait_request() {
|
28800 30279 | #[allow(unused_mut)]
|
28801 - | let mut http_request = http::Request::builder()
|
30280 + | let mut http_request = ::http_1x::Request::builder()
|
28802 30281 | .uri("/EndpointOperation")
|
28803 30282 | .method("POST")
|
28804 - | .body(::aws_smithy_http_server::body::Body::from(
|
28805 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
28806 - | "".as_bytes(),
|
28807 - | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
30283 + | .body(::aws_smithy_http_server::body::boxed(
|
30284 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
30285 + | &::aws_smithy_protocol_test::decode_body_data(
|
30286 + | "".as_bytes(),
|
30287 + | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
30288 + | ),
|
28808 30289 | )),
|
28809 30290 | ))
|
28810 30291 | .unwrap();
|
28811 30292 | todo!("endpoint trait not supported yet");
|
28812 30293 | #[allow(unused_mut)]
|
28813 30294 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
28814 30295 | let config = crate::service::RestJsonConfig::builder().build();
|
28815 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
30296 + | let service =
|
30297 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
30298 + | config,
|
30299 + | )
|
28816 30300 | .endpoint_operation(move |input: crate::input::EndpointOperationInput| {
|
28817 30301 | let sender = sender.clone();
|
28818 30302 | async move {
|
28819 30303 | let result = {
|
28820 30304 | let expected = crate::input::EndpointOperationInput {};
|
28821 30305 | ::pretty_assertions::assert_eq!(input, expected);
|
28822 30306 | let output = crate::output::EndpointOperationOutput {};
|
28823 30307 | output
|
28824 30308 | };
|
28825 30309 | sender.send(()).await.expect("receiver dropped early");
|
28826 30310 | result
|
28827 30311 | }
|
28828 30312 | })
|
28829 30313 | .build_unchecked();
|
28830 30314 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
28831 30315 | .await
|
28832 30316 | .expect("unable to make an HTTP request");
|
28833 30317 | assert!(
|
28834 30318 | receiver.recv().await.is_some(),
|
28835 30319 | "we expected operation handler to be invoked but it was not entered"
|
28836 30320 | );
|
28837 30321 | }
|
30322 + |
|
30323 + | /* ProtocolTestGenerator.kt:98 */
|
28838 30324 | }
|
28839 30325 |
|
30326 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
28840 30327 | ::pin_project_lite::pin_project! {
|
28841 30328 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
28842 30329 | /// [`PostUnionWithJsonNameInput`](crate::input::PostUnionWithJsonNameInput) using modelled bindings.
|
28843 30330 | pub struct PostUnionWithJsonNameInputFuture {
|
28844 30331 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PostUnionWithJsonNameInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
28845 30332 | }
|
28846 30333 | }
|
28847 30334 |
|
28848 30335 | impl std::future::Future for PostUnionWithJsonNameInputFuture {
|
28849 30336 | type Output = Result<
|
28850 30337 | crate::input::PostUnionWithJsonNameInput,
|
28851 30338 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
28852 30339 | >;
|
28853 30340 |
|
28854 30341 | fn poll(
|
28855 30342 | self: std::pin::Pin<&mut Self>,
|
28856 30343 | cx: &mut std::task::Context<'_>,
|
28857 30344 | ) -> std::task::Poll<Self::Output> {
|
28858 30345 | let this = self.project();
|
28859 30346 | this.inner.as_mut().poll(cx)
|
28860 30347 | }
|
28861 30348 | }
|
28862 30349 |
|
28863 30350 | impl<B>
|
28864 30351 | ::aws_smithy_http_server::request::FromRequest<
|
28865 30352 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
28866 30353 | B,
|
28867 30354 | > for crate::input::PostUnionWithJsonNameInput
|
28868 30355 | where
|
28869 30356 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
28870 30357 | B: 'static,
|
28871 30358 |
|
28872 30359 | B::Data: Send,
|
28873 30360 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
28874 30361 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
28875 30362 | {
|
28876 30363 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
28877 30364 | type Future = PostUnionWithJsonNameInputFuture;
|
28878 30365 |
|
28879 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
30366 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
28880 30367 | let fut = async move {
|
28881 30368 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
28882 30369 | request.headers(),
|
28883 30370 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
28884 30371 | ) {
|
28885 30372 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
28886 30373 | }
|
28887 30374 | crate::protocol_serde::shape_post_union_with_json_name::de_post_union_with_json_name_http_request(request)
|
28888 30375 | .await
|
28889 30376 | };
|
28890 30377 | use ::futures_util::future::TryFutureExt;
|
28891 30378 | let fut = fut.map_err(
|
28892 30379 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
28893 30380 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
28894 30381 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
28895 30382 | e,
|
28896 30383 | )
|
28897 30384 | },
|
28898 30385 | );
|
28899 30386 | PostUnionWithJsonNameInputFuture {
|
28900 30387 | inner: Box::pin(fut),
|
28901 30388 | }
|
28902 30389 | }
|
28903 30390 | }
|
30391 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
28904 30392 | impl
|
28905 30393 | ::aws_smithy_http_server::response::IntoResponse<
|
28906 30394 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
28907 30395 | > for crate::output::PostUnionWithJsonNameOutput
|
28908 30396 | {
|
28909 30397 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
28910 30398 | match crate::protocol_serde::shape_post_union_with_json_name::ser_post_union_with_json_name_http_response(self) {
|
28911 30399 | Ok(response) => response,
|
28912 30400 | Err(e) => {
|
28913 30401 | ::tracing::error!(error = %e, "failed to serialize response");
|
28914 30402 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
28915 30403 | }
|
28916 30404 | }
|
28917 30405 | }
|
28918 30406 | }
|
28919 30407 |
|
30408 + | /* RustType.kt:534 */
|
28920 30409 | #[allow(unreachable_code, unused_variables)]
|
30410 + | /* RustType.kt:534 */
|
28921 30411 | #[cfg(test)]
|
30412 + | /* ProtocolTestGenerator.kt:98 */
|
28922 30413 | mod post_union_with_json_name_test {
|
28923 30414 |
|
28924 30415 | /// Tests that jsonName works with union members.
|
28925 30416 | /// Test ID: PostUnionWithJsonNameRequest1
|
28926 30417 | #[::tokio::test]
|
28927 30418 | #[::tracing_test::traced_test]
|
28928 30419 | async fn post_union_with_json_name_request1_request() {
|
28929 30420 | #[allow(unused_mut)]
|
28930 - | let mut http_request = http::Request::builder()
|
30421 + | let mut http_request = ::http_1x::Request::builder()
|
28931 30422 | .uri("/PostUnionWithJsonName")
|
28932 30423 | .method("POST")
|
28933 30424 | .header("Content-Type", "application/json")
|
28934 - | .body(::aws_smithy_http_server::body::Body::from(
|
28935 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
28936 - | "{\n \"value\": {\n \"FOO\": \"hi\"\n }\n}".as_bytes(),
|
28937 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30425 + | .body(::aws_smithy_http_server::body::boxed(
|
30426 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
30427 + | &::aws_smithy_protocol_test::decode_body_data(
|
30428 + | "{\n \"value\": {\n \"FOO\": \"hi\"\n }\n}".as_bytes(),
|
30429 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30430 + | ),
|
28938 30431 | )),
|
28939 30432 | ))
|
28940 30433 | .unwrap();
|
28941 30434 | #[allow(unused_mut)]
|
28942 30435 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
28943 30436 | let config = crate::service::RestJsonConfig::builder().build();
|
28944 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
30437 + | let service =
|
30438 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
30439 + | config,
|
30440 + | )
|
28945 30441 | .post_union_with_json_name(move |input: crate::input::PostUnionWithJsonNameInput| {
|
28946 30442 | let sender = sender.clone();
|
28947 30443 | async move {
|
28948 30444 | let result = {
|
28949 30445 | let expected = crate::input::PostUnionWithJsonNameInput {
|
28950 30446 | value: ::std::option::Option::Some(
|
28951 30447 | crate::model::UnionWithJsonName::Foo("hi".to_owned()),
|
28952 30448 | ),
|
28953 30449 | };
|
28954 30450 | ::pretty_assertions::assert_eq!(input, expected);
|
28955 30451 | let output = crate::output::PostUnionWithJsonNameOutput {
|
28956 30452 | value: crate::model::UnionWithJsonName::Foo("".to_owned()),
|
28957 30453 | };
|
28958 30454 | output
|
28959 30455 | };
|
28960 30456 | sender.send(()).await.expect("receiver dropped early");
|
28961 30457 | result
|
28962 30458 | }
|
28963 30459 | })
|
28964 30460 | .build_unchecked();
|
28965 30461 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
28966 30462 | .await
|
28967 30463 | .expect("unable to make an HTTP request");
|
28968 30464 | assert!(
|
28969 30465 | receiver.recv().await.is_some(),
|
28970 30466 | "we expected operation handler to be invoked but it was not entered"
|
28971 30467 | );
|
28972 30468 | }
|
28973 30469 |
|
28974 30470 | /// Tests that jsonName works with union members.
|
28975 30471 | /// Test ID: PostUnionWithJsonNameRequest2
|
28976 30472 | #[::tokio::test]
|
28977 30473 | #[::tracing_test::traced_test]
|
28978 30474 | async fn post_union_with_json_name_request2_request() {
|
28979 30475 | #[allow(unused_mut)]
|
28980 - | let mut http_request = http::Request::builder()
|
30476 + | let mut http_request = ::http_1x::Request::builder()
|
28981 30477 | .uri("/PostUnionWithJsonName")
|
28982 30478 | .method("POST")
|
28983 30479 | .header("Content-Type", "application/json")
|
28984 - | .body(::aws_smithy_http_server::body::Body::from(
|
28985 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
28986 - | "{\n \"value\": {\n \"_baz\": \"hi\"\n }\n}".as_bytes(),
|
28987 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30480 + | .body(::aws_smithy_http_server::body::boxed(
|
30481 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
30482 + | &::aws_smithy_protocol_test::decode_body_data(
|
30483 + | "{\n \"value\": {\n \"_baz\": \"hi\"\n }\n}".as_bytes(),
|
30484 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30485 + | ),
|
28988 30486 | )),
|
28989 30487 | ))
|
28990 30488 | .unwrap();
|
28991 30489 | #[allow(unused_mut)]
|
28992 30490 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
28993 30491 | let config = crate::service::RestJsonConfig::builder().build();
|
28994 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
30492 + | let service =
|
30493 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
30494 + | config,
|
30495 + | )
|
28995 30496 | .post_union_with_json_name(move |input: crate::input::PostUnionWithJsonNameInput| {
|
28996 30497 | let sender = sender.clone();
|
28997 30498 | async move {
|
28998 30499 | let result = {
|
28999 30500 | let expected = crate::input::PostUnionWithJsonNameInput {
|
29000 30501 | value: ::std::option::Option::Some(
|
29001 30502 | crate::model::UnionWithJsonName::Baz("hi".to_owned()),
|
29002 30503 | ),
|
29003 30504 | };
|
29004 30505 | ::pretty_assertions::assert_eq!(input, expected);
|
29005 30506 | let output = crate::output::PostUnionWithJsonNameOutput {
|
29006 30507 | value: crate::model::UnionWithJsonName::Foo("".to_owned()),
|
29007 30508 | };
|
29008 30509 | output
|
29009 30510 | };
|
29010 30511 | sender.send(()).await.expect("receiver dropped early");
|
29011 30512 | result
|
29012 30513 | }
|
29013 30514 | })
|
29014 30515 | .build_unchecked();
|
29015 30516 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
29016 30517 | .await
|
29017 30518 | .expect("unable to make an HTTP request");
|
29018 30519 | assert!(
|
29019 30520 | receiver.recv().await.is_some(),
|
29020 30521 | "we expected operation handler to be invoked but it was not entered"
|
29021 30522 | );
|
29022 30523 | }
|
29023 30524 |
|
29024 30525 | /// Tests that jsonName works with union members.
|
29025 30526 | /// Test ID: PostUnionWithJsonNameRequest3
|
29026 30527 | #[::tokio::test]
|
29027 30528 | #[::tracing_test::traced_test]
|
29028 30529 | async fn post_union_with_json_name_request3_request() {
|
29029 30530 | #[allow(unused_mut)]
|
29030 - | let mut http_request = http::Request::builder()
|
30531 + | let mut http_request = ::http_1x::Request::builder()
|
29031 30532 | .uri("/PostUnionWithJsonName")
|
29032 30533 | .method("POST")
|
29033 30534 | .header("Content-Type", "application/json")
|
29034 - | .body(::aws_smithy_http_server::body::Body::from(
|
29035 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
29036 - | "{\n \"value\": {\n \"bar\": \"hi\"\n }\n}".as_bytes(),
|
29037 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30535 + | .body(::aws_smithy_http_server::body::boxed(
|
30536 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
30537 + | &::aws_smithy_protocol_test::decode_body_data(
|
30538 + | "{\n \"value\": {\n \"bar\": \"hi\"\n }\n}".as_bytes(),
|
30539 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30540 + | ),
|
29038 30541 | )),
|
29039 30542 | ))
|
29040 30543 | .unwrap();
|
29041 30544 | #[allow(unused_mut)]
|
29042 30545 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
29043 30546 | let config = crate::service::RestJsonConfig::builder().build();
|
29044 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
30547 + | let service =
|
30548 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
30549 + | config,
|
30550 + | )
|
29045 30551 | .post_union_with_json_name(move |input: crate::input::PostUnionWithJsonNameInput| {
|
29046 30552 | let sender = sender.clone();
|
29047 30553 | async move {
|
29048 30554 | let result = {
|
29049 30555 | let expected = crate::input::PostUnionWithJsonNameInput {
|
29050 30556 | value: ::std::option::Option::Some(
|
29051 30557 | crate::model::UnionWithJsonName::Bar("hi".to_owned()),
|
29052 30558 | ),
|
29053 30559 | };
|
29054 30560 | ::pretty_assertions::assert_eq!(input, expected);
|
29055 30561 | let output = crate::output::PostUnionWithJsonNameOutput {
|
29056 30562 | value: crate::model::UnionWithJsonName::Foo("".to_owned()),
|
29057 30563 | };
|
29058 30564 | output
|
29059 30565 | };
|
29060 30566 | sender.send(()).await.expect("receiver dropped early");
|
29061 30567 | result
|
29062 30568 | }
|
29063 30569 | })
|
29064 30570 | .build_unchecked();
|
29065 30571 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
29066 30572 | .await
|
29067 30573 | .expect("unable to make an HTTP request");
|
29068 30574 | assert!(
|
29069 30575 | receiver.recv().await.is_some(),
|
29070 30576 | "we expected operation handler to be invoked but it was not entered"
|
29071 30577 | );
|
29072 30578 | }
|
29073 30579 |
|
29074 30580 | /// Tests that jsonName works with union members.
|
29075 30581 | /// Test ID: PostUnionWithJsonNameResponse1
|
29076 30582 | #[::tokio::test]
|
29077 30583 | #[::tracing_test::traced_test]
|
29078 30584 | async fn post_union_with_json_name_response1_response() {
|
29079 30585 | let output = crate::output::PostUnionWithJsonNameOutput {
|
29080 30586 | value: crate::model::UnionWithJsonName::Foo("hi".to_owned()),
|
29081 30587 | };
|
29082 30588 | use ::aws_smithy_http_server::response::IntoResponse;
|
29083 30589 | let http_response = output.into_response();
|
29084 30590 | ::pretty_assertions::assert_eq!(
|
29085 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
30591 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
29086 30592 | http_response.status()
|
29087 30593 | );
|
29088 30594 | let expected_headers = [("Content-Type", "application/json")];
|
29089 30595 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
29090 30596 | http_response.headers(),
|
29091 30597 | expected_headers,
|
29092 30598 | ));
|
29093 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
30599 + | use ::http_body_util::BodyExt;
|
30600 + | let body = http_response
|
30601 + | .into_body()
|
30602 + | .collect()
|
29094 30603 | .await
|
29095 - | .expect("unable to extract body to bytes");
|
30604 + | .expect("unable to collect body")
|
30605 + | .to_bytes();
|
29096 30606 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
29097 30607 | &body,
|
29098 30608 | "{\n \"value\": {\n \"FOO\": \"hi\"\n }\n}",
|
29099 30609 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
29100 30610 | ));
|
29101 30611 | }
|
29102 30612 |
|
29103 30613 | /// Tests that jsonName works with union members.
|
29104 30614 | /// Test ID: PostUnionWithJsonNameResponse2
|
29105 30615 | #[::tokio::test]
|
29106 30616 | #[::tracing_test::traced_test]
|
29107 30617 | async fn post_union_with_json_name_response2_response() {
|
29108 30618 | let output = crate::output::PostUnionWithJsonNameOutput {
|
29109 30619 | value: crate::model::UnionWithJsonName::Baz("hi".to_owned()),
|
29110 30620 | };
|
29111 30621 | use ::aws_smithy_http_server::response::IntoResponse;
|
29112 30622 | let http_response = output.into_response();
|
29113 30623 | ::pretty_assertions::assert_eq!(
|
29114 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
30624 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
29115 30625 | http_response.status()
|
29116 30626 | );
|
29117 30627 | let expected_headers = [("Content-Type", "application/json")];
|
29118 30628 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
29119 30629 | http_response.headers(),
|
29120 30630 | expected_headers,
|
29121 30631 | ));
|
29122 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
30632 + | use ::http_body_util::BodyExt;
|
30633 + | let body = http_response
|
30634 + | .into_body()
|
30635 + | .collect()
|
29123 30636 | .await
|
29124 - | .expect("unable to extract body to bytes");
|
30637 + | .expect("unable to collect body")
|
30638 + | .to_bytes();
|
29125 30639 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
29126 30640 | &body,
|
29127 30641 | "{\n \"value\": {\n \"_baz\": \"hi\"\n }\n}",
|
29128 30642 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
29129 30643 | ));
|
29130 30644 | }
|
29131 30645 |
|
29132 30646 | /// Tests that jsonName works with union members.
|
29133 30647 | /// Test ID: PostUnionWithJsonNameResponse3
|
29134 30648 | #[::tokio::test]
|
29135 30649 | #[::tracing_test::traced_test]
|
29136 30650 | async fn post_union_with_json_name_response3_response() {
|
29137 30651 | let output = crate::output::PostUnionWithJsonNameOutput {
|
29138 30652 | value: crate::model::UnionWithJsonName::Bar("hi".to_owned()),
|
29139 30653 | };
|
29140 30654 | use ::aws_smithy_http_server::response::IntoResponse;
|
29141 30655 | let http_response = output.into_response();
|
29142 30656 | ::pretty_assertions::assert_eq!(
|
29143 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
30657 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
29144 30658 | http_response.status()
|
29145 30659 | );
|
29146 30660 | let expected_headers = [("Content-Type", "application/json")];
|
29147 30661 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
29148 30662 | http_response.headers(),
|
29149 30663 | expected_headers,
|
29150 30664 | ));
|
29151 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
30665 + | use ::http_body_util::BodyExt;
|
30666 + | let body = http_response
|
30667 + | .into_body()
|
30668 + | .collect()
|
29152 30669 | .await
|
29153 - | .expect("unable to extract body to bytes");
|
30670 + | .expect("unable to collect body")
|
30671 + | .to_bytes();
|
29154 30672 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
29155 30673 | &body,
|
29156 30674 | "{\n \"value\": {\n \"bar\": \"hi\"\n }\n}",
|
29157 30675 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
29158 30676 | ));
|
29159 30677 | }
|
30678 + |
|
30679 + | /* ProtocolTestGenerator.kt:98 */
|
29160 30680 | }
|
29161 30681 |
|
30682 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
29162 30683 | ::pin_project_lite::pin_project! {
|
29163 30684 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
29164 30685 | /// [`PostPlayerActionInput`](crate::input::PostPlayerActionInput) using modelled bindings.
|
29165 30686 | pub struct PostPlayerActionInputFuture {
|
29166 30687 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PostPlayerActionInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
29167 30688 | }
|
29168 30689 | }
|
29169 30690 |
|
29170 30691 | impl std::future::Future for PostPlayerActionInputFuture {
|
29171 30692 | type Output = Result<
|
29172 30693 | crate::input::PostPlayerActionInput,
|
29173 30694 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
29174 30695 | >;
|
29175 30696 |
|
29176 30697 | fn poll(
|
29177 30698 | self: std::pin::Pin<&mut Self>,
|
29178 30699 | cx: &mut std::task::Context<'_>,
|
29179 30700 | ) -> std::task::Poll<Self::Output> {
|
29180 30701 | let this = self.project();
|
29181 30702 | this.inner.as_mut().poll(cx)
|
29182 30703 | }
|
29183 30704 | }
|
29184 30705 |
|
29185 30706 | impl<B>
|
29186 30707 | ::aws_smithy_http_server::request::FromRequest<
|
29187 30708 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
29188 30709 | B,
|
29189 30710 | > for crate::input::PostPlayerActionInput
|
29190 30711 | where
|
29191 30712 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
29192 30713 | B: 'static,
|
29193 30714 |
|
29194 30715 | B::Data: Send,
|
29195 30716 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
29196 30717 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
29197 30718 | {
|
29198 30719 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
29199 30720 | type Future = PostPlayerActionInputFuture;
|
29200 30721 |
|
29201 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
30722 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
29202 30723 | let fut = async move {
|
29203 30724 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
29204 30725 | request.headers(),
|
29205 30726 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
29206 30727 | ) {
|
29207 30728 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
29208 30729 | }
|
29209 30730 | crate::protocol_serde::shape_post_player_action::de_post_player_action_http_request(
|
29210 30731 | request,
|
29211 30732 | )
|
29212 30733 | .await
|
29213 30734 | };
|
29214 30735 | use ::futures_util::future::TryFutureExt;
|
29215 30736 | let fut = fut.map_err(
|
29216 30737 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
29217 30738 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
29218 30739 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
29219 30740 | e,
|
29220 30741 | )
|
29221 30742 | },
|
29222 30743 | );
|
29223 30744 | PostPlayerActionInputFuture {
|
29224 30745 | inner: Box::pin(fut),
|
29225 30746 | }
|
29226 30747 | }
|
29227 30748 | }
|
30749 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
29228 30750 | impl
|
29229 30751 | ::aws_smithy_http_server::response::IntoResponse<
|
29230 30752 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
29231 30753 | > for crate::output::PostPlayerActionOutput
|
29232 30754 | {
|
29233 30755 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
29234 30756 | match crate::protocol_serde::shape_post_player_action::ser_post_player_action_http_response(
|
29235 30757 | self,
|
29236 30758 | ) {
|
29237 30759 | Ok(response) => response,
|
29238 30760 | Err(e) => {
|
29239 30761 | ::tracing::error!(error = %e, "failed to serialize response");
|
29240 30762 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
29241 30763 | }
|
29242 30764 | }
|
29243 30765 | }
|
29244 30766 | }
|
29245 30767 |
|
30768 + | /* RustType.kt:534 */
|
29246 30769 | #[allow(unreachable_code, unused_variables)]
|
30770 + | /* RustType.kt:534 */
|
29247 30771 | #[cfg(test)]
|
30772 + | /* ProtocolTestGenerator.kt:98 */
|
29248 30773 | mod post_player_action_test {
|
29249 30774 |
|
29250 30775 | /// Unit types in unions are serialized like normal structures in requests.
|
29251 30776 | /// Test ID: RestJsonInputUnionWithUnitMember
|
29252 30777 | #[::tokio::test]
|
29253 30778 | #[::tracing_test::traced_test]
|
29254 30779 | async fn rest_json_input_union_with_unit_member_request() {
|
29255 30780 | #[allow(unused_mut)]
|
29256 - | let mut http_request = http::Request::builder()
|
30781 + | let mut http_request = ::http_1x::Request::builder()
|
29257 30782 | .uri("/PostPlayerAction")
|
29258 30783 | .method("POST")
|
29259 30784 | .header("Content-Type", "application/json")
|
29260 - | .body(::aws_smithy_http_server::body::Body::from(
|
29261 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
29262 - | "{\n \"action\": {\n \"quit\": {}\n }\n}".as_bytes(),
|
29263 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30785 + | .body(::aws_smithy_http_server::body::boxed(
|
30786 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
30787 + | &::aws_smithy_protocol_test::decode_body_data(
|
30788 + | "{\n \"action\": {\n \"quit\": {}\n }\n}".as_bytes(),
|
30789 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30790 + | ),
|
29264 30791 | )),
|
29265 30792 | ))
|
29266 30793 | .unwrap();
|
29267 30794 | #[allow(unused_mut)]
|
29268 30795 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
29269 30796 | let config = crate::service::RestJsonConfig::builder().build();
|
29270 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
30797 + | let service =
|
30798 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
30799 + | config,
|
30800 + | )
|
29271 30801 | .post_player_action(move |input: crate::input::PostPlayerActionInput| {
|
29272 30802 | let sender = sender.clone();
|
29273 30803 | async move {
|
29274 30804 | let result = {
|
29275 30805 | let expected = crate::input::PostPlayerActionInput {
|
29276 30806 | action: ::std::option::Option::Some(crate::model::PlayerAction::Quit),
|
29277 30807 | };
|
29278 30808 | ::pretty_assertions::assert_eq!(input, expected);
|
29279 30809 | let output = crate::output::PostPlayerActionOutput {
|
29280 30810 | action: crate::model::PlayerAction::Quit,
|
29281 30811 | };
|
29282 30812 | output
|
29283 30813 | };
|
29284 30814 | sender.send(()).await.expect("receiver dropped early");
|
29285 30815 | result
|
29286 30816 | }
|
29287 30817 | })
|
29288 30818 | .build_unchecked();
|
29289 30819 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
29290 30820 | .await
|
29291 30821 | .expect("unable to make an HTTP request");
|
29292 30822 | assert!(
|
29293 30823 | receiver.recv().await.is_some(),
|
29294 30824 | "we expected operation handler to be invoked but it was not entered"
|
29295 30825 | );
|
29296 30826 | }
|
29297 30827 |
|
29298 30828 | /// Unit types in unions are serialized like normal structures in responses.
|
29299 30829 | /// Test ID: RestJsonOutputUnionWithUnitMember
|
29300 30830 | #[::tokio::test]
|
29301 30831 | #[::tracing_test::traced_test]
|
29302 30832 | async fn rest_json_output_union_with_unit_member_response() {
|
29303 30833 | let output = crate::output::PostPlayerActionOutput {
|
29304 30834 | action: crate::model::PlayerAction::Quit,
|
29305 30835 | };
|
29306 30836 | use ::aws_smithy_http_server::response::IntoResponse;
|
29307 30837 | let http_response = output.into_response();
|
29308 30838 | ::pretty_assertions::assert_eq!(
|
29309 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
30839 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
29310 30840 | http_response.status()
|
29311 30841 | );
|
29312 30842 | let expected_headers = [("Content-Type", "application/json")];
|
29313 30843 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
29314 30844 | http_response.headers(),
|
29315 30845 | expected_headers,
|
29316 30846 | ));
|
29317 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
30847 + | use ::http_body_util::BodyExt;
|
30848 + | let body = http_response
|
30849 + | .into_body()
|
30850 + | .collect()
|
29318 30851 | .await
|
29319 - | .expect("unable to extract body to bytes");
|
30852 + | .expect("unable to collect body")
|
30853 + | .to_bytes();
|
29320 30854 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
29321 30855 | &body,
|
29322 30856 | "{\n \"action\": {\n \"quit\": {}\n }\n}",
|
29323 30857 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
29324 30858 | ));
|
29325 30859 | }
|
30860 + |
|
30861 + | /* ProtocolTestGenerator.kt:98 */
|
29326 30862 | }
|
29327 30863 |
|
30864 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
29328 30865 | ::pin_project_lite::pin_project! {
|
29329 30866 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
29330 30867 | /// [`JsonUnionsInput`](crate::input::JsonUnionsInput) using modelled bindings.
|
29331 30868 | pub struct JsonUnionsInputFuture {
|
29332 30869 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonUnionsInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
29333 30870 | }
|
29334 30871 | }
|
29335 30872 |
|
29336 30873 | impl std::future::Future for JsonUnionsInputFuture {
|
29337 30874 | type Output = Result<
|
29338 30875 | crate::input::JsonUnionsInput,
|
29339 30876 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
29340 30877 | >;
|
29341 30878 |
|
29342 30879 | fn poll(
|
29343 30880 | self: std::pin::Pin<&mut Self>,
|
29344 30881 | cx: &mut std::task::Context<'_>,
|
29345 30882 | ) -> std::task::Poll<Self::Output> {
|
29346 30883 | let this = self.project();
|
29347 30884 | this.inner.as_mut().poll(cx)
|
29348 30885 | }
|
29349 30886 | }
|
29350 30887 |
|
29351 30888 | impl<B>
|
29352 30889 | ::aws_smithy_http_server::request::FromRequest<
|
29353 30890 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
29354 30891 | B,
|
29355 30892 | > for crate::input::JsonUnionsInput
|
29356 30893 | where
|
29357 30894 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
29358 30895 | B: 'static,
|
29359 30896 |
|
29360 30897 | B::Data: Send,
|
29361 30898 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
29362 30899 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
29363 30900 | {
|
29364 30901 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
29365 30902 | type Future = JsonUnionsInputFuture;
|
29366 30903 |
|
29367 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
30904 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
29368 30905 | let fut = async move {
|
29369 30906 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
29370 30907 | request.headers(),
|
29371 30908 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
29372 30909 | ) {
|
29373 30910 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
29374 30911 | }
|
29375 30912 | crate::protocol_serde::shape_json_unions::de_json_unions_http_request(request).await
|
29376 30913 | };
|
29377 30914 | use ::futures_util::future::TryFutureExt;
|
29378 30915 | let fut = fut.map_err(
|
29379 30916 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
29380 30917 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
29381 30918 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
29382 30919 | e,
|
29383 30920 | )
|
29384 30921 | },
|
29385 30922 | );
|
29386 30923 | JsonUnionsInputFuture {
|
29387 30924 | inner: Box::pin(fut),
|
29388 30925 | }
|
29389 30926 | }
|
29390 30927 | }
|
30928 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
29391 30929 | impl
|
29392 30930 | ::aws_smithy_http_server::response::IntoResponse<
|
29393 30931 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
29394 30932 | > for crate::output::JsonUnionsOutput
|
29395 30933 | {
|
29396 30934 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
29397 30935 | match crate::protocol_serde::shape_json_unions::ser_json_unions_http_response(self) {
|
29398 30936 | Ok(response) => response,
|
29399 30937 | Err(e) => {
|
29400 30938 | ::tracing::error!(error = %e, "failed to serialize response");
|
29401 30939 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
29402 30940 | }
|
29403 30941 | }
|
29404 30942 | }
|
29405 30943 | }
|
30944 + | /* ServerHttpBoundProtocolGenerator.kt:356 */
|
29406 30945 | impl
|
29407 30946 | ::aws_smithy_http_server::response::IntoResponse<
|
29408 30947 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
29409 30948 | > for crate::error::JsonUnionsError
|
29410 30949 | {
|
29411 30950 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
29412 30951 | match crate::protocol_serde::shape_json_unions::ser_json_unions_http_error(&self) {
|
29413 30952 | Ok(mut response) => {
|
29414 30953 | response.extensions_mut().insert(
|
29415 30954 | ::aws_smithy_http_server::extension::ModeledErrorExtension::new(self.name()),
|
29416 30955 | );
|
29417 30956 | response
|
29418 30957 | }
|
29419 30958 | Err(e) => {
|
29420 30959 | ::tracing::error!(error = %e, "failed to serialize response");
|
29421 30960 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
29422 30961 | }
|
29423 30962 | }
|
29424 30963 | }
|
29425 30964 | }
|
29426 30965 |
|
30966 + | /* RustType.kt:534 */
|
29427 30967 | #[allow(unreachable_code, unused_variables)]
|
30968 + | /* RustType.kt:534 */
|
29428 30969 | #[cfg(test)]
|
30970 + | /* ProtocolTestGenerator.kt:98 */
|
29429 30971 | mod json_unions_test {
|
29430 30972 |
|
29431 30973 | /// Serializes a string union value
|
29432 30974 | /// Test ID: RestJsonSerializeStringUnionValue
|
29433 30975 | #[::tokio::test]
|
29434 30976 | #[::tracing_test::traced_test]
|
29435 30977 | async fn rest_json_serialize_string_union_value_request() {
|
29436 30978 | #[allow(unused_mut)]
|
29437 - | let mut http_request = http::Request::builder()
|
30979 + | let mut http_request = ::http_1x::Request::builder()
|
29438 30980 | .uri("/JsonUnions")
|
29439 30981 | .method("PUT")
|
29440 30982 | .header("Content-Type", "application/json")
|
29441 - | .body(::aws_smithy_http_server::body::Body::from(
|
29442 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
29443 - | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}".as_bytes(),
|
29444 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30983 + | .body(::aws_smithy_http_server::body::boxed(
|
30984 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
30985 + | &::aws_smithy_protocol_test::decode_body_data(
|
30986 + | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}"
|
30987 + | .as_bytes(),
|
30988 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30989 + | ),
|
29445 30990 | )),
|
29446 30991 | ))
|
29447 30992 | .unwrap();
|
29448 30993 | #[allow(unused_mut)]
|
29449 30994 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
29450 30995 | let config = crate::service::RestJsonConfig::builder().build();
|
29451 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
30996 + | let service =
|
30997 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
30998 + | config,
|
30999 + | )
|
29452 31000 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
29453 31001 | let sender = sender.clone();
|
29454 31002 | async move {
|
29455 31003 | let result = {
|
29456 31004 | let expected = crate::input::JsonUnionsInput {
|
29457 31005 | contents: ::std::option::Option::Some(
|
29458 31006 | crate::model::MyUnion::StringValue("foo".to_owned()),
|
29459 31007 | ),
|
29460 31008 | };
|
29461 31009 | ::pretty_assertions::assert_eq!(input, expected);
|
29462 31010 | let output = crate::output::JsonUnionsOutput {
|
29463 31011 | contents: ::std::option::Option::None,
|
29464 31012 | };
|
29465 31013 | Ok(output)
|
29466 31014 | };
|
29467 31015 | sender.send(()).await.expect("receiver dropped early");
|
29468 31016 | result
|
29469 31017 | }
|
29470 31018 | })
|
29471 31019 | .build_unchecked();
|
29472 31020 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
29473 31021 | .await
|
29474 31022 | .expect("unable to make an HTTP request");
|
29475 31023 | assert!(
|
29476 31024 | receiver.recv().await.is_some(),
|
29477 31025 | "we expected operation handler to be invoked but it was not entered"
|
29478 31026 | );
|
29479 31027 | }
|
29480 31028 |
|
29481 31029 | /// Serializes a boolean union value
|
29482 31030 | /// Test ID: RestJsonSerializeBooleanUnionValue
|
29483 31031 | #[::tokio::test]
|
29484 31032 | #[::tracing_test::traced_test]
|
29485 31033 | async fn rest_json_serialize_boolean_union_value_request() {
|
29486 31034 | #[allow(unused_mut)]
|
29487 - | let mut http_request = http::Request::builder()
|
31035 + | let mut http_request = ::http_1x::Request::builder()
|
29488 31036 | .uri("/JsonUnions")
|
29489 31037 | .method("PUT")
|
29490 31038 | .header("Content-Type", "application/json")
|
29491 - | .body(::aws_smithy_http_server::body::Body::from(
|
29492 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
29493 - | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}".as_bytes(),
|
29494 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
31039 + | .body(::aws_smithy_http_server::body::boxed(
|
31040 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
31041 + | &::aws_smithy_protocol_test::decode_body_data(
|
31042 + | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}"
|
31043 + | .as_bytes(),
|
31044 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
31045 + | ),
|
29495 31046 | )),
|
29496 31047 | ))
|
29497 31048 | .unwrap();
|
29498 31049 | #[allow(unused_mut)]
|
29499 31050 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
29500 31051 | let config = crate::service::RestJsonConfig::builder().build();
|
29501 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
31052 + | let service =
|
31053 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
31054 + | config,
|
31055 + | )
|
29502 31056 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
29503 31057 | let sender = sender.clone();
|
29504 31058 | async move {
|
29505 31059 | let result = {
|
29506 31060 | let expected = crate::input::JsonUnionsInput {
|
29507 31061 | contents: ::std::option::Option::Some(
|
29508 31062 | crate::model::MyUnion::BooleanValue(true),
|
29509 31063 | ),
|
29510 31064 | };
|
29511 31065 | ::pretty_assertions::assert_eq!(input, expected);
|
29512 31066 | let output = crate::output::JsonUnionsOutput {
|
29513 31067 | contents: ::std::option::Option::None,
|
29514 31068 | };
|
29515 31069 | Ok(output)
|
29516 31070 | };
|
29517 31071 | sender.send(()).await.expect("receiver dropped early");
|
29518 31072 | result
|
29519 31073 | }
|
29520 31074 | })
|
29521 31075 | .build_unchecked();
|
29522 31076 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
29523 31077 | .await
|
29524 31078 | .expect("unable to make an HTTP request");
|
29525 31079 | assert!(
|
29526 31080 | receiver.recv().await.is_some(),
|
29527 31081 | "we expected operation handler to be invoked but it was not entered"
|
29528 31082 | );
|
29529 31083 | }
|
29530 31084 |
|
29531 31085 | /// Serializes a number union value
|
29532 31086 | /// Test ID: RestJsonSerializeNumberUnionValue
|
29533 31087 | #[::tokio::test]
|
29534 31088 | #[::tracing_test::traced_test]
|
29535 31089 | async fn rest_json_serialize_number_union_value_request() {
|
29536 31090 | #[allow(unused_mut)]
|
29537 - | let mut http_request = http::Request::builder()
|
31091 + | let mut http_request = ::http_1x::Request::builder()
|
29538 31092 | .uri("/JsonUnions")
|
29539 31093 | .method("PUT")
|
29540 31094 | .header("Content-Type", "application/json")
|
29541 - | .body(::aws_smithy_http_server::body::Body::from(
|
29542 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
29543 - | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}".as_bytes(),
|
29544 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
31095 + | .body(::aws_smithy_http_server::body::boxed(
|
31096 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
31097 + | &::aws_smithy_protocol_test::decode_body_data(
|
31098 + | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}".as_bytes(),
|
31099 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
31100 + | ),
|
29545 31101 | )),
|
29546 31102 | ))
|
29547 31103 | .unwrap();
|
29548 31104 | #[allow(unused_mut)]
|
29549 31105 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
29550 31106 | let config = crate::service::RestJsonConfig::builder().build();
|
29551 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
31107 + | let service =
|
31108 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
31109 + | config,
|
31110 + | )
|
29552 31111 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
29553 31112 | let sender = sender.clone();
|
29554 31113 | async move {
|
29555 31114 | let result = {
|
29556 31115 | let expected = crate::input::JsonUnionsInput {
|
29557 31116 | contents: ::std::option::Option::Some(
|
29558 31117 | crate::model::MyUnion::NumberValue(1),
|
29559 31118 | ),
|
29560 31119 | };
|
29561 31120 | ::pretty_assertions::assert_eq!(input, expected);
|
29562 31121 | let output = crate::output::JsonUnionsOutput {
|
29563 31122 | contents: ::std::option::Option::None,
|
29564 31123 | };
|
29565 31124 | Ok(output)
|
29566 31125 | };
|
29567 31126 | sender.send(()).await.expect("receiver dropped early");
|
29568 31127 | result
|
29569 31128 | }
|
29570 31129 | })
|
29571 31130 | .build_unchecked();
|
29572 31131 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
29573 31132 | .await
|
29574 31133 | .expect("unable to make an HTTP request");
|
29575 31134 | assert!(
|
29576 31135 | receiver.recv().await.is_some(),
|
29577 31136 | "we expected operation handler to be invoked but it was not entered"
|
29578 31137 | );
|
29579 31138 | }
|
29580 31139 |
|
29581 31140 | /// Serializes a blob union value
|
29582 31141 | /// Test ID: RestJsonSerializeBlobUnionValue
|
29583 31142 | #[::tokio::test]
|
29584 31143 | #[::tracing_test::traced_test]
|
29585 31144 | async fn rest_json_serialize_blob_union_value_request() {
|
29586 31145 | #[allow(unused_mut)]
|
29587 - | let mut http_request = http::Request::builder()
|
31146 + | let mut http_request = ::http_1x::Request::builder()
|
29588 31147 | .uri("/JsonUnions")
|
29589 31148 | .method("PUT")
|
29590 31149 | .header("Content-Type", "application/json")
|
29591 - | .body(::aws_smithy_http_server::body::Body::from(
|
29592 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
29593 - | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}".as_bytes(),
|
29594 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
31150 + | .body(::aws_smithy_http_server::body::boxed(
|
31151 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
31152 + | &::aws_smithy_protocol_test::decode_body_data(
|
31153 + | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}"
|
31154 + | .as_bytes(),
|
31155 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
31156 + | ),
|
29595 31157 | )),
|
29596 31158 | ))
|
29597 31159 | .unwrap();
|
29598 31160 | #[allow(unused_mut)]
|
29599 31161 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
29600 31162 | let config = crate::service::RestJsonConfig::builder().build();
|
29601 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29602 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
29603 - | let sender = sender.clone();
|
29604 - | async move {
|
29605 - | let result = {
|
29606 - | let expected = crate::input::JsonUnionsInput {
|
29607 - | contents: ::std::option::Option::Some(
|
29608 - | crate::model::MyUnion::BlobValue(::aws_smithy_types::Blob::new(
|
29609 - | "foo",
|
29610 - | )),
|
29611 - | ),
|
29612 - | };
|
29613 - | ::pretty_assertions::assert_eq!(input, expected);
|
29614 - | let output = crate::output::JsonUnionsOutput {
|
29615 - | contents: ::std::option::Option::None,
|
29616 - | };
|
29617 - | Ok(output)
|
31163 + | let service = crate::service::RestJson::builder::<
|
31164 + | ::aws_smithy_http_server::body::BoxBody,
|
31165 + | _,
|
31166 + | _,
|
31167 + | _,
|
31168 + | >(config)
|
31169 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
31170 + | let sender = sender.clone();
|
31171 + | async move {
|
31172 + | let result = {
|
31173 + | let expected = crate::input::JsonUnionsInput {
|
31174 + | contents: ::std::option::Option::Some(crate::model::MyUnion::BlobValue(
|
31175 + | ::aws_smithy_types::Blob::new("foo"),
|
31176 + | )),
|
29618 31177 | };
|
29619 - | sender.send(()).await.expect("receiver dropped early");
|
29620 - | result
|
29621 - | }
|
29622 - | })
|
29623 - | .build_unchecked();
|
31178 + | ::pretty_assertions::assert_eq!(input, expected);
|
31179 + | let output = crate::output::JsonUnionsOutput {
|
31180 + | contents: ::std::option::Option::None,
|
31181 + | };
|
31182 + | Ok(output)
|
31183 + | };
|
31184 + | sender.send(()).await.expect("receiver dropped early");
|
31185 + | result
|
31186 + | }
|
31187 + | })
|
31188 + | .build_unchecked();
|
29624 31189 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
29625 31190 | .await
|
29626 31191 | .expect("unable to make an HTTP request");
|
29627 31192 | assert!(
|
29628 31193 | receiver.recv().await.is_some(),
|
29629 31194 | "we expected operation handler to be invoked but it was not entered"
|
29630 31195 | );
|
29631 31196 | }
|
29632 31197 |
|
29633 31198 | /// Serializes a timestamp union value
|
29634 31199 | /// Test ID: RestJsonSerializeTimestampUnionValue
|
29635 31200 | #[::tokio::test]
|
29636 31201 | #[::tracing_test::traced_test]
|
29637 31202 | async fn rest_json_serialize_timestamp_union_value_request() {
|
29638 31203 | #[allow(unused_mut)]
|
29639 - | let mut http_request = http::Request::builder()
|
31204 + | let mut http_request = ::http_1x::Request::builder()
|
29640 31205 | .uri("/JsonUnions")
|
29641 31206 | .method("PUT")
|
29642 31207 | .header("Content-Type", "application/json")
|
29643 - | .body(::aws_smithy_http_server::body::Body::from(
|
29644 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
29645 - | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}"
|
29646 - | .as_bytes(),
|
29647 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
31208 + | .body(::aws_smithy_http_server::body::boxed(
|
31209 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
31210 + | &::aws_smithy_protocol_test::decode_body_data(
|
31211 + | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}"
|
31212 + | .as_bytes(),
|
31213 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
31214 + | ),
|
29648 31215 | )),
|
29649 31216 | ))
|
29650 31217 | .unwrap();
|
29651 31218 | #[allow(unused_mut)]
|
29652 31219 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
29653 31220 | let config = crate::service::RestJsonConfig::builder().build();
|
29654 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
31221 + | let service =
|
31222 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
31223 + | config,
|
31224 + | )
|
29655 31225 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
29656 31226 | let sender = sender.clone();
|
29657 31227 | async move {
|
29658 31228 | let result = {
|
29659 31229 | let expected = crate::input::JsonUnionsInput {
|
29660 31230 | contents: ::std::option::Option::Some(
|
29661 31231 | crate::model::MyUnion::TimestampValue(
|
29662 31232 | ::aws_smithy_types::DateTime::from_fractional_secs(
|
29663 31233 | 1398796238, 0_f64,
|
29664 31234 | ),
|
29665 31235 | ),
|
29666 31236 | ),
|
29667 31237 | };
|
29668 31238 | ::pretty_assertions::assert_eq!(input, expected);
|
29669 31239 | let output = crate::output::JsonUnionsOutput {
|
29670 31240 | contents: ::std::option::Option::None,
|
29671 31241 | };
|
29672 31242 | Ok(output)
|
29673 31243 | };
|
29674 31244 | sender.send(()).await.expect("receiver dropped early");
|
29675 31245 | result
|
29676 31246 | }
|
29677 31247 | })
|
29678 31248 | .build_unchecked();
|
29679 31249 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
29680 31250 | .await
|
29681 31251 | .expect("unable to make an HTTP request");
|
29682 31252 | assert!(
|
29683 31253 | receiver.recv().await.is_some(),
|
29684 31254 | "we expected operation handler to be invoked but it was not entered"
|
29685 31255 | );
|
29686 31256 | }
|
29687 31257 |
|
29688 31258 | /// Serializes an enum union value
|
29689 31259 | /// Test ID: RestJsonSerializeEnumUnionValue
|
29690 31260 | #[::tokio::test]
|
29691 31261 | #[::tracing_test::traced_test]
|
29692 31262 | async fn rest_json_serialize_enum_union_value_request() {
|
29693 31263 | #[allow(unused_mut)]
|
29694 - | let mut http_request = http::Request::builder()
|
31264 + | let mut http_request = ::http_1x::Request::builder()
|
29695 31265 | .uri("/JsonUnions")
|
29696 31266 | .method("PUT")
|
29697 31267 | .header("Content-Type", "application/json")
|
29698 - | .body(::aws_smithy_http_server::body::Body::from(
|
29699 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
29700 - | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}".as_bytes(),
|
29701 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
31268 + | .body(::aws_smithy_http_server::body::boxed(
|
31269 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
31270 + | &::aws_smithy_protocol_test::decode_body_data(
|
31271 + | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}"
|
31272 + | .as_bytes(),
|
31273 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
31274 + | ),
|
29702 31275 | )),
|
29703 31276 | ))
|
29704 31277 | .unwrap();
|
29705 31278 | #[allow(unused_mut)]
|
29706 31279 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
29707 31280 | let config = crate::service::RestJsonConfig::builder().build();
|
29708 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29709 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
29710 - | let sender = sender.clone();
|
29711 - | async move {
|
29712 - | let result = {
|
29713 - | let expected = crate::input::JsonUnionsInput {
|
29714 - | contents: ::std::option::Option::Some(
|
29715 - | crate::model::MyUnion::EnumValue(
|
29716 - | "Foo"
|
29717 - | .parse::<crate::model::FooEnum>()
|
29718 - | .expect("static value validated to member"),
|
29719 - | ),
|
29720 - | ),
|
29721 - | };
|
29722 - | ::pretty_assertions::assert_eq!(input, expected);
|
29723 - | let output = crate::output::JsonUnionsOutput {
|
29724 - | contents: ::std::option::Option::None,
|
29725 - | };
|
29726 - | Ok(output)
|
31281 + | let service = crate::service::RestJson::builder::<
|
31282 + | ::aws_smithy_http_server::body::BoxBody,
|
31283 + | _,
|
31284 + | _,
|
31285 + | _,
|
31286 + | >(config)
|
31287 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
31288 + | let sender = sender.clone();
|
31289 + | async move {
|
31290 + | let result = {
|
31291 + | let expected = crate::input::JsonUnionsInput {
|
31292 + | contents: ::std::option::Option::Some(crate::model::MyUnion::EnumValue(
|
31293 + | "Foo"
|
31294 + | .parse::<crate::model::FooEnum>()
|
31295 + | .expect("static value validated to member"),
|
31296 + | )),
|
29727 31297 | };
|
29728 - | sender.send(()).await.expect("receiver dropped early");
|
29729 - | result
|
29730 - | }
|
29731 - | })
|
29732 - | .build_unchecked();
|
31298 + | ::pretty_assertions::assert_eq!(input, expected);
|
31299 + | let output = crate::output::JsonUnionsOutput {
|
31300 + | contents: ::std::option::Option::None,
|
31301 + | };
|
31302 + | Ok(output)
|
31303 + | };
|
31304 + | sender.send(()).await.expect("receiver dropped early");
|
31305 + | result
|
31306 + | }
|
31307 + | })
|
31308 + | .build_unchecked();
|
29733 31309 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
29734 31310 | .await
|
29735 31311 | .expect("unable to make an HTTP request");
|
29736 31312 | assert!(
|
29737 31313 | receiver.recv().await.is_some(),
|
29738 31314 | "we expected operation handler to be invoked but it was not entered"
|
29739 31315 | );
|
29740 31316 | }
|
29741 31317 |
|
29742 31318 | /// Serializes a list union value
|
29743 31319 | /// Test ID: RestJsonSerializeListUnionValue
|
29744 31320 | #[::tokio::test]
|
29745 31321 | #[::tracing_test::traced_test]
|
29746 31322 | async fn rest_json_serialize_list_union_value_request() {
|
29747 31323 | #[allow(unused_mut)]
|
29748 - | let mut http_request = http::Request::builder()
|
29749 - | .uri("/JsonUnions")
|
29750 - | .method("PUT")
|
29751 - | .header("Content-Type", "application/json")
|
29752 - | .body(::aws_smithy_http_server::body::Body::from(
|
29753 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
29754 - | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}"
|
29755 - | .as_bytes(),
|
29756 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
29757 - | )),
|
29758 - | ))
|
29759 - | .unwrap();
|
31324 + | let mut http_request = ::http_1x::Request::builder()
|
31325 + | .uri("/JsonUnions")
|
31326 + | .method("PUT")
|
31327 + | .header("Content-Type", "application/json")
|
31328 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
31329 + | ::bytes::Bytes::copy_from_slice(
|
31330 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
31331 + | )
|
31332 + | ))).unwrap();
|
29760 31333 | #[allow(unused_mut)]
|
29761 31334 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
29762 31335 | let config = crate::service::RestJsonConfig::builder().build();
|
29763 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29764 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
29765 - | let sender = sender.clone();
|
29766 - | async move {
|
29767 - | let result = {
|
29768 - | let expected = crate::input::JsonUnionsInput {
|
29769 - | contents: ::std::option::Option::Some(
|
29770 - | crate::model::MyUnion::ListValue(vec![
|
29771 - | "foo".to_owned(),
|
29772 - | "bar".to_owned(),
|
29773 - | ]),
|
29774 - | ),
|
29775 - | };
|
29776 - | ::pretty_assertions::assert_eq!(input, expected);
|
29777 - | let output = crate::output::JsonUnionsOutput {
|
29778 - | contents: ::std::option::Option::None,
|
29779 - | };
|
29780 - | Ok(output)
|
31336 + | let service = crate::service::RestJson::builder::<
|
31337 + | ::aws_smithy_http_server::body::BoxBody,
|
31338 + | _,
|
31339 + | _,
|
31340 + | _,
|
31341 + | >(config)
|
31342 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
31343 + | let sender = sender.clone();
|
31344 + | async move {
|
31345 + | let result = {
|
31346 + | let expected = crate::input::JsonUnionsInput {
|
31347 + | contents: ::std::option::Option::Some(crate::model::MyUnion::ListValue(
|
31348 + | vec!["foo".to_owned(), "bar".to_owned()],
|
31349 + | )),
|
29781 31350 | };
|
29782 - | sender.send(()).await.expect("receiver dropped early");
|
29783 - | result
|
29784 - | }
|
29785 - | })
|
29786 - | .build_unchecked();
|
31351 + | ::pretty_assertions::assert_eq!(input, expected);
|
31352 + | let output = crate::output::JsonUnionsOutput {
|
31353 + | contents: ::std::option::Option::None,
|
31354 + | };
|
31355 + | Ok(output)
|
31356 + | };
|
31357 + | sender.send(()).await.expect("receiver dropped early");
|
31358 + | result
|
31359 + | }
|
31360 + | })
|
31361 + | .build_unchecked();
|
29787 31362 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
29788 31363 | .await
|
29789 31364 | .expect("unable to make an HTTP request");
|
29790 31365 | assert!(
|
29791 31366 | receiver.recv().await.is_some(),
|
29792 31367 | "we expected operation handler to be invoked but it was not entered"
|
29793 31368 | );
|
29794 31369 | }
|
29795 31370 |
|
29796 31371 | /// Serializes a map union value
|
29797 31372 | /// Test ID: RestJsonSerializeMapUnionValue
|
29798 31373 | #[::tokio::test]
|
29799 31374 | #[::tracing_test::traced_test]
|
29800 31375 | async fn rest_json_serialize_map_union_value_request() {
|
29801 31376 | #[allow(unused_mut)]
|
29802 - | let mut http_request = http::Request::builder()
|
31377 + | let mut http_request = ::http_1x::Request::builder()
|
29803 31378 | .uri("/JsonUnions")
|
29804 31379 | .method("PUT")
|
29805 31380 | .header("Content-Type", "application/json")
|
29806 - | .body(::aws_smithy_http_server::body::Body::from(
|
29807 - | ::bytes::Bytes::copy_from_slice(
|
29808 - | &::aws_smithy_protocol_test::decode_body_data("{\n \"contents\": {\n \"mapValue\": {\n \"foo\": \"bar\",\n \"spam\": \"eggs\"\n }\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
29809 - | )
|
29810 - | )).unwrap();
|
31381 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
31382 + | ::bytes::Bytes::copy_from_slice(
|
31383 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"contents\": {\n \"mapValue\": {\n \"foo\": \"bar\",\n \"spam\": \"eggs\"\n }\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
31384 + | )
|
31385 + | ))).unwrap();
|
29811 31386 | #[allow(unused_mut)]
|
29812 31387 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
29813 31388 | let config = crate::service::RestJsonConfig::builder().build();
|
29814 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29815 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
29816 - | let sender = sender.clone();
|
29817 - | async move {
|
29818 - | let result = {
|
29819 - | let expected = crate::input::JsonUnionsInput {
|
29820 - | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue(
|
29821 - | {
|
29822 - | let mut ret = ::std::collections::HashMap::new();
|
29823 - | ret.insert("foo".to_owned(), "bar".to_owned());
|
29824 - | ret.insert("spam".to_owned(), "eggs".to_owned());
|
29825 - | ret
|
29826 - | },
|
29827 - | )),
|
29828 - | };
|
29829 - | ::pretty_assertions::assert_eq!(input, expected);
|
29830 - | let output = crate::output::JsonUnionsOutput {
|
29831 - | contents: ::std::option::Option::None,
|
29832 - | };
|
29833 - | Ok(output)
|
31389 + | let service = crate::service::RestJson::builder::<
|
31390 + | ::aws_smithy_http_server::body::BoxBody,
|
31391 + | _,
|
31392 + | _,
|
31393 + | _,
|
31394 + | >(config)
|
31395 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
31396 + | let sender = sender.clone();
|
31397 + | async move {
|
31398 + | let result = {
|
31399 + | let expected = crate::input::JsonUnionsInput {
|
31400 + | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue({
|
31401 + | let mut ret = ::std::collections::HashMap::new();
|
31402 + | ret.insert("foo".to_owned(), "bar".to_owned());
|
31403 + | ret.insert("spam".to_owned(), "eggs".to_owned());
|
31404 + | ret
|
31405 + | })),
|
29834 31406 | };
|
29835 - | sender.send(()).await.expect("receiver dropped early");
|
29836 - | result
|
29837 - | }
|
29838 - | })
|
29839 - | .build_unchecked();
|
31407 + | ::pretty_assertions::assert_eq!(input, expected);
|
31408 + | let output = crate::output::JsonUnionsOutput {
|
31409 + | contents: ::std::option::Option::None,
|
31410 + | };
|
31411 + | Ok(output)
|
31412 + | };
|
31413 + | sender.send(()).await.expect("receiver dropped early");
|
31414 + | result
|
31415 + | }
|
31416 + | })
|
31417 + | .build_unchecked();
|
29840 31418 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
29841 31419 | .await
|
29842 31420 | .expect("unable to make an HTTP request");
|
29843 31421 | assert!(
|
29844 31422 | receiver.recv().await.is_some(),
|
29845 31423 | "we expected operation handler to be invoked but it was not entered"
|
29846 31424 | );
|
29847 31425 | }
|
29848 31426 |
|
29849 31427 | /// Serializes a structure union value
|
29850 31428 | /// Test ID: RestJsonSerializeStructureUnionValue
|
29851 31429 | #[::tokio::test]
|
29852 31430 | #[::tracing_test::traced_test]
|
29853 31431 | async fn rest_json_serialize_structure_union_value_request() {
|
29854 31432 | #[allow(unused_mut)]
|
29855 - | let mut http_request = http::Request::builder()
|
31433 + | let mut http_request = ::http_1x::Request::builder()
|
29856 31434 | .uri("/JsonUnions")
|
29857 31435 | .method("PUT")
|
29858 31436 | .header("Content-Type", "application/json")
|
29859 - | .body(::aws_smithy_http_server::body::Body::from(
|
29860 - | ::bytes::Bytes::copy_from_slice(
|
29861 - | &::aws_smithy_protocol_test::decode_body_data("{\n \"contents\": {\n \"structureValue\": {\n \"hi\": \"hello\"\n }\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
29862 - | )
|
29863 - | )).unwrap();
|
31437 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
31438 + | ::bytes::Bytes::copy_from_slice(
|
31439 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"contents\": {\n \"structureValue\": {\n \"hi\": \"hello\"\n }\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
31440 + | )
|
31441 + | ))).unwrap();
|
29864 31442 | #[allow(unused_mut)]
|
29865 31443 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
29866 31444 | let config = crate::service::RestJsonConfig::builder().build();
|
29867 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29868 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
29869 - | let sender = sender.clone();
|
29870 - | async move {
|
29871 - | let result = {
|
29872 - | let expected = crate::input::JsonUnionsInput {
|
29873 - | contents: ::std::option::Option::Some(
|
29874 - | crate::model::MyUnion::StructureValue(
|
29875 - | crate::model::GreetingStruct {
|
29876 - | hi: ::std::option::Option::Some("hello".to_owned()),
|
29877 - | },
|
29878 - | ),
|
29879 - | ),
|
29880 - | };
|
29881 - | ::pretty_assertions::assert_eq!(input, expected);
|
29882 - | let output = crate::output::JsonUnionsOutput {
|
29883 - | contents: ::std::option::Option::None,
|
29884 - | };
|
29885 - | Ok(output)
|
31445 + | let service = crate::service::RestJson::builder::<
|
31446 + | ::aws_smithy_http_server::body::BoxBody,
|
31447 + | _,
|
31448 + | _,
|
31449 + | _,
|
31450 + | >(config)
|
31451 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
31452 + | let sender = sender.clone();
|
31453 + | async move {
|
31454 + | let result = {
|
31455 + | let expected = crate::input::JsonUnionsInput {
|
31456 + | contents: ::std::option::Option::Some(
|
31457 + | crate::model::MyUnion::StructureValue(crate::model::GreetingStruct {
|
31458 + | hi: ::std::option::Option::Some("hello".to_owned()),
|
31459 + | }),
|
31460 + | ),
|
29886 31461 | };
|
29887 - | sender.send(()).await.expect("receiver dropped early");
|
29888 - | result
|
29889 - | }
|
29890 - | })
|
29891 - | .build_unchecked();
|
31462 + | ::pretty_assertions::assert_eq!(input, expected);
|
31463 + | let output = crate::output::JsonUnionsOutput {
|
31464 + | contents: ::std::option::Option::None,
|
31465 + | };
|
31466 + | Ok(output)
|
31467 + | };
|
31468 + | sender.send(()).await.expect("receiver dropped early");
|
31469 + | result
|
31470 + | }
|
31471 + | })
|
31472 + | .build_unchecked();
|
29892 31473 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
29893 31474 | .await
|
29894 31475 | .expect("unable to make an HTTP request");
|
29895 31476 | assert!(
|
29896 31477 | receiver.recv().await.is_some(),
|
29897 31478 | "we expected operation handler to be invoked but it was not entered"
|
29898 31479 | );
|
29899 31480 | }
|
29900 31481 |
|
29901 31482 | /// Serializes a renamed structure union value
|
29902 31483 | /// Test ID: RestJsonSerializeRenamedStructureUnionValue
|
29903 31484 | #[::tokio::test]
|
29904 31485 | #[::tracing_test::traced_test]
|
29905 31486 | async fn rest_json_serialize_renamed_structure_union_value_request() {
|
29906 31487 | #[allow(unused_mut)]
|
29907 - | let mut http_request = http::Request::builder()
|
31488 + | let mut http_request = ::http_1x::Request::builder()
|
29908 31489 | .uri("/JsonUnions")
|
29909 31490 | .method("PUT")
|
29910 31491 | .header("Content-Type", "application/json")
|
29911 - | .body(::aws_smithy_http_server::body::Body::from(
|
29912 - | ::bytes::Bytes::copy_from_slice(
|
29913 - | &::aws_smithy_protocol_test::decode_body_data("{\n \"contents\": {\n \"renamedStructureValue\": {\n \"salutation\": \"hello!\"\n }\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
29914 - | )
|
29915 - | )).unwrap();
|
31492 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
31493 + | ::bytes::Bytes::copy_from_slice(
|
31494 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"contents\": {\n \"renamedStructureValue\": {\n \"salutation\": \"hello!\"\n }\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
31495 + | )
|
31496 + | ))).unwrap();
|
29916 31497 | #[allow(unused_mut)]
|
29917 31498 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
29918 31499 | let config = crate::service::RestJsonConfig::builder().build();
|
29919 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
29920 - | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
29921 - | let sender = sender.clone();
|
29922 - | async move {
|
29923 - | let result = {
|
29924 - | let expected = crate::input::JsonUnionsInput {
|
29925 - | contents: ::std::option::Option::Some(
|
29926 - | crate::model::MyUnion::RenamedStructureValue(
|
29927 - | crate::model::RenamedGreeting {
|
29928 - | salutation: ::std::option::Option::Some(
|
29929 - | "hello!".to_owned(),
|
29930 - | ),
|
29931 - | },
|
29932 - | ),
|
31500 + | let service = crate::service::RestJson::builder::<
|
31501 + | ::aws_smithy_http_server::body::BoxBody,
|
31502 + | _,
|
31503 + | _,
|
31504 + | _,
|
31505 + | >(config)
|
31506 + | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
31507 + | let sender = sender.clone();
|
31508 + | async move {
|
31509 + | let result = {
|
31510 + | let expected = crate::input::JsonUnionsInput {
|
31511 + | contents: ::std::option::Option::Some(
|
31512 + | crate::model::MyUnion::RenamedStructureValue(
|
31513 + | crate::model::RenamedGreeting {
|
31514 + | salutation: ::std::option::Option::Some("hello!".to_owned()),
|
31515 + | },
|
29933 31516 | ),
|
29934 - | };
|
29935 - | ::pretty_assertions::assert_eq!(input, expected);
|
29936 - | let output = crate::output::JsonUnionsOutput {
|
29937 - | contents: ::std::option::Option::None,
|
29938 - | };
|
29939 - | Ok(output)
|
31517 + | ),
|
29940 31518 | };
|
29941 - | sender.send(()).await.expect("receiver dropped early");
|
29942 - | result
|
29943 - | }
|
29944 - | })
|
29945 - | .build_unchecked();
|
31519 + | ::pretty_assertions::assert_eq!(input, expected);
|
31520 + | let output = crate::output::JsonUnionsOutput {
|
31521 + | contents: ::std::option::Option::None,
|
31522 + | };
|
31523 + | Ok(output)
|
31524 + | };
|
31525 + | sender.send(()).await.expect("receiver dropped early");
|
31526 + | result
|
31527 + | }
|
31528 + | })
|
31529 + | .build_unchecked();
|
29946 31530 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
29947 31531 | .await
|
29948 31532 | .expect("unable to make an HTTP request");
|
29949 31533 | assert!(
|
29950 31534 | receiver.recv().await.is_some(),
|
29951 31535 | "we expected operation handler to be invoked but it was not entered"
|
29952 31536 | );
|
29953 31537 | }
|
29954 31538 |
|
29955 31539 | /// Deserializes a string union value
|
29956 31540 | /// Test ID: RestJsonDeserializeStringUnionValue
|
29957 31541 | #[::tokio::test]
|
29958 31542 | #[::tracing_test::traced_test]
|
29959 31543 | async fn rest_json_deserialize_string_union_value_response() {
|
29960 31544 | let output = crate::output::JsonUnionsOutput {
|
29961 31545 | contents: ::std::option::Option::Some(crate::model::MyUnion::StringValue(
|
29962 31546 | "foo".to_owned(),
|
29963 31547 | )),
|
29964 31548 | };
|
29965 31549 | use ::aws_smithy_http_server::response::IntoResponse;
|
29966 31550 | let http_response = output.into_response();
|
29967 31551 | ::pretty_assertions::assert_eq!(
|
29968 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
31552 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
29969 31553 | http_response.status()
|
29970 31554 | );
|
29971 31555 | let expected_headers = [("Content-Type", "application/json")];
|
29972 31556 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
29973 31557 | http_response.headers(),
|
29974 31558 | expected_headers,
|
29975 31559 | ));
|
29976 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
31560 + | use ::http_body_util::BodyExt;
|
31561 + | let body = http_response
|
31562 + | .into_body()
|
31563 + | .collect()
|
29977 31564 | .await
|
29978 - | .expect("unable to extract body to bytes");
|
31565 + | .expect("unable to collect body")
|
31566 + | .to_bytes();
|
29979 31567 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
29980 31568 | &body,
|
29981 31569 | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}",
|
29982 31570 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
29983 31571 | ));
|
29984 31572 | }
|
29985 31573 |
|
29986 31574 | /// Deserializes a boolean union value
|
29987 31575 | /// Test ID: RestJsonDeserializeBooleanUnionValue
|
29988 31576 | #[::tokio::test]
|
29989 31577 | #[::tracing_test::traced_test]
|
29990 31578 | async fn rest_json_deserialize_boolean_union_value_response() {
|
29991 31579 | let output = crate::output::JsonUnionsOutput {
|
29992 31580 | contents: ::std::option::Option::Some(crate::model::MyUnion::BooleanValue(true)),
|
29993 31581 | };
|
29994 31582 | use ::aws_smithy_http_server::response::IntoResponse;
|
29995 31583 | let http_response = output.into_response();
|
29996 31584 | ::pretty_assertions::assert_eq!(
|
29997 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
31585 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
29998 31586 | http_response.status()
|
29999 31587 | );
|
30000 31588 | let expected_headers = [("Content-Type", "application/json")];
|
30001 31589 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
30002 31590 | http_response.headers(),
|
30003 31591 | expected_headers,
|
30004 31592 | ));
|
30005 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
31593 + | use ::http_body_util::BodyExt;
|
31594 + | let body = http_response
|
31595 + | .into_body()
|
31596 + | .collect()
|
30006 31597 | .await
|
30007 - | .expect("unable to extract body to bytes");
|
31598 + | .expect("unable to collect body")
|
31599 + | .to_bytes();
|
30008 31600 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
30009 31601 | &body,
|
30010 31602 | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}",
|
30011 31603 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30012 31604 | ));
|
30013 31605 | }
|
30014 31606 |
|
30015 31607 | /// Deserializes a number union value
|
30016 31608 | /// Test ID: RestJsonDeserializeNumberUnionValue
|
30017 31609 | #[::tokio::test]
|
30018 31610 | #[::tracing_test::traced_test]
|
30019 31611 | async fn rest_json_deserialize_number_union_value_response() {
|
30020 31612 | let output = crate::output::JsonUnionsOutput {
|
30021 31613 | contents: ::std::option::Option::Some(crate::model::MyUnion::NumberValue(1)),
|
30022 31614 | };
|
30023 31615 | use ::aws_smithy_http_server::response::IntoResponse;
|
30024 31616 | let http_response = output.into_response();
|
30025 31617 | ::pretty_assertions::assert_eq!(
|
30026 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
31618 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
30027 31619 | http_response.status()
|
30028 31620 | );
|
30029 31621 | let expected_headers = [("Content-Type", "application/json")];
|
30030 31622 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
30031 31623 | http_response.headers(),
|
30032 31624 | expected_headers,
|
30033 31625 | ));
|
30034 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
31626 + | use ::http_body_util::BodyExt;
|
31627 + | let body = http_response
|
31628 + | .into_body()
|
31629 + | .collect()
|
30035 31630 | .await
|
30036 - | .expect("unable to extract body to bytes");
|
31631 + | .expect("unable to collect body")
|
31632 + | .to_bytes();
|
30037 31633 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
30038 31634 | &body,
|
30039 31635 | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}",
|
30040 31636 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30041 31637 | ));
|
30042 31638 | }
|
30043 31639 |
|
30044 31640 | /// Deserializes a blob union value
|
30045 31641 | /// Test ID: RestJsonDeserializeBlobUnionValue
|
30046 31642 | #[::tokio::test]
|
30047 31643 | #[::tracing_test::traced_test]
|
30048 31644 | async fn rest_json_deserialize_blob_union_value_response() {
|
30049 31645 | let output = crate::output::JsonUnionsOutput {
|
30050 31646 | contents: ::std::option::Option::Some(crate::model::MyUnion::BlobValue(
|
30051 31647 | ::aws_smithy_types::Blob::new("foo"),
|
30052 31648 | )),
|
30053 31649 | };
|
30054 31650 | use ::aws_smithy_http_server::response::IntoResponse;
|
30055 31651 | let http_response = output.into_response();
|
30056 31652 | ::pretty_assertions::assert_eq!(
|
30057 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
31653 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
30058 31654 | http_response.status()
|
30059 31655 | );
|
30060 31656 | let expected_headers = [("Content-Type", "application/json")];
|
30061 31657 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
30062 31658 | http_response.headers(),
|
30063 31659 | expected_headers,
|
30064 31660 | ));
|
30065 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
31661 + | use ::http_body_util::BodyExt;
|
31662 + | let body = http_response
|
31663 + | .into_body()
|
31664 + | .collect()
|
30066 31665 | .await
|
30067 - | .expect("unable to extract body to bytes");
|
31666 + | .expect("unable to collect body")
|
31667 + | .to_bytes();
|
30068 31668 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
30069 31669 | &body,
|
30070 31670 | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}",
|
30071 31671 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30072 31672 | ));
|
30073 31673 | }
|
30074 31674 |
|
30075 31675 | /// Deserializes a timestamp union value
|
30076 31676 | /// Test ID: RestJsonDeserializeTimestampUnionValue
|
30077 31677 | #[::tokio::test]
|
30078 31678 | #[::tracing_test::traced_test]
|
30079 31679 | async fn rest_json_deserialize_timestamp_union_value_response() {
|
30080 31680 | let output = crate::output::JsonUnionsOutput {
|
30081 31681 | contents: ::std::option::Option::Some(crate::model::MyUnion::TimestampValue(
|
30082 31682 | ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
|
30083 31683 | )),
|
30084 31684 | };
|
30085 31685 | use ::aws_smithy_http_server::response::IntoResponse;
|
30086 31686 | let http_response = output.into_response();
|
30087 31687 | ::pretty_assertions::assert_eq!(
|
30088 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
31688 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
30089 31689 | http_response.status()
|
30090 31690 | );
|
30091 31691 | let expected_headers = [("Content-Type", "application/json")];
|
30092 31692 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
30093 31693 | http_response.headers(),
|
30094 31694 | expected_headers,
|
30095 31695 | ));
|
30096 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
31696 + | use ::http_body_util::BodyExt;
|
31697 + | let body = http_response
|
31698 + | .into_body()
|
31699 + | .collect()
|
30097 31700 | .await
|
30098 - | .expect("unable to extract body to bytes");
|
31701 + | .expect("unable to collect body")
|
31702 + | .to_bytes();
|
30099 31703 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
30100 31704 | &body,
|
30101 31705 | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}",
|
30102 31706 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30103 31707 | ));
|
30104 31708 | }
|
30105 31709 |
|
30106 31710 | /// Deserializes an enum union value
|
30107 31711 | /// Test ID: RestJsonDeserializeEnumUnionValue
|
30108 31712 | #[::tokio::test]
|
30109 31713 | #[::tracing_test::traced_test]
|
30110 31714 | async fn rest_json_deserialize_enum_union_value_response() {
|
30111 31715 | let output = crate::output::JsonUnionsOutput {
|
30112 31716 | contents: ::std::option::Option::Some(crate::model::MyUnion::EnumValue(
|
30113 31717 | "Foo"
|
30114 31718 | .parse::<crate::model::FooEnum>()
|
30115 31719 | .expect("static value validated to member"),
|
30116 31720 | )),
|
30117 31721 | };
|
30118 31722 | use ::aws_smithy_http_server::response::IntoResponse;
|
30119 31723 | let http_response = output.into_response();
|
30120 31724 | ::pretty_assertions::assert_eq!(
|
30121 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
31725 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
30122 31726 | http_response.status()
|
30123 31727 | );
|
30124 31728 | let expected_headers = [("Content-Type", "application/json")];
|
30125 31729 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
30126 31730 | http_response.headers(),
|
30127 31731 | expected_headers,
|
30128 31732 | ));
|
30129 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
31733 + | use ::http_body_util::BodyExt;
|
31734 + | let body = http_response
|
31735 + | .into_body()
|
31736 + | .collect()
|
30130 31737 | .await
|
30131 - | .expect("unable to extract body to bytes");
|
31738 + | .expect("unable to collect body")
|
31739 + | .to_bytes();
|
30132 31740 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
30133 31741 | &body,
|
30134 31742 | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}",
|
30135 31743 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30136 31744 | ));
|
30137 31745 | }
|
30138 31746 |
|
30139 31747 | /// Deserializes a list union value
|
30140 31748 | /// Test ID: RestJsonDeserializeListUnionValue
|
30141 31749 | #[::tokio::test]
|
30142 31750 | #[::tracing_test::traced_test]
|
30143 31751 | async fn rest_json_deserialize_list_union_value_response() {
|
30144 31752 | let output = crate::output::JsonUnionsOutput {
|
30145 31753 | contents: ::std::option::Option::Some(crate::model::MyUnion::ListValue(vec![
|
30146 31754 | "foo".to_owned(),
|
30147 31755 | "bar".to_owned(),
|
30148 31756 | ])),
|
30149 31757 | };
|
30150 31758 | use ::aws_smithy_http_server::response::IntoResponse;
|
30151 31759 | let http_response = output.into_response();
|
30152 31760 | ::pretty_assertions::assert_eq!(
|
30153 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
31761 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
30154 31762 | http_response.status()
|
30155 31763 | );
|
30156 31764 | let expected_headers = [("Content-Type", "application/json")];
|
30157 31765 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
30158 31766 | http_response.headers(),
|
30159 31767 | expected_headers,
|
30160 31768 | ));
|
30161 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
31769 + | use ::http_body_util::BodyExt;
|
31770 + | let body = http_response
|
31771 + | .into_body()
|
31772 + | .collect()
|
30162 31773 | .await
|
30163 - | .expect("unable to extract body to bytes");
|
31774 + | .expect("unable to collect body")
|
31775 + | .to_bytes();
|
30164 31776 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
30165 31777 | &body,
|
30166 31778 | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}",
|
30167 31779 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30168 31780 | ));
|
30169 31781 | }
|
30170 31782 |
|
30171 31783 | /// Deserializes a map union value
|
30172 31784 | /// Test ID: RestJsonDeserializeMapUnionValue
|
30173 31785 | #[::tokio::test]
|
30174 31786 | #[::tracing_test::traced_test]
|
30175 31787 | async fn rest_json_deserialize_map_union_value_response() {
|
30176 31788 | let output = crate::output::JsonUnionsOutput {
|
30177 31789 | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue({
|
30178 31790 | let mut ret = ::std::collections::HashMap::new();
|
30179 31791 | ret.insert("foo".to_owned(), "bar".to_owned());
|
30180 31792 | ret.insert("spam".to_owned(), "eggs".to_owned());
|
30181 31793 | ret
|
30182 31794 | })),
|
30183 31795 | };
|
30184 31796 | use ::aws_smithy_http_server::response::IntoResponse;
|
30185 31797 | let http_response = output.into_response();
|
30186 31798 | ::pretty_assertions::assert_eq!(
|
30187 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
31799 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
30188 31800 | http_response.status()
|
30189 31801 | );
|
30190 31802 | let expected_headers = [("Content-Type", "application/json")];
|
30191 31803 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
30192 31804 | http_response.headers(),
|
30193 31805 | expected_headers,
|
30194 31806 | ));
|
30195 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
31807 + | use ::http_body_util::BodyExt;
|
31808 + | let body = http_response
|
31809 + | .into_body()
|
31810 + | .collect()
|
30196 31811 | .await
|
30197 - | .expect("unable to extract body to bytes");
|
31812 + | .expect("unable to collect body")
|
31813 + | .to_bytes();
|
30198 31814 | ::aws_smithy_protocol_test::assert_ok(
|
30199 31815 | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"contents\": {\n \"mapValue\": {\n \"foo\": \"bar\",\n \"spam\": \"eggs\"\n }\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
30200 31816 | );
|
30201 31817 | }
|
30202 31818 |
|
30203 31819 | /// Deserializes a structure union value
|
30204 31820 | /// Test ID: RestJsonDeserializeStructureUnionValue
|
30205 31821 | #[::tokio::test]
|
30206 31822 | #[::tracing_test::traced_test]
|
30207 31823 | async fn rest_json_deserialize_structure_union_value_response() {
|
30208 31824 | let output = crate::output::JsonUnionsOutput {
|
30209 31825 | contents: ::std::option::Option::Some(crate::model::MyUnion::StructureValue(
|
30210 31826 | crate::model::GreetingStruct {
|
30211 31827 | hi: ::std::option::Option::Some("hello".to_owned()),
|
30212 31828 | },
|
30213 31829 | )),
|
30214 31830 | };
|
30215 31831 | use ::aws_smithy_http_server::response::IntoResponse;
|
30216 31832 | let http_response = output.into_response();
|
30217 31833 | ::pretty_assertions::assert_eq!(
|
30218 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
31834 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
30219 31835 | http_response.status()
|
30220 31836 | );
|
30221 31837 | let expected_headers = [("Content-Type", "application/json")];
|
30222 31838 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
30223 31839 | http_response.headers(),
|
30224 31840 | expected_headers,
|
30225 31841 | ));
|
30226 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
31842 + | use ::http_body_util::BodyExt;
|
31843 + | let body = http_response
|
31844 + | .into_body()
|
31845 + | .collect()
|
30227 31846 | .await
|
30228 - | .expect("unable to extract body to bytes");
|
31847 + | .expect("unable to collect body")
|
31848 + | .to_bytes();
|
30229 31849 | ::aws_smithy_protocol_test::assert_ok(
|
30230 31850 | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"contents\": {\n \"structureValue\": {\n \"hi\": \"hello\"\n }\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
30231 31851 | );
|
30232 31852 | }
|
31853 + |
|
31854 + | /* ProtocolTestGenerator.kt:98 */
|
30233 31855 | }
|
30234 31856 |
|
31857 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
30235 31858 | ::pin_project_lite::pin_project! {
|
30236 31859 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
30237 31860 | /// [`DocumentTypeAsMapValueInput`](crate::input::DocumentTypeAsMapValueInput) using modelled bindings.
|
30238 31861 | pub struct DocumentTypeAsMapValueInputFuture {
|
30239 31862 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::DocumentTypeAsMapValueInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
30240 31863 | }
|
30241 31864 | }
|
30242 31865 |
|
30243 31866 | impl std::future::Future for DocumentTypeAsMapValueInputFuture {
|
30244 31867 | type Output = Result<
|
30245 31868 | crate::input::DocumentTypeAsMapValueInput,
|
30246 31869 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
30247 31870 | >;
|
30248 31871 |
|
30249 31872 | fn poll(
|
30250 31873 | self: std::pin::Pin<&mut Self>,
|
30251 31874 | cx: &mut std::task::Context<'_>,
|
30252 31875 | ) -> std::task::Poll<Self::Output> {
|
30253 31876 | let this = self.project();
|
30254 31877 | this.inner.as_mut().poll(cx)
|
30255 31878 | }
|
30256 31879 | }
|
30257 31880 |
|
30258 31881 | impl<B>
|
30259 31882 | ::aws_smithy_http_server::request::FromRequest<
|
30260 31883 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
30261 31884 | B,
|
30262 31885 | > for crate::input::DocumentTypeAsMapValueInput
|
30263 31886 | where
|
30264 31887 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
30265 31888 | B: 'static,
|
30266 31889 |
|
30267 31890 | B::Data: Send,
|
30268 31891 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
30269 31892 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
30270 31893 | {
|
30271 31894 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
30272 31895 | type Future = DocumentTypeAsMapValueInputFuture;
|
30273 31896 |
|
30274 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
31897 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
30275 31898 | let fut = async move {
|
30276 31899 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
30277 31900 | request.headers(),
|
30278 31901 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
30279 31902 | ) {
|
30280 31903 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
30281 31904 | }
|
30282 31905 | crate::protocol_serde::shape_document_type_as_map_value::de_document_type_as_map_value_http_request(request)
|
30283 31906 | .await
|
30284 31907 | };
|
30285 31908 | use ::futures_util::future::TryFutureExt;
|
30286 31909 | let fut = fut.map_err(
|
30287 31910 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
30288 31911 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
30289 31912 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
30290 31913 | e,
|
30291 31914 | )
|
30292 31915 | },
|
30293 31916 | );
|
30294 31917 | DocumentTypeAsMapValueInputFuture {
|
30295 31918 | inner: Box::pin(fut),
|
30296 31919 | }
|
30297 31920 | }
|
30298 31921 | }
|
31922 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
30299 31923 | impl
|
30300 31924 | ::aws_smithy_http_server::response::IntoResponse<
|
30301 31925 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
30302 31926 | > for crate::output::DocumentTypeAsMapValueOutput
|
30303 31927 | {
|
30304 31928 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
30305 31929 | match crate::protocol_serde::shape_document_type_as_map_value::ser_document_type_as_map_value_http_response(self) {
|
30306 31930 | Ok(response) => response,
|
30307 31931 | Err(e) => {
|
30308 31932 | ::tracing::error!(error = %e, "failed to serialize response");
|
30309 31933 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
30310 31934 | }
|
30311 31935 | }
|
30312 31936 | }
|
30313 31937 | }
|
30314 31938 |
|
31939 + | /* RustType.kt:534 */
|
30315 31940 | #[allow(unreachable_code, unused_variables)]
|
31941 + | /* RustType.kt:534 */
|
30316 31942 | #[cfg(test)]
|
31943 + | /* ProtocolTestGenerator.kt:98 */
|
30317 31944 | mod document_type_as_map_value_test {
|
30318 31945 |
|
30319 31946 | /// Serializes a map that uses documents as the value.
|
30320 31947 | /// Test ID: DocumentTypeAsMapValueInput
|
30321 31948 | #[::tokio::test]
|
30322 31949 | #[::tracing_test::traced_test]
|
30323 31950 | async fn document_type_as_map_value_input_request() {
|
30324 31951 | #[allow(unused_mut)]
|
30325 - | let mut http_request = http::Request::builder()
|
31952 + | let mut http_request = ::http_1x::Request::builder()
|
30326 31953 | .uri("/DocumentTypeAsMapValue")
|
30327 31954 | .method("PUT")
|
30328 31955 | .header("Content-Type", "application/json")
|
30329 - | .body(::aws_smithy_http_server::body::Body::from(
|
30330 - | ::bytes::Bytes::copy_from_slice(
|
30331 - | &::aws_smithy_protocol_test::decode_body_data("{\n \"docValuedMap\": {\n \"foo\": { \"f\": 1, \"o\": 2 },\n \"bar\": [ \"b\", \"a\", \"r\" ],\n \"baz\": \"BAZ\"\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
30332 - | )
|
30333 - | )).unwrap();
|
31956 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
31957 + | ::bytes::Bytes::copy_from_slice(
|
31958 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"docValuedMap\": {\n \"foo\": { \"f\": 1, \"o\": 2 },\n \"bar\": [ \"b\", \"a\", \"r\" ],\n \"baz\": \"BAZ\"\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
31959 + | )
|
31960 + | ))).unwrap();
|
30334 31961 | #[allow(unused_mut)]
|
30335 31962 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
30336 31963 | let config = crate::service::RestJsonConfig::builder().build();
|
30337 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
30338 - | .document_type_as_map_value(move |input: crate::input::DocumentTypeAsMapValueInput| {
|
30339 - | let sender = sender.clone();
|
30340 - | async move {
|
30341 - | let result = {
|
30342 - | let expected = crate::input::DocumentTypeAsMapValueInput {
|
30343 - | doc_valued_map: ::std::option::Option::Some({
|
30344 - | let mut ret = ::std::collections::HashMap::new();
|
30345 - | ret.insert("foo".to_owned(), {
|
30346 - | let json_bytes = br#"{
|
31964 + | let service = crate::service::RestJson::builder::<
|
31965 + | ::aws_smithy_http_server::body::BoxBody,
|
31966 + | _,
|
31967 + | _,
|
31968 + | _,
|
31969 + | >(config)
|
31970 + | .document_type_as_map_value(move |input: crate::input::DocumentTypeAsMapValueInput| {
|
31971 + | let sender = sender.clone();
|
31972 + | async move {
|
31973 + | let result = {
|
31974 + | let expected = crate::input::DocumentTypeAsMapValueInput {
|
31975 + | doc_valued_map: ::std::option::Option::Some({
|
31976 + | let mut ret = ::std::collections::HashMap::new();
|
31977 + | ret.insert("foo".to_owned(), {
|
31978 + | let json_bytes = br#"{
|
30347 31979 | "f": 1,
|
30348 31980 | "o": 2
|
30349 31981 | }"#;
|
30350 - | let mut tokens =
|
30351 - | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
30352 - | .peekable();
|
30353 - | ::aws_smithy_json::deserialize::token::expect_document(
|
30354 - | &mut tokens,
|
30355 - | )
|
31982 + | let mut tokens =
|
31983 + | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
31984 + | .peekable();
|
31985 + | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30356 31986 | .expect("well formed json")
|
30357 - | });
|
30358 - | ret.insert("bar".to_owned(), {
|
30359 - | let json_bytes = br#"[
|
31987 + | });
|
31988 + | ret.insert("bar".to_owned(), {
|
31989 + | let json_bytes = br#"[
|
30360 31990 | "b",
|
30361 31991 | "a",
|
30362 31992 | "r"
|
30363 31993 | ]"#;
|
30364 - | let mut tokens =
|
30365 - | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
30366 - | .peekable();
|
30367 - | ::aws_smithy_json::deserialize::token::expect_document(
|
30368 - | &mut tokens,
|
30369 - | )
|
31994 + | let mut tokens =
|
31995 + | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
31996 + | .peekable();
|
31997 + | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30370 31998 | .expect("well formed json")
|
30371 - | });
|
30372 - | ret.insert("baz".to_owned(), {
|
30373 - | let json_bytes = br#""BAZ""#;
|
30374 - | let mut tokens =
|
30375 - | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
30376 - | .peekable();
|
30377 - | ::aws_smithy_json::deserialize::token::expect_document(
|
30378 - | &mut tokens,
|
30379 - | )
|
31999 + | });
|
32000 + | ret.insert("baz".to_owned(), {
|
32001 + | let json_bytes = br#""BAZ""#;
|
32002 + | let mut tokens =
|
32003 + | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
32004 + | .peekable();
|
32005 + | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30380 32006 | .expect("well formed json")
|
30381 - | });
|
30382 - | ret
|
30383 - | }),
|
30384 - | };
|
30385 - | ::pretty_assertions::assert_eq!(input, expected);
|
30386 - | let output = crate::output::DocumentTypeAsMapValueOutput {
|
30387 - | doc_valued_map: ::std::option::Option::None,
|
30388 - | };
|
30389 - | output
|
32007 + | });
|
32008 + | ret
|
32009 + | }),
|
30390 32010 | };
|
30391 - | sender.send(()).await.expect("receiver dropped early");
|
30392 - | result
|
30393 - | }
|
30394 - | })
|
30395 - | .build_unchecked();
|
32011 + | ::pretty_assertions::assert_eq!(input, expected);
|
32012 + | let output = crate::output::DocumentTypeAsMapValueOutput {
|
32013 + | doc_valued_map: ::std::option::Option::None,
|
32014 + | };
|
32015 + | output
|
32016 + | };
|
32017 + | sender.send(()).await.expect("receiver dropped early");
|
32018 + | result
|
32019 + | }
|
32020 + | })
|
32021 + | .build_unchecked();
|
30396 32022 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
30397 32023 | .await
|
30398 32024 | .expect("unable to make an HTTP request");
|
30399 32025 | assert!(
|
30400 32026 | receiver.recv().await.is_some(),
|
30401 32027 | "we expected operation handler to be invoked but it was not entered"
|
30402 32028 | );
|
30403 32029 | }
|
30404 32030 |
|
30405 32031 | /// Serializes a map that uses documents as the value.
|
30406 32032 | /// Test ID: DocumentTypeAsMapValueOutput
|
30407 32033 | #[::tokio::test]
|
30408 32034 | #[::tracing_test::traced_test]
|
30409 32035 | async fn document_type_as_map_value_output_response() {
|
30410 32036 | let output = crate::output::DocumentTypeAsMapValueOutput {
|
30411 32037 | doc_valued_map: ::std::option::Option::Some({
|
30412 32038 | let mut ret = ::std::collections::HashMap::new();
|
30413 32039 | ret.insert("foo".to_owned(), {
|
30414 32040 | let json_bytes = br#"{
|
30415 32041 | "f": 1,
|
30416 32042 | "o": 2
|
30417 32043 | }"#;
|
30418 32044 | let mut tokens =
|
30419 32045 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
30420 32046 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30421 32047 | .expect("well formed json")
|
30422 32048 | });
|
30423 32049 | ret.insert("bar".to_owned(), {
|
30424 32050 | let json_bytes = br#"[
|
30425 32051 | "b",
|
30426 32052 | "a",
|
30427 32053 | "r"
|
30428 32054 | ]"#;
|
30429 32055 | let mut tokens =
|
30430 32056 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
30431 32057 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30432 32058 | .expect("well formed json")
|
30433 32059 | });
|
30434 32060 | ret.insert("baz".to_owned(), {
|
30435 32061 | let json_bytes = br#""BAZ""#;
|
30436 32062 | let mut tokens =
|
30437 32063 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
30438 32064 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30439 32065 | .expect("well formed json")
|
30440 32066 | });
|
30441 32067 | ret
|
30442 32068 | }),
|
30443 32069 | };
|
30444 32070 | use ::aws_smithy_http_server::response::IntoResponse;
|
30445 32071 | let http_response = output.into_response();
|
30446 32072 | ::pretty_assertions::assert_eq!(
|
30447 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
32073 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
30448 32074 | http_response.status()
|
30449 32075 | );
|
30450 32076 | let expected_headers = [("Content-Type", "application/json")];
|
30451 32077 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
30452 32078 | http_response.headers(),
|
30453 32079 | expected_headers,
|
30454 32080 | ));
|
30455 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
32081 + | use ::http_body_util::BodyExt;
|
32082 + | let body = http_response
|
32083 + | .into_body()
|
32084 + | .collect()
|
30456 32085 | .await
|
30457 - | .expect("unable to extract body to bytes");
|
32086 + | .expect("unable to collect body")
|
32087 + | .to_bytes();
|
30458 32088 | ::aws_smithy_protocol_test::assert_ok(
|
30459 32089 | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"docValuedMap\": {\n \"foo\": { \"f\": 1, \"o\": 2 },\n \"bar\": [ \"b\", \"a\", \"r\" ],\n \"baz\": \"BAZ\"\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
30460 32090 | );
|
30461 32091 | }
|
32092 + |
|
32093 + | /* ProtocolTestGenerator.kt:98 */
|
30462 32094 | }
|
30463 32095 |
|
32096 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
30464 32097 | ::pin_project_lite::pin_project! {
|
30465 32098 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
30466 32099 | /// [`DocumentTypeAsPayloadInput`](crate::input::DocumentTypeAsPayloadInput) using modelled bindings.
|
30467 32100 | pub struct DocumentTypeAsPayloadInputFuture {
|
30468 32101 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::DocumentTypeAsPayloadInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
30469 32102 | }
|
30470 32103 | }
|
30471 32104 |
|
30472 32105 | impl std::future::Future for DocumentTypeAsPayloadInputFuture {
|
30473 32106 | type Output = Result<
|
30474 32107 | crate::input::DocumentTypeAsPayloadInput,
|
30475 32108 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
30476 32109 | >;
|
30477 32110 |
|
30478 32111 | fn poll(
|
30479 32112 | self: std::pin::Pin<&mut Self>,
|
30480 32113 | cx: &mut std::task::Context<'_>,
|
30481 32114 | ) -> std::task::Poll<Self::Output> {
|
30482 32115 | let this = self.project();
|
30483 32116 | this.inner.as_mut().poll(cx)
|
30484 32117 | }
|
30485 32118 | }
|
30486 32119 |
|
30487 32120 | impl<B>
|
30488 32121 | ::aws_smithy_http_server::request::FromRequest<
|
30489 32122 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
30490 32123 | B,
|
30491 32124 | > for crate::input::DocumentTypeAsPayloadInput
|
30492 32125 | where
|
30493 32126 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
30494 32127 | B: 'static,
|
30495 32128 |
|
30496 32129 | B::Data: Send,
|
30497 32130 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
30498 32131 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
30499 32132 | {
|
30500 32133 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
30501 32134 | type Future = DocumentTypeAsPayloadInputFuture;
|
30502 32135 |
|
30503 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
32136 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
30504 32137 | let fut = async move {
|
30505 32138 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
30506 32139 | request.headers(),
|
30507 32140 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
30508 32141 | ) {
|
30509 32142 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
30510 32143 | }
|
30511 32144 | crate::protocol_serde::shape_document_type_as_payload::de_document_type_as_payload_http_request(request)
|
30512 32145 | .await
|
30513 32146 | };
|
30514 32147 | use ::futures_util::future::TryFutureExt;
|
30515 32148 | let fut = fut.map_err(
|
30516 32149 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
30517 32150 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
30518 32151 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
30519 32152 | e,
|
30520 32153 | )
|
30521 32154 | },
|
30522 32155 | );
|
30523 32156 | DocumentTypeAsPayloadInputFuture {
|
30524 32157 | inner: Box::pin(fut),
|
30525 32158 | }
|
30526 32159 | }
|
30527 32160 | }
|
32161 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
30528 32162 | impl
|
30529 32163 | ::aws_smithy_http_server::response::IntoResponse<
|
30530 32164 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
30531 32165 | > for crate::output::DocumentTypeAsPayloadOutput
|
30532 32166 | {
|
30533 32167 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
30534 32168 | match crate::protocol_serde::shape_document_type_as_payload::ser_document_type_as_payload_http_response(self) {
|
30535 32169 | Ok(response) => response,
|
30536 32170 | Err(e) => {
|
30537 32171 | ::tracing::error!(error = %e, "failed to serialize response");
|
30538 32172 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
30539 32173 | }
|
30540 32174 | }
|
30541 32175 | }
|
30542 32176 | }
|
30543 32177 |
|
32178 + | /* RustType.kt:534 */
|
30544 32179 | #[allow(unreachable_code, unused_variables)]
|
32180 + | /* RustType.kt:534 */
|
30545 32181 | #[cfg(test)]
|
32182 + | /* ProtocolTestGenerator.kt:98 */
|
30546 32183 | mod document_type_as_payload_test {
|
30547 32184 |
|
30548 32185 | /// Serializes a document as the target of the httpPayload trait.
|
30549 32186 | /// Test ID: DocumentTypeAsPayloadInput
|
30550 32187 | #[::tokio::test]
|
30551 32188 | #[::tracing_test::traced_test]
|
30552 32189 | async fn document_type_as_payload_input_request() {
|
30553 32190 | #[allow(unused_mut)]
|
30554 - | let mut http_request = http::Request::builder()
|
32191 + | let mut http_request = ::http_1x::Request::builder()
|
30555 32192 | .uri("/DocumentTypeAsPayload")
|
30556 32193 | .method("PUT")
|
30557 32194 | .header("Content-Type", "application/json")
|
30558 - | .body(::aws_smithy_http_server::body::Body::from(
|
30559 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
30560 - | "{\n \"foo\": \"bar\"\n}".as_bytes(),
|
30561 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
32195 + | .body(::aws_smithy_http_server::body::boxed(
|
32196 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
32197 + | &::aws_smithy_protocol_test::decode_body_data(
|
32198 + | "{\n \"foo\": \"bar\"\n}".as_bytes(),
|
32199 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
32200 + | ),
|
30562 32201 | )),
|
30563 32202 | ))
|
30564 32203 | .unwrap();
|
30565 32204 | #[allow(unused_mut)]
|
30566 32205 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
30567 32206 | let config = crate::service::RestJsonConfig::builder().build();
|
30568 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
32207 + | let service =
|
32208 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
32209 + | config,
|
32210 + | )
|
30569 32211 | .document_type_as_payload(move |input: crate::input::DocumentTypeAsPayloadInput| {
|
30570 32212 | let sender = sender.clone();
|
30571 32213 | async move {
|
30572 32214 | let result = {
|
30573 32215 | let expected = crate::input::DocumentTypeAsPayloadInput {
|
30574 32216 | document_value: ::std::option::Option::Some({
|
30575 32217 | let json_bytes = br#"{
|
30576 32218 | "foo": "bar"
|
30577 32219 | }"#;
|
30578 32220 | let mut tokens =
|
30579 32221 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
30580 32222 | .peekable();
|
30581 32223 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30582 32224 | .expect("well formed json")
|
30583 32225 | }),
|
30584 32226 | };
|
30585 32227 | ::pretty_assertions::assert_eq!(input, expected);
|
30586 32228 | let output = crate::output::DocumentTypeAsPayloadOutput {
|
30587 32229 | document_value: ::std::option::Option::Some({
|
30588 32230 | let json_bytes = br#"null"#;
|
30589 32231 | let mut tokens =
|
30590 32232 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
30591 32233 | .peekable();
|
30592 32234 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30593 32235 | .expect("well formed json")
|
30594 32236 | }),
|
30595 32237 | };
|
30596 32238 | output
|
30597 32239 | };
|
30598 32240 | sender.send(()).await.expect("receiver dropped early");
|
30599 32241 | result
|
30600 32242 | }
|
30601 32243 | })
|
30602 32244 | .build_unchecked();
|
30603 32245 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
30604 32246 | .await
|
30605 32247 | .expect("unable to make an HTTP request");
|
30606 32248 | assert!(
|
30607 32249 | receiver.recv().await.is_some(),
|
30608 32250 | "we expected operation handler to be invoked but it was not entered"
|
30609 32251 | );
|
30610 32252 | }
|
30611 32253 |
|
30612 32254 | /// Serializes a document as the target of the httpPayload trait using a string.
|
30613 32255 | /// Test ID: DocumentTypeAsPayloadInputString
|
30614 32256 | #[::tokio::test]
|
30615 32257 | #[::tracing_test::traced_test]
|
30616 32258 | async fn document_type_as_payload_input_string_request() {
|
30617 32259 | #[allow(unused_mut)]
|
30618 - | let mut http_request = http::Request::builder()
|
32260 + | let mut http_request = ::http_1x::Request::builder()
|
30619 32261 | .uri("/DocumentTypeAsPayload")
|
30620 32262 | .method("PUT")
|
30621 32263 | .header("Content-Type", "application/json")
|
30622 - | .body(::aws_smithy_http_server::body::Body::from(
|
30623 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
30624 - | "\"hello\"".as_bytes(),
|
30625 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
32264 + | .body(::aws_smithy_http_server::body::boxed(
|
32265 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
32266 + | &::aws_smithy_protocol_test::decode_body_data(
|
32267 + | "\"hello\"".as_bytes(),
|
32268 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
32269 + | ),
|
30626 32270 | )),
|
30627 32271 | ))
|
30628 32272 | .unwrap();
|
30629 32273 | #[allow(unused_mut)]
|
30630 32274 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
30631 32275 | let config = crate::service::RestJsonConfig::builder().build();
|
30632 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
32276 + | let service =
|
32277 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
32278 + | config,
|
32279 + | )
|
30633 32280 | .document_type_as_payload(move |input: crate::input::DocumentTypeAsPayloadInput| {
|
30634 32281 | let sender = sender.clone();
|
30635 32282 | async move {
|
30636 32283 | let result = {
|
30637 32284 | let expected = crate::input::DocumentTypeAsPayloadInput {
|
30638 32285 | document_value: ::std::option::Option::Some({
|
30639 32286 | let json_bytes = br#""hello""#;
|
30640 32287 | let mut tokens =
|
30641 32288 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
30642 32289 | .peekable();
|
30643 32290 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30644 32291 | .expect("well formed json")
|
30645 32292 | }),
|
30646 32293 | };
|
30647 32294 | ::pretty_assertions::assert_eq!(input, expected);
|
30648 32295 | let output = crate::output::DocumentTypeAsPayloadOutput {
|
30649 32296 | document_value: ::std::option::Option::Some({
|
30650 32297 | let json_bytes = br#"null"#;
|
30651 32298 | let mut tokens =
|
30652 32299 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
30653 32300 | .peekable();
|
30654 32301 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30655 32302 | .expect("well formed json")
|
30656 32303 | }),
|
30657 32304 | };
|
30658 32305 | output
|
30659 32306 | };
|
30660 32307 | sender.send(()).await.expect("receiver dropped early");
|
30661 32308 | result
|
30662 32309 | }
|
30663 32310 | })
|
30664 32311 | .build_unchecked();
|
30665 32312 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
30666 32313 | .await
|
30667 32314 | .expect("unable to make an HTTP request");
|
30668 32315 | assert!(
|
30669 32316 | receiver.recv().await.is_some(),
|
30670 32317 | "we expected operation handler to be invoked but it was not entered"
|
30671 32318 | );
|
30672 32319 | }
|
30673 32320 |
|
30674 32321 | /// Serializes a document as the target of the httpPayload trait.
|
30675 32322 | /// Test ID: DocumentTypeAsPayloadOutput
|
30676 32323 | #[::tokio::test]
|
30677 32324 | #[::tracing_test::traced_test]
|
30678 32325 | async fn document_type_as_payload_output_response() {
|
30679 32326 | let output = crate::output::DocumentTypeAsPayloadOutput {
|
30680 32327 | document_value: ::std::option::Option::Some({
|
30681 32328 | let json_bytes = br#"{
|
30682 32329 | "foo": "bar"
|
30683 32330 | }"#;
|
30684 32331 | let mut tokens =
|
30685 32332 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
30686 32333 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30687 32334 | .expect("well formed json")
|
30688 32335 | }),
|
30689 32336 | };
|
30690 32337 | use ::aws_smithy_http_server::response::IntoResponse;
|
30691 32338 | let http_response = output.into_response();
|
30692 32339 | ::pretty_assertions::assert_eq!(
|
30693 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
32340 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
30694 32341 | http_response.status()
|
30695 32342 | );
|
30696 32343 | let expected_headers = [("Content-Type", "application/json")];
|
30697 32344 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
30698 32345 | http_response.headers(),
|
30699 32346 | expected_headers,
|
30700 32347 | ));
|
30701 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
32348 + | use ::http_body_util::BodyExt;
|
32349 + | let body = http_response
|
32350 + | .into_body()
|
32351 + | .collect()
|
30702 32352 | .await
|
30703 - | .expect("unable to extract body to bytes");
|
32353 + | .expect("unable to collect body")
|
32354 + | .to_bytes();
|
30704 32355 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
30705 32356 | &body,
|
30706 32357 | "{\n \"foo\": \"bar\"\n}",
|
30707 32358 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30708 32359 | ));
|
30709 32360 | }
|
30710 32361 |
|
30711 32362 | /// Serializes a document as a payload string.
|
30712 32363 | /// Test ID: DocumentTypeAsPayloadOutputString
|
30713 32364 | #[::tokio::test]
|
30714 32365 | #[::tracing_test::traced_test]
|
30715 32366 | async fn document_type_as_payload_output_string_response() {
|
30716 32367 | let output = crate::output::DocumentTypeAsPayloadOutput {
|
30717 32368 | document_value: ::std::option::Option::Some({
|
30718 32369 | let json_bytes = br#""hello""#;
|
30719 32370 | let mut tokens =
|
30720 32371 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
30721 32372 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30722 32373 | .expect("well formed json")
|
30723 32374 | }),
|
30724 32375 | };
|
30725 32376 | use ::aws_smithy_http_server::response::IntoResponse;
|
30726 32377 | let http_response = output.into_response();
|
30727 32378 | ::pretty_assertions::assert_eq!(
|
30728 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
32379 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
30729 32380 | http_response.status()
|
30730 32381 | );
|
30731 32382 | let expected_headers = [("Content-Type", "application/json")];
|
30732 32383 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
30733 32384 | http_response.headers(),
|
30734 32385 | expected_headers,
|
30735 32386 | ));
|
30736 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
32387 + | use ::http_body_util::BodyExt;
|
32388 + | let body = http_response
|
32389 + | .into_body()
|
32390 + | .collect()
|
30737 32391 | .await
|
30738 - | .expect("unable to extract body to bytes");
|
32392 + | .expect("unable to collect body")
|
32393 + | .to_bytes();
|
30739 32394 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
30740 32395 | &body,
|
30741 32396 | "\"hello\"",
|
30742 32397 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
30743 32398 | ));
|
30744 32399 | }
|
32400 + |
|
32401 + | /* ProtocolTestGenerator.kt:98 */
|
30745 32402 | }
|
30746 32403 |
|
32404 + | /* ServerHttpBoundProtocolGenerator.kt:276 */
|
30747 32405 | ::pin_project_lite::pin_project! {
|
30748 32406 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
30749 32407 | /// [`DocumentTypeInput`](crate::input::DocumentTypeInput) using modelled bindings.
|
30750 32408 | pub struct DocumentTypeInputFuture {
|
30751 32409 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::DocumentTypeInput, ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError>> + Send>>
|
30752 32410 | }
|
30753 32411 | }
|
30754 32412 |
|
30755 32413 | impl std::future::Future for DocumentTypeInputFuture {
|
30756 32414 | type Output = Result<
|
30757 32415 | crate::input::DocumentTypeInput,
|
30758 32416 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError,
|
30759 32417 | >;
|
30760 32418 |
|
30761 32419 | fn poll(
|
30762 32420 | self: std::pin::Pin<&mut Self>,
|
30763 32421 | cx: &mut std::task::Context<'_>,
|
30764 32422 | ) -> std::task::Poll<Self::Output> {
|
30765 32423 | let this = self.project();
|
30766 32424 | this.inner.as_mut().poll(cx)
|
30767 32425 | }
|
30768 32426 | }
|
30769 32427 |
|
30770 32428 | impl<B>
|
30771 32429 | ::aws_smithy_http_server::request::FromRequest<
|
30772 32430 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
30773 32431 | B,
|
30774 32432 | > for crate::input::DocumentTypeInput
|
30775 32433 | where
|
30776 32434 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
30777 32435 | B: 'static,
|
30778 32436 |
|
30779 32437 | B::Data: Send,
|
30780 32438 | ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection:
|
30781 32439 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
30782 32440 | {
|
30783 32441 | type Rejection = ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError;
|
30784 32442 | type Future = DocumentTypeInputFuture;
|
30785 32443 |
|
30786 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
32444 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
30787 32445 | let fut = async move {
|
30788 32446 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
30789 32447 | request.headers(),
|
30790 32448 | &crate::mimes::CONTENT_TYPE_APPLICATION_JSON,
|
30791 32449 | ) {
|
30792 32450 | return Err(::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection::NotAcceptable);
|
30793 32451 | }
|
30794 32452 | crate::protocol_serde::shape_document_type::de_document_type_http_request(request).await
|
30795 32453 | };
|
30796 32454 | use ::futures_util::future::TryFutureExt;
|
30797 32455 | let fut = fut.map_err(
|
30798 32456 | |e: ::aws_smithy_http_server::protocol::rest_json_1::rejection::RequestRejection| {
|
30799 32457 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
30800 32458 | ::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(
|
30801 32459 | e,
|
30802 32460 | )
|
30803 32461 | },
|
30804 32462 | );
|
30805 32463 | DocumentTypeInputFuture {
|
30806 32464 | inner: Box::pin(fut),
|
30807 32465 | }
|
30808 32466 | }
|
30809 32467 | }
|
32468 + | /* ServerHttpBoundProtocolGenerator.kt:335 */
|
30810 32469 | impl
|
30811 32470 | ::aws_smithy_http_server::response::IntoResponse<
|
30812 32471 | ::aws_smithy_http_server::protocol::rest_json_1::RestJson1,
|
30813 32472 | > for crate::output::DocumentTypeOutput
|
30814 32473 | {
|
30815 32474 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
30816 32475 | match crate::protocol_serde::shape_document_type::ser_document_type_http_response(self) {
|
30817 32476 | Ok(response) => response,
|
30818 32477 | Err(e) => {
|
30819 32478 | ::tracing::error!(error = %e, "failed to serialize response");
|
30820 32479 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::rest_json_1::RestJson1>::into_response(::aws_smithy_http_server::protocol::rest_json_1::runtime_error::RuntimeError::from(e))
|
30821 32480 | }
|
30822 32481 | }
|
30823 32482 | }
|
30824 32483 | }
|
30825 32484 |
|
32485 + | /* RustType.kt:534 */
|
30826 32486 | #[allow(unreachable_code, unused_variables)]
|
32487 + | /* RustType.kt:534 */
|
30827 32488 | #[cfg(test)]
|
32489 + | /* ProtocolTestGenerator.kt:98 */
|
30828 32490 | mod document_type_test {
|
30829 32491 |
|
30830 32492 | /// Serializes document types as part of the JSON request payload with no escaping.
|
30831 32493 | /// Test ID: DocumentTypeInputWithObject
|
30832 32494 | #[::tokio::test]
|
30833 32495 | #[::tracing_test::traced_test]
|
30834 32496 | async fn document_type_input_with_object_request() {
|
30835 32497 | #[allow(unused_mut)]
|
30836 - | let mut http_request = http::Request::builder()
|
32498 + | let mut http_request = ::http_1x::Request::builder()
|
30837 32499 | .uri("/DocumentType")
|
30838 32500 | .method("PUT")
|
30839 32501 | .header("Content-Type", "application/json")
|
30840 - | .body(::aws_smithy_http_server::body::Body::from(
|
30841 - | ::bytes::Bytes::copy_from_slice(
|
30842 - | &::aws_smithy_protocol_test::decode_body_data("{\n \"stringValue\": \"string\",\n \"documentValue\": {\n \"foo\": \"bar\"\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
30843 - | )
|
30844 - | )).unwrap();
|
32502 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
32503 + | ::bytes::Bytes::copy_from_slice(
|
32504 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"stringValue\": \"string\",\n \"documentValue\": {\n \"foo\": \"bar\"\n }\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
32505 + | )
|
32506 + | ))).unwrap();
|
30845 32507 | #[allow(unused_mut)]
|
30846 32508 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
30847 32509 | let config = crate::service::RestJsonConfig::builder().build();
|
30848 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
32510 + | let service =
|
32511 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
32512 + | config,
|
32513 + | )
|
30849 32514 | .document_type(move |input: crate::input::DocumentTypeInput| {
|
30850 32515 | let sender = sender.clone();
|
30851 32516 | async move {
|
30852 32517 | let result = {
|
30853 32518 | let expected = crate::input::DocumentTypeInput {
|
30854 32519 | string_value: ::std::option::Option::Some("string".to_owned()),
|
30855 32520 | document_value: ::std::option::Option::Some({
|
30856 32521 | let json_bytes = br#"{
|
30857 32522 | "foo": "bar"
|
30858 32523 | }"#;
|
30859 32524 | let mut tokens =
|
30860 32525 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
30861 32526 | .peekable();
|
30862 32527 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30863 32528 | .expect("well formed json")
|
30864 32529 | }),
|
30865 32530 | };
|
30866 32531 | ::pretty_assertions::assert_eq!(input, expected);
|
30867 32532 | let output = crate::output::DocumentTypeOutput {
|
30868 32533 | string_value: ::std::option::Option::None,
|
30869 32534 | document_value: ::std::option::Option::Some({
|
30870 32535 | let json_bytes = br#"null"#;
|
30871 32536 | let mut tokens =
|
30872 32537 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
30873 32538 | .peekable();
|
30874 32539 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30875 32540 | .expect("well formed json")
|
30876 32541 | }),
|
30877 32542 | };
|
30878 32543 | output
|
30879 32544 | };
|
30880 32545 | sender.send(()).await.expect("receiver dropped early");
|
30881 32546 | result
|
30882 32547 | }
|
30883 32548 | })
|
30884 32549 | .build_unchecked();
|
30885 32550 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
30886 32551 | .await
|
30887 32552 | .expect("unable to make an HTTP request");
|
30888 32553 | assert!(
|
30889 32554 | receiver.recv().await.is_some(),
|
30890 32555 | "we expected operation handler to be invoked but it was not entered"
|
30891 32556 | );
|
30892 32557 | }
|
30893 32558 |
|
30894 32559 | /// Serializes document types using a string.
|
30895 32560 | /// Test ID: DocumentInputWithString
|
30896 32561 | #[::tokio::test]
|
30897 32562 | #[::tracing_test::traced_test]
|
30898 32563 | async fn document_input_with_string_request() {
|
30899 32564 | #[allow(unused_mut)]
|
30900 - | let mut http_request = http::Request::builder()
|
32565 + | let mut http_request = ::http_1x::Request::builder()
|
30901 32566 | .uri("/DocumentType")
|
30902 32567 | .method("PUT")
|
30903 32568 | .header("Content-Type", "application/json")
|
30904 - | .body(::aws_smithy_http_server::body::Body::from(
|
30905 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
30906 - | "{\n \"stringValue\": \"string\",\n \"documentValue\": \"hello\"\n}"
|
30907 - | .as_bytes(),
|
30908 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
32569 + | .body(::aws_smithy_http_server::body::boxed(
|
32570 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
32571 + | &::aws_smithy_protocol_test::decode_body_data(
|
32572 + | "{\n \"stringValue\": \"string\",\n \"documentValue\": \"hello\"\n}"
|
32573 + | .as_bytes(),
|
32574 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
32575 + | ),
|
30909 32576 | )),
|
30910 32577 | ))
|
30911 32578 | .unwrap();
|
30912 32579 | #[allow(unused_mut)]
|
30913 32580 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
30914 32581 | let config = crate::service::RestJsonConfig::builder().build();
|
30915 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
32582 + | let service =
|
32583 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
32584 + | config,
|
32585 + | )
|
30916 32586 | .document_type(move |input: crate::input::DocumentTypeInput| {
|
30917 32587 | let sender = sender.clone();
|
30918 32588 | async move {
|
30919 32589 | let result = {
|
30920 32590 | let expected = crate::input::DocumentTypeInput {
|
30921 32591 | string_value: ::std::option::Option::Some("string".to_owned()),
|
30922 32592 | document_value: ::std::option::Option::Some({
|
30923 32593 | let json_bytes = br#""hello""#;
|
30924 32594 | let mut tokens =
|
30925 32595 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
30926 32596 | .peekable();
|
30927 32597 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30928 32598 | .expect("well formed json")
|
30929 32599 | }),
|
30930 32600 | };
|
30931 32601 | ::pretty_assertions::assert_eq!(input, expected);
|
30932 32602 | let output = crate::output::DocumentTypeOutput {
|
30933 32603 | string_value: ::std::option::Option::None,
|
30934 32604 | document_value: ::std::option::Option::Some({
|
30935 32605 | let json_bytes = br#"null"#;
|
30936 32606 | let mut tokens =
|
30937 32607 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
30938 32608 | .peekable();
|
30939 32609 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30940 32610 | .expect("well formed json")
|
30941 32611 | }),
|
30942 32612 | };
|
30943 32613 | output
|
30944 32614 | };
|
30945 32615 | sender.send(()).await.expect("receiver dropped early");
|
30946 32616 | result
|
30947 32617 | }
|
30948 32618 | })
|
30949 32619 | .build_unchecked();
|
30950 32620 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
30951 32621 | .await
|
30952 32622 | .expect("unable to make an HTTP request");
|
30953 32623 | assert!(
|
30954 32624 | receiver.recv().await.is_some(),
|
30955 32625 | "we expected operation handler to be invoked but it was not entered"
|
30956 32626 | );
|
30957 32627 | }
|
30958 32628 |
|
30959 32629 | /// Serializes document types using a number.
|
30960 32630 | /// Test ID: DocumentInputWithNumber
|
30961 32631 | #[::tokio::test]
|
30962 32632 | #[::tracing_test::traced_test]
|
30963 32633 | async fn document_input_with_number_request() {
|
30964 32634 | #[allow(unused_mut)]
|
30965 - | let mut http_request = http::Request::builder()
|
32635 + | let mut http_request = ::http_1x::Request::builder()
|
30966 32636 | .uri("/DocumentType")
|
30967 32637 | .method("PUT")
|
30968 32638 | .header("Content-Type", "application/json")
|
30969 - | .body(::aws_smithy_http_server::body::Body::from(
|
30970 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
30971 - | "{\n \"stringValue\": \"string\",\n \"documentValue\": 10\n}".as_bytes(),
|
30972 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
32639 + | .body(::aws_smithy_http_server::body::boxed(
|
32640 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
32641 + | &::aws_smithy_protocol_test::decode_body_data(
|
32642 + | "{\n \"stringValue\": \"string\",\n \"documentValue\": 10\n}"
|
32643 + | .as_bytes(),
|
32644 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
32645 + | ),
|
30973 32646 | )),
|
30974 32647 | ))
|
30975 32648 | .unwrap();
|
30976 32649 | #[allow(unused_mut)]
|
30977 32650 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
30978 32651 | let config = crate::service::RestJsonConfig::builder().build();
|
30979 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
32652 + | let service =
|
32653 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
32654 + | config,
|
32655 + | )
|
30980 32656 | .document_type(move |input: crate::input::DocumentTypeInput| {
|
30981 32657 | let sender = sender.clone();
|
30982 32658 | async move {
|
30983 32659 | let result = {
|
30984 32660 | let expected = crate::input::DocumentTypeInput {
|
30985 32661 | string_value: ::std::option::Option::Some("string".to_owned()),
|
30986 32662 | document_value: ::std::option::Option::Some({
|
30987 32663 | let json_bytes = br#"10"#;
|
30988 32664 | let mut tokens =
|
30989 32665 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
30990 32666 | .peekable();
|
30991 32667 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
30992 32668 | .expect("well formed json")
|
30993 32669 | }),
|
30994 32670 | };
|
30995 32671 | ::pretty_assertions::assert_eq!(input, expected);
|
30996 32672 | let output = crate::output::DocumentTypeOutput {
|
30997 32673 | string_value: ::std::option::Option::None,
|
30998 32674 | document_value: ::std::option::Option::Some({
|
30999 32675 | let json_bytes = br#"null"#;
|
31000 32676 | let mut tokens =
|
31001 32677 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
31002 32678 | .peekable();
|
31003 32679 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
31004 32680 | .expect("well formed json")
|
31005 32681 | }),
|
31006 32682 | };
|
31007 32683 | output
|
31008 32684 | };
|
31009 32685 | sender.send(()).await.expect("receiver dropped early");
|
31010 32686 | result
|
31011 32687 | }
|
31012 32688 | })
|
31013 32689 | .build_unchecked();
|
31014 32690 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
31015 32691 | .await
|
31016 32692 | .expect("unable to make an HTTP request");
|
31017 32693 | assert!(
|
31018 32694 | receiver.recv().await.is_some(),
|
31019 32695 | "we expected operation handler to be invoked but it was not entered"
|
31020 32696 | );
|
31021 32697 | }
|
31022 32698 |
|
31023 32699 | /// Serializes document types using a boolean.
|
31024 32700 | /// Test ID: DocumentInputWithBoolean
|
31025 32701 | #[::tokio::test]
|
31026 32702 | #[::tracing_test::traced_test]
|
31027 32703 | async fn document_input_with_boolean_request() {
|
31028 32704 | #[allow(unused_mut)]
|
31029 - | let mut http_request = http::Request::builder()
|
32705 + | let mut http_request = ::http_1x::Request::builder()
|
31030 32706 | .uri("/DocumentType")
|
31031 32707 | .method("PUT")
|
31032 32708 | .header("Content-Type", "application/json")
|
31033 - | .body(::aws_smithy_http_server::body::Body::from(
|
31034 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
31035 - | "{\n \"stringValue\": \"string\",\n \"documentValue\": true\n}"
|
31036 - | .as_bytes(),
|
31037 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
32709 + | .body(::aws_smithy_http_server::body::boxed(
|
32710 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
32711 + | &::aws_smithy_protocol_test::decode_body_data(
|
32712 + | "{\n \"stringValue\": \"string\",\n \"documentValue\": true\n}"
|
32713 + | .as_bytes(),
|
32714 + | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
32715 + | ),
|
31038 32716 | )),
|
31039 32717 | ))
|
31040 32718 | .unwrap();
|
31041 32719 | #[allow(unused_mut)]
|
31042 32720 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
31043 32721 | let config = crate::service::RestJsonConfig::builder().build();
|
31044 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
32722 + | let service =
|
32723 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
32724 + | config,
|
32725 + | )
|
31045 32726 | .document_type(move |input: crate::input::DocumentTypeInput| {
|
31046 32727 | let sender = sender.clone();
|
31047 32728 | async move {
|
31048 32729 | let result = {
|
31049 32730 | let expected = crate::input::DocumentTypeInput {
|
31050 32731 | string_value: ::std::option::Option::Some("string".to_owned()),
|
31051 32732 | document_value: ::std::option::Option::Some({
|
31052 32733 | let json_bytes = br#"true"#;
|
31053 32734 | let mut tokens =
|
31054 32735 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
31055 32736 | .peekable();
|
31056 32737 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
31057 32738 | .expect("well formed json")
|
31058 32739 | }),
|
31059 32740 | };
|
31060 32741 | ::pretty_assertions::assert_eq!(input, expected);
|
31061 32742 | let output = crate::output::DocumentTypeOutput {
|
31062 32743 | string_value: ::std::option::Option::None,
|
31063 32744 | document_value: ::std::option::Option::Some({
|
31064 32745 | let json_bytes = br#"null"#;
|
31065 32746 | let mut tokens =
|
31066 32747 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
31067 32748 | .peekable();
|
31068 32749 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
31069 32750 | .expect("well formed json")
|
31070 32751 | }),
|
31071 32752 | };
|
31072 32753 | output
|
31073 32754 | };
|
31074 32755 | sender.send(()).await.expect("receiver dropped early");
|
31075 32756 | result
|
31076 32757 | }
|
31077 32758 | })
|
31078 32759 | .build_unchecked();
|
31079 32760 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
31080 32761 | .await
|
31081 32762 | .expect("unable to make an HTTP request");
|
31082 32763 | assert!(
|
31083 32764 | receiver.recv().await.is_some(),
|
31084 32765 | "we expected operation handler to be invoked but it was not entered"
|
31085 32766 | );
|
31086 32767 | }
|
31087 32768 |
|
31088 32769 | /// Serializes document types using a list.
|
31089 32770 | /// Test ID: DocumentInputWithList
|
31090 32771 | #[::tokio::test]
|
31091 32772 | #[::tracing_test::traced_test]
|
31092 32773 | async fn document_input_with_list_request() {
|
31093 32774 | #[allow(unused_mut)]
|
31094 - | let mut http_request = http::Request::builder()
|
32775 + | let mut http_request = ::http_1x::Request::builder()
|
31095 32776 | .uri("/DocumentType")
|
31096 32777 | .method("PUT")
|
31097 32778 | .header("Content-Type", "application/json")
|
31098 - | .body(::aws_smithy_http_server::body::Body::from(
|
31099 - | ::bytes::Bytes::copy_from_slice(
|
31100 - | &::aws_smithy_protocol_test::decode_body_data("{\n \"stringValue\": \"string\",\n \"documentValue\": [\n true,\n \"hi\",\n [\n 1,\n 2\n ],\n {\n \"foo\": {\n \"baz\": [\n 3,\n 4\n ]\n }\n }\n ]\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
31101 - | )
|
31102 - | )).unwrap();
|
32779 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
32780 + | ::bytes::Bytes::copy_from_slice(
|
32781 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"stringValue\": \"string\",\n \"documentValue\": [\n true,\n \"hi\",\n [\n 1,\n 2\n ],\n {\n \"foo\": {\n \"baz\": [\n 3,\n 4\n ]\n }\n }\n ]\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
32782 + | )
|
32783 + | ))).unwrap();
|
31103 32784 | #[allow(unused_mut)]
|
31104 32785 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
31105 32786 | let config = crate::service::RestJsonConfig::builder().build();
|
31106 - | let service = crate::service::RestJson::builder::<::hyper::body::Body, _, _, _>(config)
|
32787 + | let service =
|
32788 + | crate::service::RestJson::builder::<::aws_smithy_http_server::body::BoxBody, _, _, _>(
|
32789 + | config,
|
32790 + | )
|
31107 32791 | .document_type(move |input: crate::input::DocumentTypeInput| {
|
31108 32792 | let sender = sender.clone();
|
31109 32793 | async move {
|
31110 32794 | let result = {
|
31111 32795 | let expected = crate::input::DocumentTypeInput {
|
31112 32796 | string_value: ::std::option::Option::Some("string".to_owned()),
|
31113 32797 | document_value: ::std::option::Option::Some({
|
31114 32798 | let json_bytes = br#"[
|
31115 32799 | true,
|
31116 32800 | "hi",
|