869 890 | #[allow(unreachable_code, unused_variables)]
|
870 891 | #[cfg(test)]
|
871 892 | mod json_unions_test {
|
872 893 |
|
873 894 | /// Serializes a string union value
|
874 895 | /// Test ID: AwsJson11SerializeStringUnionValue
|
875 896 | #[::tokio::test]
|
876 897 | #[::tracing_test::traced_test]
|
877 898 | async fn aws_json11_serialize_string_union_value_request() {
|
878 899 | #[allow(unused_mut)]
|
879 - | let mut http_request = http::Request::builder()
|
900 + | let mut http_request = ::http_1x::Request::builder()
|
880 901 | .uri("/")
|
881 902 | .method("POST")
|
882 903 | .header("Content-Type", "application/x-amz-json-1.1")
|
883 904 | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
884 - | .body(::aws_smithy_http_server::body::Body::from(
|
885 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
886 - | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}".as_bytes(),
|
905 + | .body(::aws_smithy_http_server::body::boxed(
|
906 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
907 + | &::aws_smithy_protocol_test::decode_body_data(
|
908 + | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}"
|
909 + | .as_bytes(),
|
887 910 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
911 + | ),
|
888 912 | )),
|
889 913 | ))
|
890 914 | .unwrap();
|
891 915 | #[allow(unused_mut)]
|
892 916 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
893 917 | let config = crate::service::JsonProtocolConfig::builder().build();
|
894 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
918 + | let service = crate::service::JsonProtocol::builder::<
|
919 + | ::aws_smithy_http_server::body::BoxBody,
|
920 + | _,
|
921 + | _,
|
922 + | _,
|
923 + | >(config)
|
895 924 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
896 925 | let sender = sender.clone();
|
897 926 | async move {
|
898 927 | let result = {
|
899 928 | let expected = crate::input::JsonUnionsInput {
|
900 - | contents: ::std::option::Option::Some(
|
901 - | crate::model::MyUnion::StringValue("foo".to_owned()),
|
902 - | ),
|
929 + | contents: ::std::option::Option::Some(crate::model::MyUnion::StringValue(
|
930 + | "foo".to_owned(),
|
931 + | )),
|
903 932 | };
|
904 933 | ::pretty_assertions::assert_eq!(input, expected);
|
905 934 | let output = crate::output::JsonUnionsOutput {
|
906 935 | contents: ::std::option::Option::None,
|
907 936 | };
|
908 937 | Ok(output)
|
909 938 | };
|
910 939 | sender.send(()).await.expect("receiver dropped early");
|
911 940 | result
|
912 941 | }
|
913 942 | })
|
914 943 | .build_unchecked();
|
915 944 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
916 945 | .await
|
917 946 | .expect("unable to make an HTTP request");
|
918 947 | assert!(
|
919 948 | receiver.recv().await.is_some(),
|
920 949 | "we expected operation handler to be invoked but it was not entered"
|
921 950 | );
|
922 951 | }
|
923 952 |
|
924 953 | /// Serializes a boolean union value
|
925 954 | /// Test ID: AwsJson11SerializeBooleanUnionValue
|
926 955 | #[::tokio::test]
|
927 956 | #[::tracing_test::traced_test]
|
928 957 | async fn aws_json11_serialize_boolean_union_value_request() {
|
929 958 | #[allow(unused_mut)]
|
930 - | let mut http_request = http::Request::builder()
|
959 + | let mut http_request = ::http_1x::Request::builder()
|
931 960 | .uri("/")
|
932 961 | .method("POST")
|
933 962 | .header("Content-Type", "application/x-amz-json-1.1")
|
934 963 | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
935 - | .body(::aws_smithy_http_server::body::Body::from(
|
936 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
937 - | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}".as_bytes(),
|
964 + | .body(::aws_smithy_http_server::body::boxed(
|
965 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
966 + | &::aws_smithy_protocol_test::decode_body_data(
|
967 + | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}"
|
968 + | .as_bytes(),
|
938 969 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
970 + | ),
|
939 971 | )),
|
940 972 | ))
|
941 973 | .unwrap();
|
942 974 | #[allow(unused_mut)]
|
943 975 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
944 976 | let config = crate::service::JsonProtocolConfig::builder().build();
|
945 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
977 + | let service = crate::service::JsonProtocol::builder::<
|
978 + | ::aws_smithy_http_server::body::BoxBody,
|
979 + | _,
|
980 + | _,
|
981 + | _,
|
982 + | >(config)
|
946 983 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
947 984 | let sender = sender.clone();
|
948 985 | async move {
|
949 986 | let result = {
|
950 987 | let expected = crate::input::JsonUnionsInput {
|
951 - | contents: ::std::option::Option::Some(
|
952 - | crate::model::MyUnion::BooleanValue(true),
|
953 - | ),
|
988 + | contents: ::std::option::Option::Some(crate::model::MyUnion::BooleanValue(
|
989 + | true,
|
990 + | )),
|
954 991 | };
|
955 992 | ::pretty_assertions::assert_eq!(input, expected);
|
956 993 | let output = crate::output::JsonUnionsOutput {
|
957 994 | contents: ::std::option::Option::None,
|
958 995 | };
|
959 996 | Ok(output)
|
960 997 | };
|
961 998 | sender.send(()).await.expect("receiver dropped early");
|
962 999 | result
|
963 1000 | }
|
964 1001 | })
|
965 1002 | .build_unchecked();
|
966 1003 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
967 1004 | .await
|
968 1005 | .expect("unable to make an HTTP request");
|
969 1006 | assert!(
|
970 1007 | receiver.recv().await.is_some(),
|
971 1008 | "we expected operation handler to be invoked but it was not entered"
|
972 1009 | );
|
973 1010 | }
|
974 1011 |
|
975 1012 | /// Serializes a number union value
|
976 1013 | /// Test ID: AwsJson11SerializeNumberUnionValue
|
977 1014 | #[::tokio::test]
|
978 1015 | #[::tracing_test::traced_test]
|
979 1016 | async fn aws_json11_serialize_number_union_value_request() {
|
980 1017 | #[allow(unused_mut)]
|
981 - | let mut http_request = http::Request::builder()
|
1018 + | let mut http_request = ::http_1x::Request::builder()
|
982 1019 | .uri("/")
|
983 1020 | .method("POST")
|
984 1021 | .header("Content-Type", "application/x-amz-json-1.1")
|
985 1022 | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
986 - | .body(::aws_smithy_http_server::body::Body::from(
|
987 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1023 + | .body(::aws_smithy_http_server::body::boxed(
|
1024 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1025 + | &::aws_smithy_protocol_test::decode_body_data(
|
988 1026 | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}".as_bytes(),
|
989 1027 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1028 + | ),
|
990 1029 | )),
|
991 1030 | ))
|
992 1031 | .unwrap();
|
993 1032 | #[allow(unused_mut)]
|
994 1033 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
995 1034 | let config = crate::service::JsonProtocolConfig::builder().build();
|
996 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1035 + | let service = crate::service::JsonProtocol::builder::<
|
1036 + | ::aws_smithy_http_server::body::BoxBody,
|
1037 + | _,
|
1038 + | _,
|
1039 + | _,
|
1040 + | >(config)
|
997 1041 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
998 1042 | let sender = sender.clone();
|
999 1043 | async move {
|
1000 1044 | let result = {
|
1001 1045 | let expected = crate::input::JsonUnionsInput {
|
1002 - | contents: ::std::option::Option::Some(
|
1003 - | crate::model::MyUnion::NumberValue(1),
|
1004 - | ),
|
1046 + | contents: ::std::option::Option::Some(crate::model::MyUnion::NumberValue(
|
1047 + | 1,
|
1048 + | )),
|
1005 1049 | };
|
1006 1050 | ::pretty_assertions::assert_eq!(input, expected);
|
1007 1051 | let output = crate::output::JsonUnionsOutput {
|
1008 1052 | contents: ::std::option::Option::None,
|
1009 1053 | };
|
1010 1054 | Ok(output)
|
1011 1055 | };
|
1012 1056 | sender.send(()).await.expect("receiver dropped early");
|
1013 1057 | result
|
1014 1058 | }
|
1015 1059 | })
|
1016 1060 | .build_unchecked();
|
1017 1061 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1018 1062 | .await
|
1019 1063 | .expect("unable to make an HTTP request");
|
1020 1064 | assert!(
|
1021 1065 | receiver.recv().await.is_some(),
|
1022 1066 | "we expected operation handler to be invoked but it was not entered"
|
1023 1067 | );
|
1024 1068 | }
|
1025 1069 |
|
1026 1070 | /// Serializes a blob union value
|
1027 1071 | /// Test ID: AwsJson11SerializeBlobUnionValue
|
1028 1072 | #[::tokio::test]
|
1029 1073 | #[::tracing_test::traced_test]
|
1030 1074 | async fn aws_json11_serialize_blob_union_value_request() {
|
1031 1075 | #[allow(unused_mut)]
|
1032 - | let mut http_request = http::Request::builder()
|
1076 + | let mut http_request = ::http_1x::Request::builder()
|
1033 1077 | .uri("/")
|
1034 1078 | .method("POST")
|
1035 1079 | .header("Content-Type", "application/x-amz-json-1.1")
|
1036 1080 | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1037 - | .body(::aws_smithy_http_server::body::Body::from(
|
1038 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1039 - | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}".as_bytes(),
|
1081 + | .body(::aws_smithy_http_server::body::boxed(
|
1082 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1083 + | &::aws_smithy_protocol_test::decode_body_data(
|
1084 + | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}"
|
1085 + | .as_bytes(),
|
1040 1086 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1087 + | ),
|
1041 1088 | )),
|
1042 1089 | ))
|
1043 1090 | .unwrap();
|
1044 1091 | #[allow(unused_mut)]
|
1045 1092 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1046 1093 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1047 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1094 + | let service = crate::service::JsonProtocol::builder::<
|
1095 + | ::aws_smithy_http_server::body::BoxBody,
|
1096 + | _,
|
1097 + | _,
|
1098 + | _,
|
1099 + | >(config)
|
1048 1100 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1049 1101 | let sender = sender.clone();
|
1050 1102 | async move {
|
1051 1103 | let result = {
|
1052 1104 | let expected = crate::input::JsonUnionsInput {
|
1053 - | contents: ::std::option::Option::Some(
|
1054 - | crate::model::MyUnion::BlobValue(::aws_smithy_types::Blob::new(
|
1055 - | "foo",
|
1105 + | contents: ::std::option::Option::Some(crate::model::MyUnion::BlobValue(
|
1106 + | ::aws_smithy_types::Blob::new("foo"),
|
1056 1107 | )),
|
1057 - | ),
|
1058 1108 | };
|
1059 1109 | ::pretty_assertions::assert_eq!(input, expected);
|
1060 1110 | let output = crate::output::JsonUnionsOutput {
|
1061 1111 | contents: ::std::option::Option::None,
|
1062 1112 | };
|
1063 1113 | Ok(output)
|
1064 1114 | };
|
1065 1115 | sender.send(()).await.expect("receiver dropped early");
|
1066 1116 | result
|
1067 1117 | }
|
1068 1118 | })
|
1069 1119 | .build_unchecked();
|
1070 1120 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1071 1121 | .await
|
1072 1122 | .expect("unable to make an HTTP request");
|
1073 1123 | assert!(
|
1074 1124 | receiver.recv().await.is_some(),
|
1075 1125 | "we expected operation handler to be invoked but it was not entered"
|
1076 1126 | );
|
1077 1127 | }
|
1078 1128 |
|
1079 1129 | /// Serializes a timestamp union value
|
1080 1130 | /// Test ID: AwsJson11SerializeTimestampUnionValue
|
1081 1131 | #[::tokio::test]
|
1082 1132 | #[::tracing_test::traced_test]
|
1083 1133 | async fn aws_json11_serialize_timestamp_union_value_request() {
|
1084 1134 | #[allow(unused_mut)]
|
1085 - | let mut http_request = http::Request::builder()
|
1135 + | let mut http_request = ::http_1x::Request::builder()
|
1086 1136 | .uri("/")
|
1087 1137 | .method("POST")
|
1088 1138 | .header("Content-Type", "application/x-amz-json-1.1")
|
1089 1139 | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1090 - | .body(::aws_smithy_http_server::body::Body::from(
|
1091 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1140 + | .body(::aws_smithy_http_server::body::boxed(
|
1141 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1142 + | &::aws_smithy_protocol_test::decode_body_data(
|
1092 1143 | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}"
|
1093 1144 | .as_bytes(),
|
1094 1145 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1146 + | ),
|
1095 1147 | )),
|
1096 1148 | ))
|
1097 1149 | .unwrap();
|
1098 1150 | #[allow(unused_mut)]
|
1099 1151 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1100 1152 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1101 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1153 + | let service = crate::service::JsonProtocol::builder::<
|
1154 + | ::aws_smithy_http_server::body::BoxBody,
|
1155 + | _,
|
1156 + | _,
|
1157 + | _,
|
1158 + | >(config)
|
1102 1159 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1103 1160 | let sender = sender.clone();
|
1104 1161 | async move {
|
1105 1162 | let result = {
|
1106 1163 | let expected = crate::input::JsonUnionsInput {
|
1107 1164 | contents: ::std::option::Option::Some(
|
1108 1165 | crate::model::MyUnion::TimestampValue(
|
1109 1166 | ::aws_smithy_types::DateTime::from_fractional_secs(
|
1110 1167 | 1398796238, 0_f64,
|
1111 1168 | ),
|
1112 1169 | ),
|
1113 1170 | ),
|
1114 1171 | };
|
1115 1172 | ::pretty_assertions::assert_eq!(input, expected);
|
1116 1173 | let output = crate::output::JsonUnionsOutput {
|
1117 1174 | contents: ::std::option::Option::None,
|
1118 1175 | };
|
1119 1176 | Ok(output)
|
1120 1177 | };
|
1121 1178 | sender.send(()).await.expect("receiver dropped early");
|
1122 1179 | result
|
1123 1180 | }
|
1124 1181 | })
|
1125 1182 | .build_unchecked();
|
1126 1183 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1127 1184 | .await
|
1128 1185 | .expect("unable to make an HTTP request");
|
1129 1186 | assert!(
|
1130 1187 | receiver.recv().await.is_some(),
|
1131 1188 | "we expected operation handler to be invoked but it was not entered"
|
1132 1189 | );
|
1133 1190 | }
|
1134 1191 |
|
1135 1192 | /// Serializes an enum union value
|
1136 1193 | /// Test ID: AwsJson11SerializeEnumUnionValue
|
1137 1194 | #[::tokio::test]
|
1138 1195 | #[::tracing_test::traced_test]
|
1139 1196 | async fn aws_json11_serialize_enum_union_value_request() {
|
1140 1197 | #[allow(unused_mut)]
|
1141 - | let mut http_request = http::Request::builder()
|
1198 + | let mut http_request = ::http_1x::Request::builder()
|
1142 1199 | .uri("/")
|
1143 1200 | .method("POST")
|
1144 1201 | .header("Content-Type", "application/x-amz-json-1.1")
|
1145 1202 | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1146 - | .body(::aws_smithy_http_server::body::Body::from(
|
1147 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1148 - | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}".as_bytes(),
|
1203 + | .body(::aws_smithy_http_server::body::boxed(
|
1204 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
1205 + | &::aws_smithy_protocol_test::decode_body_data(
|
1206 + | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}"
|
1207 + | .as_bytes(),
|
1149 1208 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1209 + | ),
|
1150 1210 | )),
|
1151 1211 | ))
|
1152 1212 | .unwrap();
|
1153 1213 | #[allow(unused_mut)]
|
1154 1214 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1155 1215 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1156 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1216 + | let service = crate::service::JsonProtocol::builder::<
|
1217 + | ::aws_smithy_http_server::body::BoxBody,
|
1218 + | _,
|
1219 + | _,
|
1220 + | _,
|
1221 + | >(config)
|
1157 1222 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1158 1223 | let sender = sender.clone();
|
1159 1224 | async move {
|
1160 1225 | let result = {
|
1161 1226 | let expected = crate::input::JsonUnionsInput {
|
1162 - | contents: ::std::option::Option::Some(
|
1163 - | crate::model::MyUnion::EnumValue(
|
1227 + | contents: ::std::option::Option::Some(crate::model::MyUnion::EnumValue(
|
1164 1228 | "Foo"
|
1165 1229 | .parse::<crate::model::FooEnum>()
|
1166 1230 | .expect("static value validated to member"),
|
1167 - | ),
|
1168 - | ),
|
1231 + | )),
|
1169 1232 | };
|
1170 1233 | ::pretty_assertions::assert_eq!(input, expected);
|
1171 1234 | let output = crate::output::JsonUnionsOutput {
|
1172 1235 | contents: ::std::option::Option::None,
|
1173 1236 | };
|
1174 1237 | Ok(output)
|
1175 1238 | };
|
1176 1239 | sender.send(()).await.expect("receiver dropped early");
|
1177 1240 | result
|
1178 1241 | }
|
1179 1242 | })
|
1180 1243 | .build_unchecked();
|
1181 1244 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1182 1245 | .await
|
1183 1246 | .expect("unable to make an HTTP request");
|
1184 1247 | assert!(
|
1185 1248 | receiver.recv().await.is_some(),
|
1186 1249 | "we expected operation handler to be invoked but it was not entered"
|
1187 1250 | );
|
1188 1251 | }
|
1189 1252 |
|
1190 1253 | /// Serializes a list union value
|
1191 1254 | /// Test ID: AwsJson11SerializeListUnionValue
|
1192 1255 | #[::tokio::test]
|
1193 1256 | #[::tracing_test::traced_test]
|
1194 1257 | async fn aws_json11_serialize_list_union_value_request() {
|
1195 1258 | #[allow(unused_mut)]
|
1196 - | let mut http_request = http::Request::builder()
|
1259 + | let mut http_request = ::http_1x::Request::builder()
|
1197 1260 | .uri("/")
|
1198 1261 | .method("POST")
|
1199 1262 | .header("Content-Type", "application/x-amz-json-1.1")
|
1200 1263 | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1201 - | .body(::aws_smithy_http_server::body::Body::from(
|
1202 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
1203 - | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}"
|
1204 - | .as_bytes(),
|
1205 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1206 - | )),
|
1207 - | ))
|
1208 - | .unwrap();
|
1264 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
1265 + | ::bytes::Bytes::copy_from_slice(
|
1266 + | &::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"))
|
1267 + | )
|
1268 + | ))).unwrap();
|
1209 1269 | #[allow(unused_mut)]
|
1210 1270 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1211 1271 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1212 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1272 + | let service = crate::service::JsonProtocol::builder::<
|
1273 + | ::aws_smithy_http_server::body::BoxBody,
|
1274 + | _,
|
1275 + | _,
|
1276 + | _,
|
1277 + | >(config)
|
1213 1278 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1214 1279 | let sender = sender.clone();
|
1215 1280 | async move {
|
1216 1281 | let result = {
|
1217 1282 | let expected = crate::input::JsonUnionsInput {
|
1218 - | contents: ::std::option::Option::Some(
|
1219 - | crate::model::MyUnion::ListValue(vec![
|
1220 - | "foo".to_owned(),
|
1221 - | "bar".to_owned(),
|
1222 - | ]),
|
1223 - | ),
|
1283 + | contents: ::std::option::Option::Some(crate::model::MyUnion::ListValue(
|
1284 + | vec!["foo".to_owned(), "bar".to_owned()],
|
1285 + | )),
|
1224 1286 | };
|
1225 1287 | ::pretty_assertions::assert_eq!(input, expected);
|
1226 1288 | let output = crate::output::JsonUnionsOutput {
|
1227 1289 | contents: ::std::option::Option::None,
|
1228 1290 | };
|
1229 1291 | Ok(output)
|
1230 1292 | };
|
1231 1293 | sender.send(()).await.expect("receiver dropped early");
|
1232 1294 | result
|
1233 1295 | }
|
1234 1296 | })
|
1235 1297 | .build_unchecked();
|
1236 1298 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1237 1299 | .await
|
1238 1300 | .expect("unable to make an HTTP request");
|
1239 1301 | assert!(
|
1240 1302 | receiver.recv().await.is_some(),
|
1241 1303 | "we expected operation handler to be invoked but it was not entered"
|
1242 1304 | );
|
1243 1305 | }
|
1244 1306 |
|
1245 1307 | /// Serializes a map union value
|
1246 1308 | /// Test ID: AwsJson11SerializeMapUnionValue
|
1247 1309 | #[::tokio::test]
|
1248 1310 | #[::tracing_test::traced_test]
|
1249 1311 | async fn aws_json11_serialize_map_union_value_request() {
|
1250 1312 | #[allow(unused_mut)]
|
1251 - | let mut http_request = http::Request::builder()
|
1313 + | let mut http_request = ::http_1x::Request::builder()
|
1252 1314 | .uri("/")
|
1253 1315 | .method("POST")
|
1254 1316 | .header("Content-Type", "application/x-amz-json-1.1")
|
1255 1317 | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1256 - | .body(::aws_smithy_http_server::body::Body::from(
|
1318 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
1257 1319 | ::bytes::Bytes::copy_from_slice(
|
1258 1320 | &::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"))
|
1259 1321 | )
|
1260 - | )).unwrap();
|
1322 + | ))).unwrap();
|
1261 1323 | #[allow(unused_mut)]
|
1262 1324 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1263 1325 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1264 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1326 + | let service = crate::service::JsonProtocol::builder::<
|
1327 + | ::aws_smithy_http_server::body::BoxBody,
|
1328 + | _,
|
1329 + | _,
|
1330 + | _,
|
1331 + | >(config)
|
1265 1332 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1266 1333 | let sender = sender.clone();
|
1267 1334 | async move {
|
1268 1335 | let result = {
|
1269 1336 | let expected = crate::input::JsonUnionsInput {
|
1270 - | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue(
|
1271 - | {
|
1337 + | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue({
|
1272 1338 | let mut ret = ::std::collections::HashMap::new();
|
1273 1339 | ret.insert("foo".to_owned(), "bar".to_owned());
|
1274 1340 | ret.insert("spam".to_owned(), "eggs".to_owned());
|
1275 1341 | ret
|
1276 - | },
|
1277 - | )),
|
1342 + | })),
|
1278 1343 | };
|
1279 1344 | ::pretty_assertions::assert_eq!(input, expected);
|
1280 1345 | let output = crate::output::JsonUnionsOutput {
|
1281 1346 | contents: ::std::option::Option::None,
|
1282 1347 | };
|
1283 1348 | Ok(output)
|
1284 1349 | };
|
1285 1350 | sender.send(()).await.expect("receiver dropped early");
|
1286 1351 | result
|
1287 1352 | }
|
1288 1353 | })
|
1289 1354 | .build_unchecked();
|
1290 1355 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1291 1356 | .await
|
1292 1357 | .expect("unable to make an HTTP request");
|
1293 1358 | assert!(
|
1294 1359 | receiver.recv().await.is_some(),
|
1295 1360 | "we expected operation handler to be invoked but it was not entered"
|
1296 1361 | );
|
1297 1362 | }
|
1298 1363 |
|
1299 1364 | /// Serializes a structure union value
|
1300 1365 | /// Test ID: AwsJson11SerializeStructureUnionValue
|
1301 1366 | #[::tokio::test]
|
1302 1367 | #[::tracing_test::traced_test]
|
1303 1368 | async fn aws_json11_serialize_structure_union_value_request() {
|
1304 1369 | #[allow(unused_mut)]
|
1305 - | let mut http_request = http::Request::builder()
|
1370 + | let mut http_request = ::http_1x::Request::builder()
|
1306 1371 | .uri("/")
|
1307 1372 | .method("POST")
|
1308 1373 | .header("Content-Type", "application/x-amz-json-1.1")
|
1309 1374 | .header("X-Amz-Target", "JsonProtocol.JsonUnions")
|
1310 - | .body(::aws_smithy_http_server::body::Body::from(
|
1375 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
1311 1376 | ::bytes::Bytes::copy_from_slice(
|
1312 1377 | &::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"))
|
1313 1378 | )
|
1314 - | )).unwrap();
|
1379 + | ))).unwrap();
|
1315 1380 | #[allow(unused_mut)]
|
1316 1381 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1317 1382 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1318 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
1383 + | let service = crate::service::JsonProtocol::builder::<
|
1384 + | ::aws_smithy_http_server::body::BoxBody,
|
1385 + | _,
|
1386 + | _,
|
1387 + | _,
|
1388 + | >(config)
|
1319 1389 | .json_unions(move |input: crate::input::JsonUnionsInput| {
|
1320 1390 | let sender = sender.clone();
|
1321 1391 | async move {
|
1322 1392 | let result = {
|
1323 1393 | let expected = crate::input::JsonUnionsInput {
|
1324 1394 | contents: ::std::option::Option::Some(
|
1325 - | crate::model::MyUnion::StructureValue(
|
1326 - | crate::model::GreetingStruct {
|
1395 + | crate::model::MyUnion::StructureValue(crate::model::GreetingStruct {
|
1327 1396 | hi: ::std::option::Option::Some("hello".to_owned()),
|
1328 - | },
|
1329 - | ),
|
1397 + | }),
|
1330 1398 | ),
|
1331 1399 | };
|
1332 1400 | ::pretty_assertions::assert_eq!(input, expected);
|
1333 1401 | let output = crate::output::JsonUnionsOutput {
|
1334 1402 | contents: ::std::option::Option::None,
|
1335 1403 | };
|
1336 1404 | Ok(output)
|
1337 1405 | };
|
1338 1406 | sender.send(()).await.expect("receiver dropped early");
|
1339 1407 | result
|
1340 1408 | }
|
1341 1409 | })
|
1342 1410 | .build_unchecked();
|
1343 1411 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1344 1412 | .await
|
1345 1413 | .expect("unable to make an HTTP request");
|
1346 1414 | assert!(
|
1347 1415 | receiver.recv().await.is_some(),
|
1348 1416 | "we expected operation handler to be invoked but it was not entered"
|
1349 1417 | );
|
1350 1418 | }
|
1351 1419 |
|
1352 1420 | /// Deserializes a string union value
|
1353 1421 | /// Test ID: AwsJson11DeserializeStringUnionValue
|
1354 1422 | #[::tokio::test]
|
1355 1423 | #[::tracing_test::traced_test]
|
1356 1424 | async fn aws_json11_deserialize_string_union_value_response() {
|
1357 1425 | let output = crate::output::JsonUnionsOutput {
|
1358 1426 | contents: ::std::option::Option::Some(crate::model::MyUnion::StringValue(
|
1359 1427 | "foo".to_owned(),
|
1360 1428 | )),
|
1361 1429 | };
|
1362 1430 | use ::aws_smithy_http_server::response::IntoResponse;
|
1363 1431 | let http_response = output.into_response();
|
1364 1432 | ::pretty_assertions::assert_eq!(
|
1365 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1433 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1366 1434 | http_response.status()
|
1367 1435 | );
|
1368 1436 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1369 1437 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1370 1438 | http_response.headers(),
|
1371 1439 | expected_headers,
|
1372 1440 | ));
|
1373 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1441 + | use ::http_body_util::BodyExt;
|
1442 + | let body = http_response
|
1443 + | .into_body()
|
1444 + | .collect()
|
1374 1445 | .await
|
1375 - | .expect("unable to extract body to bytes");
|
1446 + | .expect("unable to collect body")
|
1447 + | .to_bytes();
|
1376 1448 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1377 1449 | &body,
|
1378 1450 | "{\n \"contents\": {\n \"stringValue\": \"foo\"\n }\n}",
|
1379 1451 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1380 1452 | ));
|
1381 1453 | }
|
1382 1454 |
|
1383 1455 | /// Deserializes a boolean union value
|
1384 1456 | /// Test ID: AwsJson11DeserializeBooleanUnionValue
|
1385 1457 | #[::tokio::test]
|
1386 1458 | #[::tracing_test::traced_test]
|
1387 1459 | async fn aws_json11_deserialize_boolean_union_value_response() {
|
1388 1460 | let output = crate::output::JsonUnionsOutput {
|
1389 1461 | contents: ::std::option::Option::Some(crate::model::MyUnion::BooleanValue(true)),
|
1390 1462 | };
|
1391 1463 | use ::aws_smithy_http_server::response::IntoResponse;
|
1392 1464 | let http_response = output.into_response();
|
1393 1465 | ::pretty_assertions::assert_eq!(
|
1394 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1466 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1395 1467 | http_response.status()
|
1396 1468 | );
|
1397 1469 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1398 1470 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1399 1471 | http_response.headers(),
|
1400 1472 | expected_headers,
|
1401 1473 | ));
|
1402 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1474 + | use ::http_body_util::BodyExt;
|
1475 + | let body = http_response
|
1476 + | .into_body()
|
1477 + | .collect()
|
1403 1478 | .await
|
1404 - | .expect("unable to extract body to bytes");
|
1479 + | .expect("unable to collect body")
|
1480 + | .to_bytes();
|
1405 1481 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1406 1482 | &body,
|
1407 1483 | "{\n \"contents\": {\n \"booleanValue\": true\n }\n}",
|
1408 1484 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1409 1485 | ));
|
1410 1486 | }
|
1411 1487 |
|
1412 1488 | /// Deserializes a number union value
|
1413 1489 | /// Test ID: AwsJson11DeserializeNumberUnionValue
|
1414 1490 | #[::tokio::test]
|
1415 1491 | #[::tracing_test::traced_test]
|
1416 1492 | async fn aws_json11_deserialize_number_union_value_response() {
|
1417 1493 | let output = crate::output::JsonUnionsOutput {
|
1418 1494 | contents: ::std::option::Option::Some(crate::model::MyUnion::NumberValue(1)),
|
1419 1495 | };
|
1420 1496 | use ::aws_smithy_http_server::response::IntoResponse;
|
1421 1497 | let http_response = output.into_response();
|
1422 1498 | ::pretty_assertions::assert_eq!(
|
1423 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1499 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1424 1500 | http_response.status()
|
1425 1501 | );
|
1426 1502 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1427 1503 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1428 1504 | http_response.headers(),
|
1429 1505 | expected_headers,
|
1430 1506 | ));
|
1431 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1507 + | use ::http_body_util::BodyExt;
|
1508 + | let body = http_response
|
1509 + | .into_body()
|
1510 + | .collect()
|
1432 1511 | .await
|
1433 - | .expect("unable to extract body to bytes");
|
1512 + | .expect("unable to collect body")
|
1513 + | .to_bytes();
|
1434 1514 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1435 1515 | &body,
|
1436 1516 | "{\n \"contents\": {\n \"numberValue\": 1\n }\n}",
|
1437 1517 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1438 1518 | ));
|
1439 1519 | }
|
1440 1520 |
|
1441 1521 | /// Deserializes a blob union value
|
1442 1522 | /// Test ID: AwsJson11DeserializeBlobUnionValue
|
1443 1523 | #[::tokio::test]
|
1444 1524 | #[::tracing_test::traced_test]
|
1445 1525 | async fn aws_json11_deserialize_blob_union_value_response() {
|
1446 1526 | let output = crate::output::JsonUnionsOutput {
|
1447 1527 | contents: ::std::option::Option::Some(crate::model::MyUnion::BlobValue(
|
1448 1528 | ::aws_smithy_types::Blob::new("foo"),
|
1449 1529 | )),
|
1450 1530 | };
|
1451 1531 | use ::aws_smithy_http_server::response::IntoResponse;
|
1452 1532 | let http_response = output.into_response();
|
1453 1533 | ::pretty_assertions::assert_eq!(
|
1454 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1534 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1455 1535 | http_response.status()
|
1456 1536 | );
|
1457 1537 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1458 1538 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1459 1539 | http_response.headers(),
|
1460 1540 | expected_headers,
|
1461 1541 | ));
|
1462 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1542 + | use ::http_body_util::BodyExt;
|
1543 + | let body = http_response
|
1544 + | .into_body()
|
1545 + | .collect()
|
1463 1546 | .await
|
1464 - | .expect("unable to extract body to bytes");
|
1547 + | .expect("unable to collect body")
|
1548 + | .to_bytes();
|
1465 1549 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1466 1550 | &body,
|
1467 1551 | "{\n \"contents\": {\n \"blobValue\": \"Zm9v\"\n }\n}",
|
1468 1552 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1469 1553 | ));
|
1470 1554 | }
|
1471 1555 |
|
1472 1556 | /// Deserializes a timestamp union value
|
1473 1557 | /// Test ID: AwsJson11DeserializeTimestampUnionValue
|
1474 1558 | #[::tokio::test]
|
1475 1559 | #[::tracing_test::traced_test]
|
1476 1560 | async fn aws_json11_deserialize_timestamp_union_value_response() {
|
1477 1561 | let output = crate::output::JsonUnionsOutput {
|
1478 1562 | contents: ::std::option::Option::Some(crate::model::MyUnion::TimestampValue(
|
1479 1563 | ::aws_smithy_types::DateTime::from_fractional_secs(1398796238, 0_f64),
|
1480 1564 | )),
|
1481 1565 | };
|
1482 1566 | use ::aws_smithy_http_server::response::IntoResponse;
|
1483 1567 | let http_response = output.into_response();
|
1484 1568 | ::pretty_assertions::assert_eq!(
|
1485 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1569 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1486 1570 | http_response.status()
|
1487 1571 | );
|
1488 1572 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1489 1573 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1490 1574 | http_response.headers(),
|
1491 1575 | expected_headers,
|
1492 1576 | ));
|
1493 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1577 + | use ::http_body_util::BodyExt;
|
1578 + | let body = http_response
|
1579 + | .into_body()
|
1580 + | .collect()
|
1494 1581 | .await
|
1495 - | .expect("unable to extract body to bytes");
|
1582 + | .expect("unable to collect body")
|
1583 + | .to_bytes();
|
1496 1584 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1497 1585 | &body,
|
1498 1586 | "{\n \"contents\": {\n \"timestampValue\": 1398796238\n }\n}",
|
1499 1587 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1500 1588 | ));
|
1501 1589 | }
|
1502 1590 |
|
1503 1591 | /// Deserializes an enum union value
|
1504 1592 | /// Test ID: AwsJson11DeserializeEnumUnionValue
|
1505 1593 | #[::tokio::test]
|
1506 1594 | #[::tracing_test::traced_test]
|
1507 1595 | async fn aws_json11_deserialize_enum_union_value_response() {
|
1508 1596 | let output = crate::output::JsonUnionsOutput {
|
1509 1597 | contents: ::std::option::Option::Some(crate::model::MyUnion::EnumValue(
|
1510 1598 | "Foo"
|
1511 1599 | .parse::<crate::model::FooEnum>()
|
1512 1600 | .expect("static value validated to member"),
|
1513 1601 | )),
|
1514 1602 | };
|
1515 1603 | use ::aws_smithy_http_server::response::IntoResponse;
|
1516 1604 | let http_response = output.into_response();
|
1517 1605 | ::pretty_assertions::assert_eq!(
|
1518 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1606 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1519 1607 | http_response.status()
|
1520 1608 | );
|
1521 1609 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1522 1610 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1523 1611 | http_response.headers(),
|
1524 1612 | expected_headers,
|
1525 1613 | ));
|
1526 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1614 + | use ::http_body_util::BodyExt;
|
1615 + | let body = http_response
|
1616 + | .into_body()
|
1617 + | .collect()
|
1527 1618 | .await
|
1528 - | .expect("unable to extract body to bytes");
|
1619 + | .expect("unable to collect body")
|
1620 + | .to_bytes();
|
1529 1621 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1530 1622 | &body,
|
1531 1623 | "{\n \"contents\": {\n \"enumValue\": \"Foo\"\n }\n}",
|
1532 1624 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1533 1625 | ));
|
1534 1626 | }
|
1535 1627 |
|
1536 1628 | /// Deserializes a list union value
|
1537 1629 | /// Test ID: AwsJson11DeserializeListUnionValue
|
1538 1630 | #[::tokio::test]
|
1539 1631 | #[::tracing_test::traced_test]
|
1540 1632 | async fn aws_json11_deserialize_list_union_value_response() {
|
1541 1633 | let output = crate::output::JsonUnionsOutput {
|
1542 1634 | contents: ::std::option::Option::Some(crate::model::MyUnion::ListValue(vec![
|
1543 1635 | "foo".to_owned(),
|
1544 1636 | "bar".to_owned(),
|
1545 1637 | ])),
|
1546 1638 | };
|
1547 1639 | use ::aws_smithy_http_server::response::IntoResponse;
|
1548 1640 | let http_response = output.into_response();
|
1549 1641 | ::pretty_assertions::assert_eq!(
|
1550 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1642 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1551 1643 | http_response.status()
|
1552 1644 | );
|
1553 1645 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1554 1646 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1555 1647 | http_response.headers(),
|
1556 1648 | expected_headers,
|
1557 1649 | ));
|
1558 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1650 + | use ::http_body_util::BodyExt;
|
1651 + | let body = http_response
|
1652 + | .into_body()
|
1653 + | .collect()
|
1559 1654 | .await
|
1560 - | .expect("unable to extract body to bytes");
|
1655 + | .expect("unable to collect body")
|
1656 + | .to_bytes();
|
1561 1657 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1562 1658 | &body,
|
1563 1659 | "{\n \"contents\": {\n \"listValue\": [\"foo\", \"bar\"]\n }\n}",
|
1564 1660 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1565 1661 | ));
|
1566 1662 | }
|
1567 1663 |
|
1568 1664 | /// Deserializes a map union value
|
1569 1665 | /// Test ID: AwsJson11DeserializeMapUnionValue
|
1570 1666 | #[::tokio::test]
|
1571 1667 | #[::tracing_test::traced_test]
|
1572 1668 | async fn aws_json11_deserialize_map_union_value_response() {
|
1573 1669 | let output = crate::output::JsonUnionsOutput {
|
1574 1670 | contents: ::std::option::Option::Some(crate::model::MyUnion::MapValue({
|
1575 1671 | let mut ret = ::std::collections::HashMap::new();
|
1576 1672 | ret.insert("foo".to_owned(), "bar".to_owned());
|
1577 1673 | ret.insert("spam".to_owned(), "eggs".to_owned());
|
1578 1674 | ret
|
1579 1675 | })),
|
1580 1676 | };
|
1581 1677 | use ::aws_smithy_http_server::response::IntoResponse;
|
1582 1678 | let http_response = output.into_response();
|
1583 1679 | ::pretty_assertions::assert_eq!(
|
1584 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1680 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1585 1681 | http_response.status()
|
1586 1682 | );
|
1587 1683 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1588 1684 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1589 1685 | http_response.headers(),
|
1590 1686 | expected_headers,
|
1591 1687 | ));
|
1592 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1688 + | use ::http_body_util::BodyExt;
|
1689 + | let body = http_response
|
1690 + | .into_body()
|
1691 + | .collect()
|
1593 1692 | .await
|
1594 - | .expect("unable to extract body to bytes");
|
1693 + | .expect("unable to collect body")
|
1694 + | .to_bytes();
|
1595 1695 | ::aws_smithy_protocol_test::assert_ok(
|
1596 1696 | ::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"))
|
1597 1697 | );
|
1598 1698 | }
|
1599 1699 |
|
1600 1700 | /// Deserializes a structure union value
|
1601 1701 | /// Test ID: AwsJson11DeserializeStructureUnionValue
|
1602 1702 | #[::tokio::test]
|
1603 1703 | #[::tracing_test::traced_test]
|
1604 1704 | async fn aws_json11_deserialize_structure_union_value_response() {
|
1605 1705 | let output = crate::output::JsonUnionsOutput {
|
1606 1706 | contents: ::std::option::Option::Some(crate::model::MyUnion::StructureValue(
|
1607 1707 | crate::model::GreetingStruct {
|
1608 1708 | hi: ::std::option::Option::Some("hello".to_owned()),
|
1609 1709 | },
|
1610 1710 | )),
|
1611 1711 | };
|
1612 1712 | use ::aws_smithy_http_server::response::IntoResponse;
|
1613 1713 | let http_response = output.into_response();
|
1614 1714 | ::pretty_assertions::assert_eq!(
|
1615 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1715 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
1616 1716 | http_response.status()
|
1617 1717 | );
|
1618 1718 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1619 1719 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1620 1720 | http_response.headers(),
|
1621 1721 | expected_headers,
|
1622 1722 | ));
|
1623 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1723 + | use ::http_body_util::BodyExt;
|
1724 + | let body = http_response
|
1725 + | .into_body()
|
1726 + | .collect()
|
1624 1727 | .await
|
1625 - | .expect("unable to extract body to bytes");
|
1728 + | .expect("unable to collect body")
|
1729 + | .to_bytes();
|
1626 1730 | ::aws_smithy_protocol_test::assert_ok(
|
1627 1731 | ::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"))
|
1628 1732 | );
|
1629 1733 | }
|
1630 1734 | }
|
1631 1735 |
|
1632 1736 | ::pin_project_lite::pin_project! {
|
1633 1737 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1634 1738 | /// [`GreetingWithErrorsInput`](crate::input::GreetingWithErrorsInput) using modelled bindings.
|
1635 1739 | pub struct GreetingWithErrorsInputFuture {
|
1636 1740 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::GreetingWithErrorsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
1637 1741 | }
|
1638 1742 | }
|
1639 1743 |
|
1640 1744 | impl std::future::Future for GreetingWithErrorsInputFuture {
|
1641 1745 | type Output = Result<
|
1642 1746 | crate::input::GreetingWithErrorsInput,
|
1643 1747 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
1644 1748 | >;
|
1645 1749 |
|
1646 1750 | fn poll(
|
1647 1751 | self: std::pin::Pin<&mut Self>,
|
1648 1752 | cx: &mut std::task::Context<'_>,
|
1649 1753 | ) -> std::task::Poll<Self::Output> {
|
1650 1754 | let this = self.project();
|
1651 1755 | this.inner.as_mut().poll(cx)
|
1652 1756 | }
|
1653 1757 | }
|
1654 1758 |
|
1655 1759 | impl<B>
|
1656 1760 | ::aws_smithy_http_server::request::FromRequest<
|
1657 1761 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1658 1762 | B,
|
1659 1763 | > for crate::input::GreetingWithErrorsInput
|
1660 1764 | where
|
1661 1765 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1662 1766 | B: 'static,
|
1663 1767 |
|
1664 1768 | B::Data: Send,
|
1665 1769 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
1666 1770 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1667 1771 | {
|
1668 1772 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
1669 1773 | type Future = GreetingWithErrorsInputFuture;
|
1670 1774 |
|
1671 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1775 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
1672 1776 | let fut = async move {
|
1673 1777 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
1674 1778 | request.headers(),
|
1675 1779 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
1676 1780 | ) {
|
1677 1781 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
1678 1782 | }
|
1679 1783 | crate::protocol_serde::shape_greeting_with_errors::de_greeting_with_errors_http_request(
|
1680 1784 | request,
|
1681 1785 | )
|
1746 1850 | #[::tokio::test]
|
1747 1851 | #[::tracing_test::traced_test]
|
1748 1852 | async fn aws_json11_invalid_greeting_error_response() {
|
1749 1853 | let output = crate::error::InvalidGreeting {
|
1750 1854 | message: ::std::option::Option::Some("Hi".to_owned()),
|
1751 1855 | };
|
1752 1856 | let output = crate::error::GreetingWithErrorsError::InvalidGreeting(output);
|
1753 1857 | use ::aws_smithy_http_server::response::IntoResponse;
|
1754 1858 | let http_response = output.into_response();
|
1755 1859 | ::pretty_assertions::assert_eq!(
|
1756 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1860 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1757 1861 | http_response.status()
|
1758 1862 | );
|
1759 1863 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1760 1864 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1761 1865 | http_response.headers(),
|
1762 1866 | expected_headers,
|
1763 1867 | ));
|
1764 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1868 + | use ::http_body_util::BodyExt;
|
1869 + | let body = http_response
|
1870 + | .into_body()
|
1871 + | .collect()
|
1765 1872 | .await
|
1766 - | .expect("unable to extract body to bytes");
|
1873 + | .expect("unable to collect body")
|
1874 + | .to_bytes();
|
1767 1875 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1768 1876 | &body,
|
1769 1877 | "{\n \"__type\": \"InvalidGreeting\",\n \"Message\": \"Hi\"\n}",
|
1770 1878 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1771 1879 | ));
|
1772 1880 | }
|
1773 1881 |
|
1774 1882 | /// Parses a complex error with no message member
|
1775 1883 | /// Test ID: AwsJson11ComplexError
|
1776 1884 | #[::tokio::test]
|
1777 1885 | #[::tracing_test::traced_test]
|
1778 1886 | async fn aws_json11_complex_error_response() {
|
1779 1887 | let output = crate::error::ComplexError {
|
1780 1888 | top_level: ::std::option::Option::Some("Top level".to_owned()),
|
1781 1889 | nested: ::std::option::Option::Some(crate::model::ComplexNestedErrorData {
|
1782 1890 | foo: ::std::option::Option::Some("bar".to_owned()),
|
1783 1891 | }),
|
1784 1892 | };
|
1785 1893 | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
1786 1894 | use ::aws_smithy_http_server::response::IntoResponse;
|
1787 1895 | let http_response = output.into_response();
|
1788 1896 | ::pretty_assertions::assert_eq!(
|
1789 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1897 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1790 1898 | http_response.status()
|
1791 1899 | );
|
1792 1900 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1793 1901 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1794 1902 | http_response.headers(),
|
1795 1903 | expected_headers,
|
1796 1904 | ));
|
1797 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1905 + | use ::http_body_util::BodyExt;
|
1906 + | let body = http_response
|
1907 + | .into_body()
|
1908 + | .collect()
|
1798 1909 | .await
|
1799 - | .expect("unable to extract body to bytes");
|
1910 + | .expect("unable to collect body")
|
1911 + | .to_bytes();
|
1800 1912 | ::aws_smithy_protocol_test::assert_ok(
|
1801 1913 | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"__type\": \"ComplexError\",\n \"TopLevel\": \"Top level\",\n \"Nested\": {\n \"Foo\": \"bar\"\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
1802 1914 | );
|
1803 1915 | }
|
1804 1916 | /// Test ID: AwsJson11EmptyComplexError
|
1805 1917 | #[::tokio::test]
|
1806 1918 | #[::tracing_test::traced_test]
|
1807 1919 | async fn aws_json11_empty_complex_error_response() {
|
1808 1920 | let output = crate::error::ComplexError {
|
1809 1921 | top_level: ::std::option::Option::None,
|
1810 1922 | nested: ::std::option::Option::None,
|
1811 1923 | };
|
1812 1924 | let output = crate::error::GreetingWithErrorsError::ComplexError(output);
|
1813 1925 | use ::aws_smithy_http_server::response::IntoResponse;
|
1814 1926 | let http_response = output.into_response();
|
1815 1927 | ::pretty_assertions::assert_eq!(
|
1816 - | http::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1928 + | ::http_1x::StatusCode::from_u16(400).expect("invalid expected HTTP status code"),
|
1817 1929 | http_response.status()
|
1818 1930 | );
|
1819 1931 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
1820 1932 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
1821 1933 | http_response.headers(),
|
1822 1934 | expected_headers,
|
1823 1935 | ));
|
1824 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
1936 + | use ::http_body_util::BodyExt;
|
1937 + | let body = http_response
|
1938 + | .into_body()
|
1939 + | .collect()
|
1825 1940 | .await
|
1826 - | .expect("unable to extract body to bytes");
|
1941 + | .expect("unable to collect body")
|
1942 + | .to_bytes();
|
1827 1943 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
1828 1944 | &body,
|
1829 1945 | "{\n \"__type\": \"ComplexError\"\n}",
|
1830 1946 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
1831 1947 | ));
|
1832 1948 | }
|
1833 1949 | }
|
1834 1950 |
|
1835 1951 | ::pin_project_lite::pin_project! {
|
1836 1952 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
1837 1953 | /// [`SparseNullsOperationInput`](crate::input::SparseNullsOperationInput) using modelled bindings.
|
1838 1954 | pub struct SparseNullsOperationInputFuture {
|
1839 1955 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::SparseNullsOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
1840 1956 | }
|
1841 1957 | }
|
1842 1958 |
|
1843 1959 | impl std::future::Future for SparseNullsOperationInputFuture {
|
1844 1960 | type Output = Result<
|
1845 1961 | crate::input::SparseNullsOperationInput,
|
1846 1962 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
1847 1963 | >;
|
1848 1964 |
|
1849 1965 | fn poll(
|
1850 1966 | self: std::pin::Pin<&mut Self>,
|
1851 1967 | cx: &mut std::task::Context<'_>,
|
1852 1968 | ) -> std::task::Poll<Self::Output> {
|
1853 1969 | let this = self.project();
|
1854 1970 | this.inner.as_mut().poll(cx)
|
1855 1971 | }
|
1856 1972 | }
|
1857 1973 |
|
1858 1974 | impl<B>
|
1859 1975 | ::aws_smithy_http_server::request::FromRequest<
|
1860 1976 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1861 1977 | B,
|
1862 1978 | > for crate::input::SparseNullsOperationInput
|
1863 1979 | where
|
1864 1980 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
1865 1981 | B: 'static,
|
1866 1982 |
|
1867 1983 | B::Data: Send,
|
1868 1984 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
1869 1985 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
1870 1986 | {
|
1871 1987 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
1872 1988 | type Future = SparseNullsOperationInputFuture;
|
1873 1989 |
|
1874 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
1990 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
1875 1991 | let fut = async move {
|
1876 1992 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
1877 1993 | request.headers(),
|
1878 1994 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
1879 1995 | ) {
|
1880 1996 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
1881 1997 | }
|
1882 1998 | crate::protocol_serde::shape_sparse_nulls_operation::de_sparse_nulls_operation_http_request(request)
|
1883 1999 | .await
|
1884 2000 | };
|
1885 2001 | use ::futures_util::future::TryFutureExt;
|
1886 2002 | let fut = fut.map_err(
|
1887 2003 | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
1888 2004 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
1889 2005 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
1890 2006 | },
|
1891 2007 | );
|
1892 2008 | SparseNullsOperationInputFuture {
|
1893 2009 | inner: Box::pin(fut),
|
1894 2010 | }
|
1895 2011 | }
|
1896 2012 | }
|
1897 2013 | impl
|
1898 2014 | ::aws_smithy_http_server::response::IntoResponse<
|
1899 2015 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
1900 2016 | > for crate::output::SparseNullsOperationOutput
|
1901 2017 | {
|
1902 2018 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
1903 2019 | match crate::protocol_serde::shape_sparse_nulls_operation::ser_sparse_nulls_operation_http_response(self) {
|
1904 2020 | Ok(response) => response,
|
1905 2021 | Err(e) => {
|
1906 2022 | ::tracing::error!(error = %e, "failed to serialize response");
|
1907 2023 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
1908 2024 | }
|
1909 2025 | }
|
1910 2026 | }
|
1911 2027 | }
|
1912 2028 |
|
1913 2029 | #[allow(unreachable_code, unused_variables)]
|
1914 2030 | #[cfg(test)]
|
1915 2031 | mod sparse_nulls_operation_test {
|
1916 2032 |
|
1917 2033 | /// Serializes null values in maps
|
1918 2034 | /// Test ID: AwsJson11SparseMapsSerializeNullValues
|
1919 2035 | #[::tokio::test]
|
1920 2036 | #[::tracing_test::traced_test]
|
1921 2037 | async fn aws_json11_sparse_maps_serialize_null_values_request() {
|
1922 2038 | #[allow(unused_mut)]
|
1923 - | let mut http_request = http::Request::builder()
|
2039 + | let mut http_request = ::http_1x::Request::builder()
|
1924 2040 | .uri("/")
|
1925 2041 | .method("POST")
|
1926 2042 | .header("Content-Type", "application/x-amz-json-1.1")
|
1927 2043 | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
1928 - | .body(::aws_smithy_http_server::body::Body::from(
|
1929 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2044 + | .body(::aws_smithy_http_server::body::boxed(
|
2045 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2046 + | &::aws_smithy_protocol_test::decode_body_data(
|
1930 2047 | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}".as_bytes(),
|
1931 2048 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2049 + | ),
|
1932 2050 | )),
|
1933 2051 | ))
|
1934 2052 | .unwrap();
|
1935 2053 | #[allow(unused_mut)]
|
1936 2054 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1937 2055 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1938 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2056 + | let service = crate::service::JsonProtocol::builder::<
|
2057 + | ::aws_smithy_http_server::body::BoxBody,
|
2058 + | _,
|
2059 + | _,
|
2060 + | _,
|
2061 + | >(config)
|
1939 2062 | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
1940 2063 | let sender = sender.clone();
|
1941 2064 | async move {
|
1942 2065 | let result = {
|
1943 2066 | let expected = crate::input::SparseNullsOperationInput {
|
1944 2067 | sparse_string_map: ::std::option::Option::Some({
|
1945 2068 | let mut ret = ::std::collections::HashMap::new();
|
1946 2069 | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
1947 2070 | ret
|
1948 2071 | }),
|
1949 2072 | sparse_string_list: ::std::option::Option::None,
|
1950 2073 | };
|
1951 2074 | ::pretty_assertions::assert_eq!(input, expected);
|
1952 2075 | let output = crate::output::SparseNullsOperationOutput {
|
1953 2076 | sparse_string_list: ::std::option::Option::None,
|
1954 2077 | sparse_string_map: ::std::option::Option::None,
|
1955 2078 | };
|
1956 2079 | output
|
1957 2080 | };
|
1958 2081 | sender.send(()).await.expect("receiver dropped early");
|
1959 2082 | result
|
1960 2083 | }
|
1961 2084 | })
|
1962 2085 | .build_unchecked();
|
1963 2086 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
1964 2087 | .await
|
1965 2088 | .expect("unable to make an HTTP request");
|
1966 2089 | assert!(
|
1967 2090 | receiver.recv().await.is_some(),
|
1968 2091 | "we expected operation handler to be invoked but it was not entered"
|
1969 2092 | );
|
1970 2093 | }
|
1971 2094 |
|
1972 2095 | /// Serializes null values in lists
|
1973 2096 | /// Test ID: AwsJson11SparseListsSerializeNull
|
1974 2097 | #[::tokio::test]
|
1975 2098 | #[::tracing_test::traced_test]
|
1976 2099 | async fn aws_json11_sparse_lists_serialize_null_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("/")
|
1980 2103 | .method("POST")
|
1981 2104 | .header("Content-Type", "application/x-amz-json-1.1")
|
1982 2105 | .header("X-Amz-Target", "JsonProtocol.SparseNullsOperation")
|
1983 - | .body(::aws_smithy_http_server::body::Body::from(
|
1984 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2106 + | .body(::aws_smithy_http_server::body::boxed(
|
2107 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2108 + | &::aws_smithy_protocol_test::decode_body_data(
|
1985 2109 | "{\n \"sparseStringList\": [\n null\n ]\n}".as_bytes(),
|
1986 2110 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2111 + | ),
|
1987 2112 | )),
|
1988 2113 | ))
|
1989 2114 | .unwrap();
|
1990 2115 | #[allow(unused_mut)]
|
1991 2116 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
1992 2117 | let config = crate::service::JsonProtocolConfig::builder().build();
|
1993 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2118 + | let service = crate::service::JsonProtocol::builder::<
|
2119 + | ::aws_smithy_http_server::body::BoxBody,
|
2120 + | _,
|
2121 + | _,
|
2122 + | _,
|
2123 + | >(config)
|
1994 2124 | .sparse_nulls_operation(move |input: crate::input::SparseNullsOperationInput| {
|
1995 2125 | let sender = sender.clone();
|
1996 2126 | async move {
|
1997 2127 | let result = {
|
1998 2128 | let expected = crate::input::SparseNullsOperationInput {
|
1999 2129 | sparse_string_list: ::std::option::Option::Some(vec![
|
2000 2130 | ::std::option::Option::None,
|
2001 2131 | ]),
|
2002 2132 | sparse_string_map: ::std::option::Option::None,
|
2003 2133 | };
|
2004 2134 | ::pretty_assertions::assert_eq!(input, expected);
|
2005 2135 | let output = crate::output::SparseNullsOperationOutput {
|
2006 2136 | sparse_string_list: ::std::option::Option::None,
|
2007 2137 | sparse_string_map: ::std::option::Option::None,
|
2008 2138 | };
|
2009 2139 | output
|
2010 2140 | };
|
2011 2141 | sender.send(()).await.expect("receiver dropped early");
|
2012 2142 | result
|
2013 2143 | }
|
2014 2144 | })
|
2015 2145 | .build_unchecked();
|
2016 2146 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2017 2147 | .await
|
2018 2148 | .expect("unable to make an HTTP request");
|
2019 2149 | assert!(
|
2020 2150 | receiver.recv().await.is_some(),
|
2021 2151 | "we expected operation handler to be invoked but it was not entered"
|
2022 2152 | );
|
2023 2153 | }
|
2024 2154 |
|
2025 2155 | /// Deserializes null values in maps
|
2026 2156 | /// Test ID: AwsJson11SparseMapsDeserializeNullValues
|
2027 2157 | #[::tokio::test]
|
2028 2158 | #[::tracing_test::traced_test]
|
2029 2159 | async fn aws_json11_sparse_maps_deserialize_null_values_response() {
|
2030 2160 | let output = crate::output::SparseNullsOperationOutput {
|
2031 2161 | sparse_string_map: ::std::option::Option::Some({
|
2032 2162 | let mut ret = ::std::collections::HashMap::new();
|
2033 2163 | ret.insert("foo".to_owned(), ::std::option::Option::None);
|
2034 2164 | ret
|
2035 2165 | }),
|
2036 2166 | sparse_string_list: ::std::option::Option::None,
|
2037 2167 | };
|
2038 2168 | use ::aws_smithy_http_server::response::IntoResponse;
|
2039 2169 | let http_response = output.into_response();
|
2040 2170 | ::pretty_assertions::assert_eq!(
|
2041 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2171 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2042 2172 | http_response.status()
|
2043 2173 | );
|
2044 2174 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2045 2175 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2046 2176 | http_response.headers(),
|
2047 2177 | expected_headers,
|
2048 2178 | ));
|
2049 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2179 + | use ::http_body_util::BodyExt;
|
2180 + | let body = http_response
|
2181 + | .into_body()
|
2182 + | .collect()
|
2050 2183 | .await
|
2051 - | .expect("unable to extract body to bytes");
|
2184 + | .expect("unable to collect body")
|
2185 + | .to_bytes();
|
2052 2186 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2053 2187 | &body,
|
2054 2188 | "{\n \"sparseStringMap\": {\n \"foo\": null\n }\n}",
|
2055 2189 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2056 2190 | ));
|
2057 2191 | }
|
2058 2192 |
|
2059 2193 | /// Deserializes null values in lists
|
2060 2194 | /// Test ID: AwsJson11SparseListsDeserializeNull
|
2061 2195 | #[::tokio::test]
|
2062 2196 | #[::tracing_test::traced_test]
|
2063 2197 | async fn aws_json11_sparse_lists_deserialize_null_response() {
|
2064 2198 | let output = crate::output::SparseNullsOperationOutput {
|
2065 2199 | sparse_string_list: ::std::option::Option::Some(vec![::std::option::Option::None]),
|
2066 2200 | sparse_string_map: ::std::option::Option::None,
|
2067 2201 | };
|
2068 2202 | use ::aws_smithy_http_server::response::IntoResponse;
|
2069 2203 | let http_response = output.into_response();
|
2070 2204 | ::pretty_assertions::assert_eq!(
|
2071 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2205 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2072 2206 | http_response.status()
|
2073 2207 | );
|
2074 2208 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2075 2209 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2076 2210 | http_response.headers(),
|
2077 2211 | expected_headers,
|
2078 2212 | ));
|
2079 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2213 + | use ::http_body_util::BodyExt;
|
2214 + | let body = http_response
|
2215 + | .into_body()
|
2216 + | .collect()
|
2080 2217 | .await
|
2081 - | .expect("unable to extract body to bytes");
|
2218 + | .expect("unable to collect body")
|
2219 + | .to_bytes();
|
2082 2220 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2083 2221 | &body,
|
2084 2222 | "{\n \"sparseStringList\": [\n null\n ]\n}",
|
2085 2223 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2086 2224 | ));
|
2087 2225 | }
|
2088 2226 | }
|
2089 2227 |
|
2090 2228 | ::pin_project_lite::pin_project! {
|
2091 2229 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2092 2230 | /// [`NullOperationInput`](crate::input::NullOperationInput) using modelled bindings.
|
2093 2231 | pub struct NullOperationInputFuture {
|
2094 2232 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::NullOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2095 2233 | }
|
2096 2234 | }
|
2097 2235 |
|
2098 2236 | impl std::future::Future for NullOperationInputFuture {
|
2099 2237 | type Output = Result<
|
2100 2238 | crate::input::NullOperationInput,
|
2101 2239 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2102 2240 | >;
|
2103 2241 |
|
2104 2242 | fn poll(
|
2105 2243 | self: std::pin::Pin<&mut Self>,
|
2106 2244 | cx: &mut std::task::Context<'_>,
|
2107 2245 | ) -> std::task::Poll<Self::Output> {
|
2108 2246 | let this = self.project();
|
2109 2247 | this.inner.as_mut().poll(cx)
|
2110 2248 | }
|
2111 2249 | }
|
2112 2250 |
|
2113 2251 | impl<B>
|
2114 2252 | ::aws_smithy_http_server::request::FromRequest<
|
2115 2253 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2116 2254 | B,
|
2117 2255 | > for crate::input::NullOperationInput
|
2118 2256 | where
|
2119 2257 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2120 2258 | B: 'static,
|
2121 2259 |
|
2122 2260 | B::Data: Send,
|
2123 2261 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2124 2262 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2125 2263 | {
|
2126 2264 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2127 2265 | type Future = NullOperationInputFuture;
|
2128 2266 |
|
2129 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2267 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2130 2268 | let fut = async move {
|
2131 2269 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2132 2270 | request.headers(),
|
2133 2271 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2134 2272 | ) {
|
2135 2273 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2136 2274 | }
|
2137 2275 | crate::protocol_serde::shape_null_operation::de_null_operation_http_request(request)
|
2138 2276 | .await
|
2139 2277 | };
|
2140 2278 | use ::futures_util::future::TryFutureExt;
|
2141 2279 | let fut = fut.map_err(
|
2142 2280 | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2143 2281 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2144 2282 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2145 2283 | },
|
2146 2284 | );
|
2147 2285 | NullOperationInputFuture {
|
2148 2286 | inner: Box::pin(fut),
|
2149 2287 | }
|
2150 2288 | }
|
2151 2289 | }
|
2152 2290 | impl
|
2153 2291 | ::aws_smithy_http_server::response::IntoResponse<
|
2154 2292 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2155 2293 | > for crate::output::NullOperationOutput
|
2156 2294 | {
|
2157 2295 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2158 2296 | match crate::protocol_serde::shape_null_operation::ser_null_operation_http_response(self) {
|
2159 2297 | Ok(response) => response,
|
2160 2298 | Err(e) => {
|
2161 2299 | ::tracing::error!(error = %e, "failed to serialize response");
|
2162 2300 | ::aws_smithy_http_server::response::IntoResponse::<
|
2163 2301 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2164 2302 | >::into_response(
|
2165 2303 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
2166 2304 | e,
|
2167 2305 | ),
|
2168 2306 | )
|
2169 2307 | }
|
2170 2308 | }
|
2171 2309 | }
|
2172 2310 | }
|
2173 2311 |
|
2174 2312 | #[allow(unreachable_code, unused_variables)]
|
2175 2313 | #[cfg(test)]
|
2176 2314 | mod null_operation_test {
|
2177 2315 |
|
2178 2316 | /// Null structure values are dropped
|
2179 2317 | /// Test ID: AwsJson11ServersDontDeserializeNullStructureValues
|
2180 2318 | #[::tokio::test]
|
2181 2319 | #[::tracing_test::traced_test]
|
2182 2320 | async fn aws_json11_servers_dont_deserialize_null_structure_values_request() {
|
2183 2321 | #[allow(unused_mut)]
|
2184 - | let mut http_request = http::Request::builder()
|
2322 + | let mut http_request = ::http_1x::Request::builder()
|
2185 2323 | .uri("/")
|
2186 2324 | .method("POST")
|
2187 2325 | .header("Content-Type", "application/x-amz-json-1.1")
|
2188 2326 | .header("X-Amz-Target", "JsonProtocol.NullOperation")
|
2189 - | .body(::aws_smithy_http_server::body::Body::from(
|
2190 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
2327 + | .body(::aws_smithy_http_server::body::boxed(
|
2328 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
2329 + | &::aws_smithy_protocol_test::decode_body_data(
|
2191 2330 | "{\n \"string\": null\n}".as_bytes(),
|
2192 2331 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2332 + | ),
|
2193 2333 | )),
|
2194 2334 | ))
|
2195 2335 | .unwrap();
|
2196 2336 | #[allow(unused_mut)]
|
2197 2337 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2198 2338 | let config = crate::service::JsonProtocolConfig::builder().build();
|
2199 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2339 + | let service = crate::service::JsonProtocol::builder::<
|
2340 + | ::aws_smithy_http_server::body::BoxBody,
|
2341 + | _,
|
2342 + | _,
|
2343 + | _,
|
2344 + | >(config)
|
2200 2345 | .null_operation(move |input: crate::input::NullOperationInput| {
|
2201 2346 | let sender = sender.clone();
|
2202 2347 | async move {
|
2203 2348 | let result = {
|
2204 2349 | let expected = crate::input::NullOperationInput {
|
2205 2350 | string: ::std::option::Option::None,
|
2206 2351 | };
|
2207 2352 | ::pretty_assertions::assert_eq!(input, expected);
|
2208 2353 | let output = crate::output::NullOperationOutput {
|
2209 2354 | string: ::std::option::Option::None,
|
2210 2355 | };
|
2211 2356 | output
|
2212 2357 | };
|
2213 2358 | sender.send(()).await.expect("receiver dropped early");
|
2214 2359 | result
|
2215 2360 | }
|
2216 2361 | })
|
2217 2362 | .build_unchecked();
|
2218 2363 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2219 2364 | .await
|
2220 2365 | .expect("unable to make an HTTP request");
|
2221 2366 | assert!(
|
2222 2367 | receiver.recv().await.is_some(),
|
2223 2368 | "we expected operation handler to be invoked but it was not entered"
|
2224 2369 | );
|
2225 2370 | }
|
2226 2371 |
|
2227 2372 | /// Null structure values are dropped
|
2228 2373 | /// Test ID: AwsJson11ServersDontSerializeNullStructureValues
|
2229 2374 | #[::tokio::test]
|
2230 2375 | #[::tracing_test::traced_test]
|
2231 2376 | async fn aws_json11_servers_dont_serialize_null_structure_values_response() {
|
2232 2377 | let output = crate::output::NullOperationOutput {
|
2233 2378 | string: ::std::option::Option::None,
|
2234 2379 | };
|
2235 2380 | use ::aws_smithy_http_server::response::IntoResponse;
|
2236 2381 | let http_response = output.into_response();
|
2237 2382 | ::pretty_assertions::assert_eq!(
|
2238 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2383 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2239 2384 | http_response.status()
|
2240 2385 | );
|
2241 2386 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2242 2387 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2243 2388 | http_response.headers(),
|
2244 2389 | expected_headers,
|
2245 2390 | ));
|
2246 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2391 + | use ::http_body_util::BodyExt;
|
2392 + | let body = http_response
|
2393 + | .into_body()
|
2394 + | .collect()
|
2247 2395 | .await
|
2248 - | .expect("unable to extract body to bytes");
|
2396 + | .expect("unable to collect body")
|
2397 + | .to_bytes();
|
2249 2398 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2250 2399 | &body,
|
2251 2400 | "{}",
|
2252 2401 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2253 2402 | ));
|
2254 2403 | }
|
2255 2404 | }
|
2256 2405 |
|
2257 2406 | ::pin_project_lite::pin_project! {
|
2258 2407 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2259 2408 | /// [`JsonIntEnumsInput`](crate::input::JsonIntEnumsInput) using modelled bindings.
|
2260 2409 | pub struct JsonIntEnumsInputFuture {
|
2261 2410 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::JsonIntEnumsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2262 2411 | }
|
2263 2412 | }
|
2264 2413 |
|
2265 2414 | impl std::future::Future for JsonIntEnumsInputFuture {
|
2266 2415 | type Output = Result<
|
2267 2416 | crate::input::JsonIntEnumsInput,
|
2268 2417 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2269 2418 | >;
|
2270 2419 |
|
2271 2420 | fn poll(
|
2272 2421 | self: std::pin::Pin<&mut Self>,
|
2273 2422 | cx: &mut std::task::Context<'_>,
|
2274 2423 | ) -> std::task::Poll<Self::Output> {
|
2275 2424 | let this = self.project();
|
2276 2425 | this.inner.as_mut().poll(cx)
|
2277 2426 | }
|
2278 2427 | }
|
2279 2428 |
|
2280 2429 | impl<B>
|
2281 2430 | ::aws_smithy_http_server::request::FromRequest<
|
2282 2431 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2283 2432 | B,
|
2284 2433 | > for crate::input::JsonIntEnumsInput
|
2285 2434 | where
|
2286 2435 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2287 2436 | B: 'static,
|
2288 2437 |
|
2289 2438 | B::Data: Send,
|
2290 2439 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2291 2440 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2292 2441 | {
|
2293 2442 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2294 2443 | type Future = JsonIntEnumsInputFuture;
|
2295 2444 |
|
2296 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2445 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2297 2446 | let fut = async move {
|
2298 2447 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2299 2448 | request.headers(),
|
2300 2449 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2301 2450 | ) {
|
2302 2451 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2303 2452 | }
|
2304 2453 | crate::protocol_serde::shape_json_int_enums::de_json_int_enums_http_request(request)
|
2305 2454 | .await
|
2306 2455 | };
|
2735 2898 | "zero".to_owned(),
|
2736 2899 | "0".parse::<crate::model::FooEnum>()
|
2737 2900 | .expect("static value validated to member"),
|
2738 2901 | );
|
2739 2902 | ret
|
2740 2903 | }),
|
2741 2904 | };
|
2742 2905 | use ::aws_smithy_http_server::response::IntoResponse;
|
2743 2906 | let http_response = output.into_response();
|
2744 2907 | ::pretty_assertions::assert_eq!(
|
2745 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2908 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2746 2909 | http_response.status()
|
2747 2910 | );
|
2748 2911 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2749 2912 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2750 2913 | http_response.headers(),
|
2751 2914 | expected_headers,
|
2752 2915 | ));
|
2753 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
2916 + | use ::http_body_util::BodyExt;
|
2917 + | let body = http_response
|
2918 + | .into_body()
|
2919 + | .collect()
|
2754 2920 | .await
|
2755 - | .expect("unable to extract body to bytes");
|
2921 + | .expect("unable to collect body")
|
2922 + | .to_bytes();
|
2756 2923 | ::aws_smithy_protocol_test::assert_ok(
|
2757 2924 | ::aws_smithy_protocol_test::validate_body(&body, "{\n \"fooEnum1\": \"Foo\",\n \"fooEnum2\": \"0\",\n \"fooEnum3\": \"1\",\n \"fooEnumList\": [\n \"Foo\",\n \"0\"\n ],\n \"fooEnumSet\": [\n \"Foo\",\n \"0\"\n ],\n \"fooEnumMap\": {\n \"hi\": \"Foo\",\n \"zero\": \"0\"\n }\n}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
2758 2925 | );
|
2759 2926 | }
|
2760 2927 | }
|
2761 2928 |
|
2762 2929 | ::pin_project_lite::pin_project! {
|
2763 2930 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2764 2931 | /// [`PutAndGetInlineDocumentsInput`](crate::input::PutAndGetInlineDocumentsInput) using modelled bindings.
|
2765 2932 | pub struct PutAndGetInlineDocumentsInputFuture {
|
2766 2933 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::PutAndGetInlineDocumentsInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2767 2934 | }
|
2768 2935 | }
|
2769 2936 |
|
2770 2937 | impl std::future::Future for PutAndGetInlineDocumentsInputFuture {
|
2771 2938 | type Output = Result<
|
2772 2939 | crate::input::PutAndGetInlineDocumentsInput,
|
2773 2940 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2774 2941 | >;
|
2775 2942 |
|
2776 2943 | fn poll(
|
2777 2944 | self: std::pin::Pin<&mut Self>,
|
2778 2945 | cx: &mut std::task::Context<'_>,
|
2779 2946 | ) -> std::task::Poll<Self::Output> {
|
2780 2947 | let this = self.project();
|
2781 2948 | this.inner.as_mut().poll(cx)
|
2782 2949 | }
|
2783 2950 | }
|
2784 2951 |
|
2785 2952 | impl<B>
|
2786 2953 | ::aws_smithy_http_server::request::FromRequest<
|
2787 2954 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2788 2955 | B,
|
2789 2956 | > for crate::input::PutAndGetInlineDocumentsInput
|
2790 2957 | where
|
2791 2958 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2792 2959 | B: 'static,
|
2793 2960 |
|
2794 2961 | B::Data: Send,
|
2795 2962 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2796 2963 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2797 2964 | {
|
2798 2965 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2799 2966 | type Future = PutAndGetInlineDocumentsInputFuture;
|
2800 2967 |
|
2801 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
2968 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2802 2969 | let fut = async move {
|
2803 2970 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2804 2971 | request.headers(),
|
2805 2972 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2806 2973 | ) {
|
2807 2974 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2808 2975 | }
|
2809 2976 | crate::protocol_serde::shape_put_and_get_inline_documents::de_put_and_get_inline_documents_http_request(request)
|
2810 2977 | .await
|
2811 2978 | };
|
2812 2979 | use ::futures_util::future::TryFutureExt;
|
2813 2980 | let fut = fut.map_err(
|
2814 2981 | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
2815 2982 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
2816 2983 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
2817 2984 | },
|
2818 2985 | );
|
2819 2986 | PutAndGetInlineDocumentsInputFuture {
|
2820 2987 | inner: Box::pin(fut),
|
2821 2988 | }
|
2822 2989 | }
|
2823 2990 | }
|
2824 2991 | impl
|
2825 2992 | ::aws_smithy_http_server::response::IntoResponse<
|
2826 2993 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2827 2994 | > for crate::output::PutAndGetInlineDocumentsOutput
|
2828 2995 | {
|
2829 2996 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
2830 2997 | match crate::protocol_serde::shape_put_and_get_inline_documents::ser_put_and_get_inline_documents_http_response(self) {
|
2831 2998 | Ok(response) => response,
|
2832 2999 | Err(e) => {
|
2833 3000 | ::tracing::error!(error = %e, "failed to serialize response");
|
2834 3001 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
2835 3002 | }
|
2836 3003 | }
|
2837 3004 | }
|
2838 3005 | }
|
2839 3006 |
|
2840 3007 | #[allow(unreachable_code, unused_variables)]
|
2841 3008 | #[cfg(test)]
|
2842 3009 | mod put_and_get_inline_documents_test {
|
2843 3010 |
|
2844 3011 | /// Serializes inline documents in a JSON request.
|
2845 3012 | /// Test ID: PutAndGetInlineDocumentsInput
|
2846 3013 | #[::tokio::test]
|
2847 3014 | #[::tracing_test::traced_test]
|
2848 3015 | async fn put_and_get_inline_documents_input_request() {
|
2849 3016 | #[allow(unused_mut)]
|
2850 - | let mut http_request = http::Request::builder()
|
3017 + | let mut http_request = ::http_1x::Request::builder()
|
2851 3018 | .uri("/")
|
2852 3019 | .method("POST")
|
2853 3020 | .header("Content-Type", "application/x-amz-json-1.1")
|
2854 3021 | .header("X-Amz-Target", "JsonProtocol.PutAndGetInlineDocuments")
|
2855 - | .body(::aws_smithy_http_server::body::Body::from(
|
2856 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3022 + | .body(::aws_smithy_http_server::body::boxed(
|
3023 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3024 + | &::aws_smithy_protocol_test::decode_body_data(
|
2857 3025 | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}".as_bytes(),
|
2858 3026 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3027 + | ),
|
2859 3028 | )),
|
2860 3029 | ))
|
2861 3030 | .unwrap();
|
2862 3031 | #[allow(unused_mut)]
|
2863 3032 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
2864 3033 | let config = crate::service::JsonProtocolConfig::builder().build();
|
2865 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
2866 - | .put_and_get_inline_documents(
|
2867 - | move |input: crate::input::PutAndGetInlineDocumentsInput| {
|
3034 + | let service = crate::service::JsonProtocol::builder::<
|
3035 + | ::aws_smithy_http_server::body::BoxBody,
|
3036 + | _,
|
3037 + | _,
|
3038 + | _,
|
3039 + | >(config)
|
3040 + | .put_and_get_inline_documents(move |input: crate::input::PutAndGetInlineDocumentsInput| {
|
2868 3041 | let sender = sender.clone();
|
2869 3042 | async move {
|
2870 3043 | let result = {
|
2871 3044 | let expected = crate::input::PutAndGetInlineDocumentsInput {
|
2872 3045 | inline_document: ::std::option::Option::Some({
|
2873 3046 | let json_bytes = br#"{
|
2874 3047 | "foo": "bar"
|
2875 3048 | }"#;
|
2876 3049 | let mut tokens =
|
2877 3050 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
2878 3051 | .peekable();
|
2879 - | ::aws_smithy_json::deserialize::token::expect_document(
|
2880 - | &mut tokens,
|
2881 - | )
|
3052 + | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
2882 3053 | .expect("well formed json")
|
2883 3054 | }),
|
2884 3055 | };
|
2885 3056 | ::pretty_assertions::assert_eq!(input, expected);
|
2886 3057 | let output = crate::output::PutAndGetInlineDocumentsOutput {
|
2887 3058 | inline_document: ::std::option::Option::Some({
|
2888 3059 | let json_bytes = br#"null"#;
|
2889 3060 | let mut tokens =
|
2890 3061 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes)
|
2891 3062 | .peekable();
|
2892 - | ::aws_smithy_json::deserialize::token::expect_document(
|
2893 - | &mut tokens,
|
2894 - | )
|
3063 + | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
2895 3064 | .expect("well formed json")
|
2896 3065 | }),
|
2897 3066 | };
|
2898 3067 | output
|
2899 3068 | };
|
2900 3069 | sender.send(()).await.expect("receiver dropped early");
|
2901 3070 | result
|
2902 3071 | }
|
2903 - | },
|
2904 - | )
|
3072 + | })
|
2905 3073 | .build_unchecked();
|
2906 3074 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
2907 3075 | .await
|
2908 3076 | .expect("unable to make an HTTP request");
|
2909 3077 | assert!(
|
2910 3078 | receiver.recv().await.is_some(),
|
2911 3079 | "we expected operation handler to be invoked but it was not entered"
|
2912 3080 | );
|
2913 3081 | }
|
2914 3082 |
|
2915 3083 | /// Serializes inline documents in a JSON response.
|
2916 3084 | /// Test ID: PutAndGetInlineDocumentsInput
|
2917 3085 | #[::tokio::test]
|
2918 3086 | #[::tracing_test::traced_test]
|
2919 3087 | async fn put_and_get_inline_documents_input_response() {
|
2920 3088 | let output = crate::output::PutAndGetInlineDocumentsOutput {
|
2921 3089 | inline_document: ::std::option::Option::Some({
|
2922 3090 | let json_bytes = br#"{
|
2923 3091 | "foo": "bar"
|
2924 3092 | }"#;
|
2925 3093 | let mut tokens =
|
2926 3094 | ::aws_smithy_json::deserialize::json_token_iter(json_bytes).peekable();
|
2927 3095 | ::aws_smithy_json::deserialize::token::expect_document(&mut tokens)
|
2928 3096 | .expect("well formed json")
|
2929 3097 | }),
|
2930 3098 | };
|
2931 3099 | use ::aws_smithy_http_server::response::IntoResponse;
|
2932 3100 | let http_response = output.into_response();
|
2933 3101 | ::pretty_assertions::assert_eq!(
|
2934 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3102 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
2935 3103 | http_response.status()
|
2936 3104 | );
|
2937 3105 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
2938 3106 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
2939 3107 | http_response.headers(),
|
2940 3108 | expected_headers,
|
2941 3109 | ));
|
2942 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3110 + | use ::http_body_util::BodyExt;
|
3111 + | let body = http_response
|
3112 + | .into_body()
|
3113 + | .collect()
|
2943 3114 | .await
|
2944 - | .expect("unable to extract body to bytes");
|
3115 + | .expect("unable to collect body")
|
3116 + | .to_bytes();
|
2945 3117 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
2946 3118 | &body,
|
2947 3119 | "{\n \"inlineDocument\": {\"foo\": \"bar\"}\n}",
|
2948 3120 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
2949 3121 | ));
|
2950 3122 | }
|
2951 3123 | }
|
2952 3124 |
|
2953 3125 | ::pin_project_lite::pin_project! {
|
2954 3126 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
2955 3127 | /// [`OperationWithOptionalInputOutputInput`](crate::input::OperationWithOptionalInputOutputInput) using modelled bindings.
|
2956 3128 | pub struct OperationWithOptionalInputOutputInputFuture {
|
2957 3129 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::OperationWithOptionalInputOutputInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
2958 3130 | }
|
2959 3131 | }
|
2960 3132 |
|
2961 3133 | impl std::future::Future for OperationWithOptionalInputOutputInputFuture {
|
2962 3134 | type Output = Result<
|
2963 3135 | crate::input::OperationWithOptionalInputOutputInput,
|
2964 3136 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
2965 3137 | >;
|
2966 3138 |
|
2967 3139 | fn poll(
|
2968 3140 | self: std::pin::Pin<&mut Self>,
|
2969 3141 | cx: &mut std::task::Context<'_>,
|
2970 3142 | ) -> std::task::Poll<Self::Output> {
|
2971 3143 | let this = self.project();
|
2972 3144 | this.inner.as_mut().poll(cx)
|
2973 3145 | }
|
2974 3146 | }
|
2975 3147 |
|
2976 3148 | impl<B>
|
2977 3149 | ::aws_smithy_http_server::request::FromRequest<
|
2978 3150 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
2979 3151 | B,
|
2980 3152 | > for crate::input::OperationWithOptionalInputOutputInput
|
2981 3153 | where
|
2982 3154 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
2983 3155 | B: 'static,
|
2984 3156 |
|
2985 3157 | B::Data: Send,
|
2986 3158 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
2987 3159 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
2988 3160 | {
|
2989 3161 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
2990 3162 | type Future = OperationWithOptionalInputOutputInputFuture;
|
2991 3163 |
|
2992 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3164 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
2993 3165 | let fut = async move {
|
2994 3166 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
2995 3167 | request.headers(),
|
2996 3168 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
2997 3169 | ) {
|
2998 3170 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
2999 3171 | }
|
3000 3172 | crate::protocol_serde::shape_operation_with_optional_input_output::de_operation_with_optional_input_output_http_request(request)
|
3001 3173 | .await
|
3002 3174 | };
|
3003 3175 | use ::futures_util::future::TryFutureExt;
|
3004 3176 | let fut = fut.map_err(
|
3005 3177 | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
3006 3178 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3007 3179 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
3008 3180 | },
|
3009 3181 | );
|
3010 3182 | OperationWithOptionalInputOutputInputFuture {
|
3011 3183 | inner: Box::pin(fut),
|
3012 3184 | }
|
3013 3185 | }
|
3014 3186 | }
|
3015 3187 | impl
|
3016 3188 | ::aws_smithy_http_server::response::IntoResponse<
|
3017 3189 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3018 3190 | > for crate::output::OperationWithOptionalInputOutputOutput
|
3019 3191 | {
|
3020 3192 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3021 3193 | match crate::protocol_serde::shape_operation_with_optional_input_output::ser_operation_with_optional_input_output_http_response(self) {
|
3022 3194 | Ok(response) => response,
|
3023 3195 | Err(e) => {
|
3024 3196 | ::tracing::error!(error = %e, "failed to serialize response");
|
3025 3197 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3026 3198 | }
|
3027 3199 | }
|
3028 3200 | }
|
3029 3201 | }
|
3030 3202 |
|
3031 3203 | #[allow(unreachable_code, unused_variables)]
|
3032 3204 | #[cfg(test)]
|
3033 3205 | mod operation_with_optional_input_output_test {
|
3034 3206 |
|
3035 3207 | /// Can call operations with no input or output
|
3036 3208 | /// Test ID: can_call_operation_with_no_input_or_output
|
3037 3209 | #[::tokio::test]
|
3038 3210 | #[::tracing_test::traced_test]
|
3039 3211 | async fn can_call_operation_with_no_input_or_output_request() {
|
3040 3212 | #[allow(unused_mut)]
|
3041 - | let mut http_request = http::Request::builder()
|
3213 + | let mut http_request = ::http_1x::Request::builder()
|
3042 3214 | .uri("/")
|
3043 3215 | .method("POST")
|
3044 3216 | .header("Content-Type", "application/x-amz-json-1.1")
|
3045 3217 | .header(
|
3046 3218 | "X-Amz-Target",
|
3047 3219 | "JsonProtocol.OperationWithOptionalInputOutput",
|
3048 3220 | )
|
3049 - | .body(::aws_smithy_http_server::body::Body::from(
|
3050 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3221 + | .body(::aws_smithy_http_server::body::boxed(
|
3222 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3223 + | &::aws_smithy_protocol_test::decode_body_data(
|
3051 3224 | "{}".as_bytes(),
|
3052 3225 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3226 + | ),
|
3053 3227 | )),
|
3054 3228 | ))
|
3055 3229 | .unwrap();
|
3056 3230 | #[allow(unused_mut)]
|
3057 3231 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3058 3232 | let config = crate::service::JsonProtocolConfig::builder().build();
|
3059 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3233 + | let service = crate::service::JsonProtocol::builder::<
|
3234 + | ::aws_smithy_http_server::body::BoxBody,
|
3235 + | _,
|
3236 + | _,
|
3237 + | _,
|
3238 + | >(config)
|
3060 3239 | .operation_with_optional_input_output(
|
3061 3240 | move |input: crate::input::OperationWithOptionalInputOutputInput| {
|
3062 3241 | let sender = sender.clone();
|
3063 3242 | async move {
|
3064 3243 | let result = {
|
3065 3244 | let expected = crate::input::OperationWithOptionalInputOutputInput {
|
3066 3245 | value: ::std::option::Option::None,
|
3067 3246 | };
|
3068 3247 | ::pretty_assertions::assert_eq!(input, expected);
|
3069 3248 | let output = crate::output::OperationWithOptionalInputOutputOutput {
|
3070 3249 | value: ::std::option::Option::None,
|
3071 3250 | };
|
3072 3251 | output
|
3073 3252 | };
|
3074 3253 | sender.send(()).await.expect("receiver dropped early");
|
3075 3254 | result
|
3076 3255 | }
|
3077 3256 | },
|
3078 3257 | )
|
3079 3258 | .build_unchecked();
|
3080 3259 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3081 3260 | .await
|
3082 3261 | .expect("unable to make an HTTP request");
|
3083 3262 | assert!(
|
3084 3263 | receiver.recv().await.is_some(),
|
3085 3264 | "we expected operation handler to be invoked but it was not entered"
|
3086 3265 | );
|
3087 3266 | }
|
3088 3267 |
|
3089 3268 | /// Can invoke operations with optional input
|
3090 3269 | /// Test ID: can_call_operation_with_optional_input
|
3091 3270 | #[::tokio::test]
|
3092 3271 | #[::tracing_test::traced_test]
|
3093 3272 | async fn can_call_operation_with_optional_input_request() {
|
3094 3273 | #[allow(unused_mut)]
|
3095 - | let mut http_request = http::Request::builder()
|
3274 + | let mut http_request = ::http_1x::Request::builder()
|
3096 3275 | .uri("/")
|
3097 3276 | .method("POST")
|
3098 3277 | .header("Content-Type", "application/x-amz-json-1.1")
|
3099 3278 | .header(
|
3100 3279 | "X-Amz-Target",
|
3101 3280 | "JsonProtocol.OperationWithOptionalInputOutput",
|
3102 3281 | )
|
3103 - | .body(::aws_smithy_http_server::body::Body::from(
|
3104 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3282 + | .body(::aws_smithy_http_server::body::boxed(
|
3283 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3284 + | &::aws_smithy_protocol_test::decode_body_data(
|
3105 3285 | "{\"Value\":\"Hi\"}".as_bytes(),
|
3106 3286 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3287 + | ),
|
3107 3288 | )),
|
3108 3289 | ))
|
3109 3290 | .unwrap();
|
3110 3291 | #[allow(unused_mut)]
|
3111 3292 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3112 3293 | let config = crate::service::JsonProtocolConfig::builder().build();
|
3113 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3294 + | let service = crate::service::JsonProtocol::builder::<
|
3295 + | ::aws_smithy_http_server::body::BoxBody,
|
3296 + | _,
|
3297 + | _,
|
3298 + | _,
|
3299 + | >(config)
|
3114 3300 | .operation_with_optional_input_output(
|
3115 3301 | move |input: crate::input::OperationWithOptionalInputOutputInput| {
|
3116 3302 | let sender = sender.clone();
|
3117 3303 | async move {
|
3118 3304 | let result = {
|
3119 3305 | let expected = crate::input::OperationWithOptionalInputOutputInput {
|
3120 3306 | value: ::std::option::Option::Some("Hi".to_owned()),
|
3121 3307 | };
|
3122 3308 | ::pretty_assertions::assert_eq!(input, expected);
|
3123 3309 | let output = crate::output::OperationWithOptionalInputOutputOutput {
|
3173 3359 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
3174 3360 | B: 'static,
|
3175 3361 |
|
3176 3362 | B::Data: Send,
|
3177 3363 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
3178 3364 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
3179 3365 | {
|
3180 3366 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
3181 3367 | type Future = SimpleScalarPropertiesInputFuture;
|
3182 3368 |
|
3183 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3369 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
3184 3370 | let fut = async move {
|
3185 3371 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
3186 3372 | request.headers(),
|
3187 3373 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
3188 3374 | ) {
|
3189 3375 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
3190 3376 | }
|
3191 3377 | crate::protocol_serde::shape_simple_scalar_properties::de_simple_scalar_properties_http_request(request)
|
3192 3378 | .await
|
3193 3379 | };
|
3194 3380 | use ::futures_util::future::TryFutureExt;
|
3195 3381 | let fut = fut.map_err(
|
3196 3382 | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
3197 3383 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
3198 3384 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
3199 3385 | },
|
3200 3386 | );
|
3201 3387 | SimpleScalarPropertiesInputFuture {
|
3202 3388 | inner: Box::pin(fut),
|
3203 3389 | }
|
3204 3390 | }
|
3205 3391 | }
|
3206 3392 | impl
|
3207 3393 | ::aws_smithy_http_server::response::IntoResponse<
|
3208 3394 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3209 3395 | > for crate::output::SimpleScalarPropertiesOutput
|
3210 3396 | {
|
3211 3397 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
3212 3398 | match crate::protocol_serde::shape_simple_scalar_properties::ser_simple_scalar_properties_http_response(self) {
|
3213 3399 | Ok(response) => response,
|
3214 3400 | Err(e) => {
|
3215 3401 | ::tracing::error!(error = %e, "failed to serialize response");
|
3216 3402 | ::aws_smithy_http_server::response::IntoResponse::<::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1>::into_response(::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e))
|
3217 3403 | }
|
3218 3404 | }
|
3219 3405 | }
|
3220 3406 | }
|
3221 3407 |
|
3222 3408 | #[allow(unreachable_code, unused_variables)]
|
3223 3409 | #[cfg(test)]
|
3224 3410 | mod simple_scalar_properties_test {
|
3225 3411 |
|
3226 3412 | /// Supports handling NaN float values.
|
3227 3413 | /// Test ID: AwsJson11SupportsNaNFloatInputs
|
3228 3414 | #[::tokio::test]
|
3229 3415 | #[::tracing_test::traced_test]
|
3230 3416 | async fn aws_json11_supports_na_n_float_inputs_request() {
|
3231 3417 | #[allow(unused_mut)]
|
3232 - | let mut http_request = http::Request::builder()
|
3418 + | let mut http_request = ::http_1x::Request::builder()
|
3233 3419 | .uri("/")
|
3234 3420 | .method("POST")
|
3235 3421 | .header("Content-Type", "application/x-amz-json-1.1")
|
3236 3422 | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
3237 - | .body(::aws_smithy_http_server::body::Body::from(
|
3238 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3239 - | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}".as_bytes(),
|
3423 + | .body(::aws_smithy_http_server::body::boxed(
|
3424 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
3425 + | &::aws_smithy_protocol_test::decode_body_data(
|
3426 + | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}"
|
3427 + | .as_bytes(),
|
3240 3428 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3429 + | ),
|
3241 3430 | )),
|
3242 3431 | ))
|
3243 3432 | .unwrap();
|
3244 3433 | #[allow(unused_mut)]
|
3245 3434 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3246 3435 | let config = crate::service::JsonProtocolConfig::builder().build();
|
3247 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3436 + | let service = crate::service::JsonProtocol::builder::<
|
3437 + | ::aws_smithy_http_server::body::BoxBody,
|
3438 + | _,
|
3439 + | _,
|
3440 + | _,
|
3441 + | >(config)
|
3248 3442 | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3249 3443 | let sender = sender.clone();
|
3250 3444 | async move {
|
3251 - | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
3252 - | let expected =
|
3253 - | crate::input::SimpleScalarPropertiesInput {
|
3254 - | float_value:
|
3255 - | ::std::option::Option::Some(
|
3256 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number")
|
3445 + | let result = {
|
3446 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3447 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
3448 + | float_value: ::std::option::Option::Some(
|
3449 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3450 + | "NaN",
|
3257 3451 | )
|
3258 - | ,
|
3259 - | double_value:
|
3260 - | ::std::option::Option::Some(
|
3261 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number")
|
3452 + | .expect("invalid string for number"),
|
3453 + | ),
|
3454 + | double_value: ::std::option::Option::Some(
|
3455 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3456 + | "NaN",
|
3262 3457 | )
|
3263 - | ,
|
3264 - | }
|
3265 - | ;
|
3266 - | assert!(input.float_value.float_equals(&expected.float_value),
|
3267 - | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
3268 - | assert!(input.double_value.float_equals(&expected.double_value),
|
3269 - | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
3270 - | let output =
|
3271 - | crate::output::SimpleScalarPropertiesOutput {
|
3272 - | float_value:
|
3273 - | ::std::option::Option::None
|
3274 - | ,
|
3275 - | double_value:
|
3276 - | ::std::option::Option::None
|
3277 - | ,
|
3278 - | }
|
3279 - | ;
|
3280 - | output };
|
3458 + | .expect("invalid string for number"),
|
3459 + | ),
|
3460 + | };
|
3461 + | assert!(
|
3462 + | input.float_value.float_equals(&expected.float_value),
|
3463 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3464 + | expected.float_value,
|
3465 + | input.float_value
|
3466 + | );
|
3467 + | assert!(
|
3468 + | input.double_value.float_equals(&expected.double_value),
|
3469 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3470 + | expected.double_value,
|
3471 + | input.double_value
|
3472 + | );
|
3473 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
3474 + | float_value: ::std::option::Option::None,
|
3475 + | double_value: ::std::option::Option::None,
|
3476 + | };
|
3477 + | output
|
3478 + | };
|
3281 3479 | sender.send(()).await.expect("receiver dropped early");
|
3282 3480 | result
|
3283 3481 | }
|
3284 3482 | })
|
3285 3483 | .build_unchecked();
|
3286 3484 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3287 3485 | .await
|
3288 3486 | .expect("unable to make an HTTP request");
|
3289 3487 | assert!(
|
3290 3488 | receiver.recv().await.is_some(),
|
3291 3489 | "we expected operation handler to be invoked but it was not entered"
|
3292 3490 | );
|
3293 3491 | }
|
3294 3492 |
|
3295 3493 | /// Supports handling Infinity float values.
|
3296 3494 | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
3297 3495 | #[::tokio::test]
|
3298 3496 | #[::tracing_test::traced_test]
|
3299 3497 | async fn aws_json11_supports_infinity_float_inputs_request() {
|
3300 3498 | #[allow(unused_mut)]
|
3301 - | let mut http_request = http::Request::builder()
|
3499 + | let mut http_request = ::http_1x::Request::builder()
|
3302 3500 | .uri("/")
|
3303 3501 | .method("POST")
|
3304 3502 | .header("Content-Type", "application/x-amz-json-1.1")
|
3305 3503 | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
3306 - | .body(::aws_smithy_http_server::body::Body::from(
|
3307 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3308 - | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}"
|
3309 - | .as_bytes(),
|
3310 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3311 - | )),
|
3312 - | ))
|
3313 - | .unwrap();
|
3504 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
3505 + | ::bytes::Bytes::copy_from_slice(
|
3506 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3507 + | )
|
3508 + | ))).unwrap();
|
3314 3509 | #[allow(unused_mut)]
|
3315 3510 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3316 3511 | let config = crate::service::JsonProtocolConfig::builder().build();
|
3317 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3512 + | let service = crate::service::JsonProtocol::builder::<
|
3513 + | ::aws_smithy_http_server::body::BoxBody,
|
3514 + | _,
|
3515 + | _,
|
3516 + | _,
|
3517 + | >(config)
|
3318 3518 | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3319 3519 | let sender = sender.clone();
|
3320 3520 | async move {
|
3321 - | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
3322 - | let expected =
|
3323 - | crate::input::SimpleScalarPropertiesInput {
|
3324 - | float_value:
|
3325 - | ::std::option::Option::Some(
|
3326 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number")
|
3521 + | let result = {
|
3522 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3523 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
3524 + | float_value: ::std::option::Option::Some(
|
3525 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3526 + | "Infinity",
|
3327 3527 | )
|
3328 - | ,
|
3329 - | double_value:
|
3330 - | ::std::option::Option::Some(
|
3331 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number")
|
3528 + | .expect("invalid string for number"),
|
3529 + | ),
|
3530 + | double_value: ::std::option::Option::Some(
|
3531 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3532 + | "Infinity",
|
3332 3533 | )
|
3333 - | ,
|
3334 - | }
|
3335 - | ;
|
3336 - | assert!(input.float_value.float_equals(&expected.float_value),
|
3337 - | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
3338 - | assert!(input.double_value.float_equals(&expected.double_value),
|
3339 - | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
3340 - | let output =
|
3341 - | crate::output::SimpleScalarPropertiesOutput {
|
3342 - | float_value:
|
3343 - | ::std::option::Option::None
|
3344 - | ,
|
3345 - | double_value:
|
3346 - | ::std::option::Option::None
|
3347 - | ,
|
3348 - | }
|
3349 - | ;
|
3350 - | output };
|
3534 + | .expect("invalid string for number"),
|
3535 + | ),
|
3536 + | };
|
3537 + | assert!(
|
3538 + | input.float_value.float_equals(&expected.float_value),
|
3539 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3540 + | expected.float_value,
|
3541 + | input.float_value
|
3542 + | );
|
3543 + | assert!(
|
3544 + | input.double_value.float_equals(&expected.double_value),
|
3545 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3546 + | expected.double_value,
|
3547 + | input.double_value
|
3548 + | );
|
3549 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
3550 + | float_value: ::std::option::Option::None,
|
3551 + | double_value: ::std::option::Option::None,
|
3552 + | };
|
3553 + | output
|
3554 + | };
|
3351 3555 | sender.send(()).await.expect("receiver dropped early");
|
3352 3556 | result
|
3353 3557 | }
|
3354 3558 | })
|
3355 3559 | .build_unchecked();
|
3356 3560 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3357 3561 | .await
|
3358 3562 | .expect("unable to make an HTTP request");
|
3359 3563 | assert!(
|
3360 3564 | receiver.recv().await.is_some(),
|
3361 3565 | "we expected operation handler to be invoked but it was not entered"
|
3362 3566 | );
|
3363 3567 | }
|
3364 3568 |
|
3365 3569 | /// Supports handling -Infinity float values.
|
3366 3570 | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
3367 3571 | #[::tokio::test]
|
3368 3572 | #[::tracing_test::traced_test]
|
3369 3573 | async fn aws_json11_supports_negative_infinity_float_inputs_request() {
|
3370 3574 | #[allow(unused_mut)]
|
3371 - | let mut http_request = http::Request::builder()
|
3575 + | let mut http_request = ::http_1x::Request::builder()
|
3372 3576 | .uri("/")
|
3373 3577 | .method("POST")
|
3374 3578 | .header("Content-Type", "application/x-amz-json-1.1")
|
3375 3579 | .header("X-Amz-Target", "JsonProtocol.SimpleScalarProperties")
|
3376 - | .body(::aws_smithy_http_server::body::Body::from(
|
3377 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
3378 - | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}"
|
3379 - | .as_bytes(),
|
3380 - | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3381 - | )),
|
3382 - | ))
|
3383 - | .unwrap();
|
3580 + | .body(::aws_smithy_http_server::body::boxed(::http_body_util::Full::new(
|
3581 + | ::bytes::Bytes::copy_from_slice(
|
3582 + | &::aws_smithy_protocol_test::decode_body_data("{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}".as_bytes(), ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
3583 + | )
|
3584 + | ))).unwrap();
|
3384 3585 | #[allow(unused_mut)]
|
3385 3586 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
3386 3587 | let config = crate::service::JsonProtocolConfig::builder().build();
|
3387 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
3588 + | let service = crate::service::JsonProtocol::builder::<
|
3589 + | ::aws_smithy_http_server::body::BoxBody,
|
3590 + | _,
|
3591 + | _,
|
3592 + | _,
|
3593 + | >(config)
|
3388 3594 | .simple_scalar_properties(move |input: crate::input::SimpleScalarPropertiesInput| {
|
3389 3595 | let sender = sender.clone();
|
3390 3596 | async move {
|
3391 - | let result = { use ::aws_smithy_protocol_test::FloatEquals;
|
3392 - | let expected =
|
3393 - | crate::input::SimpleScalarPropertiesInput {
|
3394 - | float_value:
|
3395 - | ::std::option::Option::Some(
|
3396 - | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number")
|
3597 + | let result = {
|
3598 + | use ::aws_smithy_protocol_test::FloatEquals;
|
3599 + | let expected = crate::input::SimpleScalarPropertiesInput {
|
3600 + | float_value: ::std::option::Option::Some(
|
3601 + | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3602 + | "-Infinity",
|
3397 3603 | )
|
3398 - | ,
|
3399 - | double_value:
|
3400 - | ::std::option::Option::Some(
|
3401 - | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number")
|
3604 + | .expect("invalid string for number"),
|
3605 + | ),
|
3606 + | double_value: ::std::option::Option::Some(
|
3607 + | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive(
|
3608 + | "-Infinity",
|
3402 3609 | )
|
3403 - | ,
|
3404 - | }
|
3405 - | ;
|
3406 - | assert!(input.float_value.float_equals(&expected.float_value),
|
3407 - | "Unexpected value for `float_value` {:?} vs. {:?}", expected.float_value, input.float_value);
|
3408 - | assert!(input.double_value.float_equals(&expected.double_value),
|
3409 - | "Unexpected value for `double_value` {:?} vs. {:?}", expected.double_value, input.double_value);
|
3410 - | let output =
|
3411 - | crate::output::SimpleScalarPropertiesOutput {
|
3412 - | float_value:
|
3413 - | ::std::option::Option::None
|
3414 - | ,
|
3415 - | double_value:
|
3416 - | ::std::option::Option::None
|
3417 - | ,
|
3418 - | }
|
3419 - | ;
|
3420 - | output };
|
3610 + | .expect("invalid string for number"),
|
3611 + | ),
|
3612 + | };
|
3613 + | assert!(
|
3614 + | input.float_value.float_equals(&expected.float_value),
|
3615 + | "Unexpected value for `float_value` {:?} vs. {:?}",
|
3616 + | expected.float_value,
|
3617 + | input.float_value
|
3618 + | );
|
3619 + | assert!(
|
3620 + | input.double_value.float_equals(&expected.double_value),
|
3621 + | "Unexpected value for `double_value` {:?} vs. {:?}",
|
3622 + | expected.double_value,
|
3623 + | input.double_value
|
3624 + | );
|
3625 + | let output = crate::output::SimpleScalarPropertiesOutput {
|
3626 + | float_value: ::std::option::Option::None,
|
3627 + | double_value: ::std::option::Option::None,
|
3628 + | };
|
3629 + | output
|
3630 + | };
|
3421 3631 | sender.send(()).await.expect("receiver dropped early");
|
3422 3632 | result
|
3423 3633 | }
|
3424 3634 | })
|
3425 3635 | .build_unchecked();
|
3426 3636 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
3427 3637 | .await
|
3428 3638 | .expect("unable to make an HTTP request");
|
3429 3639 | assert!(
|
3430 3640 | receiver.recv().await.is_some(),
|
3431 3641 | "we expected operation handler to be invoked but it was not entered"
|
3432 3642 | );
|
3433 3643 | }
|
3434 3644 |
|
3435 3645 | /// Supports handling NaN float values.
|
3436 3646 | /// Test ID: AwsJson11SupportsNaNFloatInputs
|
3437 3647 | #[::tokio::test]
|
3438 3648 | #[::tracing_test::traced_test]
|
3439 3649 | async fn aws_json11_supports_na_n_float_inputs_response() {
|
3440 3650 | let output = crate::output::SimpleScalarPropertiesOutput {
|
3441 3651 | float_value: ::std::option::Option::Some(
|
3442 3652 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
3443 3653 | .expect("invalid string for number"),
|
3444 3654 | ),
|
3445 3655 | double_value: ::std::option::Option::Some(
|
3446 3656 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN")
|
3447 3657 | .expect("invalid string for number"),
|
3448 3658 | ),
|
3449 3659 | };
|
3450 3660 | use ::aws_smithy_http_server::response::IntoResponse;
|
3451 3661 | let http_response = output.into_response();
|
3452 3662 | ::pretty_assertions::assert_eq!(
|
3453 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3663 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3454 3664 | http_response.status()
|
3455 3665 | );
|
3456 3666 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
3457 3667 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3458 3668 | http_response.headers(),
|
3459 3669 | expected_headers,
|
3460 3670 | ));
|
3461 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3671 + | use ::http_body_util::BodyExt;
|
3672 + | let body = http_response
|
3673 + | .into_body()
|
3674 + | .collect()
|
3462 3675 | .await
|
3463 - | .expect("unable to extract body to bytes");
|
3676 + | .expect("unable to collect body")
|
3677 + | .to_bytes();
|
3464 3678 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3465 3679 | &body,
|
3466 3680 | "{\n \"floatValue\": \"NaN\",\n \"doubleValue\": \"NaN\"\n}",
|
3467 3681 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3468 3682 | ));
|
3469 3683 | }
|
3470 3684 |
|
3471 3685 | /// Supports handling Infinity float values.
|
3472 3686 | /// Test ID: AwsJson11SupportsInfinityFloatInputs
|
3473 3687 | #[::tokio::test]
|
3474 3688 | #[::tracing_test::traced_test]
|
3475 3689 | async fn aws_json11_supports_infinity_float_inputs_response() {
|
3476 3690 | let output = crate::output::SimpleScalarPropertiesOutput {
|
3477 3691 | float_value: ::std::option::Option::Some(
|
3478 3692 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
3479 3693 | .expect("invalid string for number"),
|
3480 3694 | ),
|
3481 3695 | double_value: ::std::option::Option::Some(
|
3482 3696 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity")
|
3483 3697 | .expect("invalid string for number"),
|
3484 3698 | ),
|
3485 3699 | };
|
3486 3700 | use ::aws_smithy_http_server::response::IntoResponse;
|
3487 3701 | let http_response = output.into_response();
|
3488 3702 | ::pretty_assertions::assert_eq!(
|
3489 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3703 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3490 3704 | http_response.status()
|
3491 3705 | );
|
3492 3706 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
3493 3707 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3494 3708 | http_response.headers(),
|
3495 3709 | expected_headers,
|
3496 3710 | ));
|
3497 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3711 + | use ::http_body_util::BodyExt;
|
3712 + | let body = http_response
|
3713 + | .into_body()
|
3714 + | .collect()
|
3498 3715 | .await
|
3499 - | .expect("unable to extract body to bytes");
|
3716 + | .expect("unable to collect body")
|
3717 + | .to_bytes();
|
3500 3718 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3501 3719 | &body,
|
3502 3720 | "{\n \"floatValue\": \"Infinity\",\n \"doubleValue\": \"Infinity\"\n}",
|
3503 3721 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3504 3722 | ));
|
3505 3723 | }
|
3506 3724 |
|
3507 3725 | /// Supports handling -Infinity float values.
|
3508 3726 | /// Test ID: AwsJson11SupportsNegativeInfinityFloatInputs
|
3509 3727 | #[::tokio::test]
|
3510 3728 | #[::tracing_test::traced_test]
|
3511 3729 | async fn aws_json11_supports_negative_infinity_float_inputs_response() {
|
3512 3730 | let output = crate::output::SimpleScalarPropertiesOutput {
|
3513 3731 | float_value: ::std::option::Option::Some(
|
3514 3732 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
3515 3733 | .expect("invalid string for number"),
|
3516 3734 | ),
|
3517 3735 | double_value: ::std::option::Option::Some(
|
3518 3736 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity")
|
3519 3737 | .expect("invalid string for number"),
|
3520 3738 | ),
|
3521 3739 | };
|
3522 3740 | use ::aws_smithy_http_server::response::IntoResponse;
|
3523 3741 | let http_response = output.into_response();
|
3524 3742 | ::pretty_assertions::assert_eq!(
|
3525 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3743 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
3526 3744 | http_response.status()
|
3527 3745 | );
|
3528 3746 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
3529 3747 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
3530 3748 | http_response.headers(),
|
3531 3749 | expected_headers,
|
3532 3750 | ));
|
3533 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
3751 + | use ::http_body_util::BodyExt;
|
3752 + | let body = http_response
|
3753 + | .into_body()
|
3754 + | .collect()
|
3534 3755 | .await
|
3535 - | .expect("unable to extract body to bytes");
|
3756 + | .expect("unable to collect body")
|
3757 + | .to_bytes();
|
3536 3758 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
3537 3759 | &body,
|
3538 3760 | "{\n \"floatValue\": \"-Infinity\",\n \"doubleValue\": \"-Infinity\"\n}",
|
3539 3761 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
3540 3762 | ));
|
3541 3763 | }
|
3542 3764 | }
|
3543 3765 |
|
3544 3766 | ::pin_project_lite::pin_project! {
|
3545 3767 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
3546 3768 | /// [`KitchenSinkOperationInput`](crate::input::KitchenSinkOperationInput) using modelled bindings.
|
3547 3769 | pub struct KitchenSinkOperationInputFuture {
|
3548 3770 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::KitchenSinkOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
3549 3771 | }
|
3550 3772 | }
|
3551 3773 |
|
3552 3774 | impl std::future::Future for KitchenSinkOperationInputFuture {
|
3553 3775 | type Output = Result<
|
3554 3776 | crate::input::KitchenSinkOperationInput,
|
3555 3777 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
3556 3778 | >;
|
3557 3779 |
|
3558 3780 | fn poll(
|
3559 3781 | self: std::pin::Pin<&mut Self>,
|
3560 3782 | cx: &mut std::task::Context<'_>,
|
3561 3783 | ) -> std::task::Poll<Self::Output> {
|
3562 3784 | let this = self.project();
|
3563 3785 | this.inner.as_mut().poll(cx)
|
3564 3786 | }
|
3565 3787 | }
|
3566 3788 |
|
3567 3789 | impl<B>
|
3568 3790 | ::aws_smithy_http_server::request::FromRequest<
|
3569 3791 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
3570 3792 | B,
|
3571 3793 | > for crate::input::KitchenSinkOperationInput
|
3572 3794 | where
|
3573 3795 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
3574 3796 | B: 'static,
|
3575 3797 |
|
3576 3798 | B::Data: Send,
|
3577 3799 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
3578 3800 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
3579 3801 | {
|
3580 3802 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
3581 3803 | type Future = KitchenSinkOperationInputFuture;
|
3582 3804 |
|
3583 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
3805 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
3584 3806 | let fut = async move {
|
3585 3807 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
3586 3808 | request.headers(),
|
3587 3809 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
3588 3810 | ) {
|
3589 3811 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
3590 3812 | }
|
3591 3813 | crate::protocol_serde::shape_kitchen_sink_operation::de_kitchen_sink_operation_http_request(request)
|
3592 3814 | .await
|
3593 3815 | };
|
10570 10942 | recursive_struct: ::std::option::Option::None,
|
10571 10943 | simple_struct: ::std::option::Option::None,
|
10572 10944 | string: ::std::option::Option::None,
|
10573 10945 | struct_with_json_name: ::std::option::Option::None,
|
10574 10946 | timestamp: ::std::option::Option::None,
|
10575 10947 | unix_timestamp: ::std::option::Option::None,
|
10576 10948 | };
|
10577 10949 | use ::aws_smithy_http_server::response::IntoResponse;
|
10578 10950 | let http_response = output.into_response();
|
10579 10951 | ::pretty_assertions::assert_eq!(
|
10580 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10952 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10581 10953 | http_response.status()
|
10582 10954 | );
|
10583 10955 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10584 10956 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10585 10957 | http_response.headers(),
|
10586 10958 | expected_headers,
|
10587 10959 | ));
|
10588 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
10960 + | use ::http_body_util::BodyExt;
|
10961 + | let body = http_response
|
10962 + | .into_body()
|
10963 + | .collect()
|
10589 10964 | .await
|
10590 - | .expect("unable to extract body to bytes");
|
10965 + | .expect("unable to collect body")
|
10966 + | .to_bytes();
|
10591 10967 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10592 10968 | &body,
|
10593 10969 | "{}",
|
10594 10970 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10595 10971 | ));
|
10596 10972 | }
|
10597 10973 |
|
10598 10974 | /// Parses string shapes
|
10599 10975 | /// Test ID: parses_string_shapes
|
10600 10976 | #[::tokio::test]
|
10601 10977 | #[::tracing_test::traced_test]
|
10602 10978 | async fn parses_string_shapes_response() {
|
10603 10979 | let output = crate::output::KitchenSinkOperationOutput {
|
10604 10980 | string: ::std::option::Option::Some("string-value".to_owned()),
|
10605 10981 | blob: ::std::option::Option::None,
|
10606 10982 | boolean: ::std::option::Option::None,
|
10607 10983 | double: ::std::option::Option::None,
|
10608 10984 | empty_struct: ::std::option::Option::None,
|
10609 10985 | float: ::std::option::Option::None,
|
10610 10986 | httpdate_timestamp: ::std::option::Option::None,
|
10611 10987 | integer: ::std::option::Option::None,
|
10612 10988 | iso8601_timestamp: ::std::option::Option::None,
|
10613 10989 | json_value: ::std::option::Option::None,
|
10614 10990 | list_of_lists: ::std::option::Option::None,
|
10615 10991 | list_of_maps_of_strings: ::std::option::Option::None,
|
10616 10992 | list_of_strings: ::std::option::Option::None,
|
10617 10993 | list_of_structs: ::std::option::Option::None,
|
10618 10994 | long: ::std::option::Option::None,
|
10619 10995 | map_of_lists_of_strings: ::std::option::Option::None,
|
10620 10996 | map_of_maps: ::std::option::Option::None,
|
10621 10997 | map_of_strings: ::std::option::Option::None,
|
10622 10998 | map_of_structs: ::std::option::Option::None,
|
10623 10999 | recursive_list: ::std::option::Option::None,
|
10624 11000 | recursive_map: ::std::option::Option::None,
|
10625 11001 | recursive_struct: ::std::option::Option::None,
|
10626 11002 | simple_struct: ::std::option::Option::None,
|
10627 11003 | struct_with_json_name: ::std::option::Option::None,
|
10628 11004 | timestamp: ::std::option::Option::None,
|
10629 11005 | unix_timestamp: ::std::option::Option::None,
|
10630 11006 | };
|
10631 11007 | use ::aws_smithy_http_server::response::IntoResponse;
|
10632 11008 | let http_response = output.into_response();
|
10633 11009 | ::pretty_assertions::assert_eq!(
|
10634 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11010 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10635 11011 | http_response.status()
|
10636 11012 | );
|
10637 11013 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10638 11014 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10639 11015 | http_response.headers(),
|
10640 11016 | expected_headers,
|
10641 11017 | ));
|
10642 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11018 + | use ::http_body_util::BodyExt;
|
11019 + | let body = http_response
|
11020 + | .into_body()
|
11021 + | .collect()
|
10643 11022 | .await
|
10644 - | .expect("unable to extract body to bytes");
|
11023 + | .expect("unable to collect body")
|
11024 + | .to_bytes();
|
10645 11025 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10646 11026 | &body,
|
10647 11027 | "{\"String\":\"string-value\"}",
|
10648 11028 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10649 11029 | ));
|
10650 11030 | }
|
10651 11031 |
|
10652 11032 | /// Parses integer shapes
|
10653 11033 | /// Test ID: parses_integer_shapes
|
10654 11034 | #[::tokio::test]
|
10655 11035 | #[::tracing_test::traced_test]
|
10656 11036 | async fn parses_integer_shapes_response() {
|
10657 11037 | let output = crate::output::KitchenSinkOperationOutput {
|
10658 11038 | integer: ::std::option::Option::Some(1234),
|
10659 11039 | blob: ::std::option::Option::None,
|
10660 11040 | boolean: ::std::option::Option::None,
|
10661 11041 | double: ::std::option::Option::None,
|
10662 11042 | empty_struct: ::std::option::Option::None,
|
10663 11043 | float: ::std::option::Option::None,
|
10664 11044 | httpdate_timestamp: ::std::option::Option::None,
|
10665 11045 | iso8601_timestamp: ::std::option::Option::None,
|
10666 11046 | json_value: ::std::option::Option::None,
|
10667 11047 | list_of_lists: ::std::option::Option::None,
|
10668 11048 | list_of_maps_of_strings: ::std::option::Option::None,
|
10669 11049 | list_of_strings: ::std::option::Option::None,
|
10670 11050 | list_of_structs: ::std::option::Option::None,
|
10671 11051 | long: ::std::option::Option::None,
|
10672 11052 | map_of_lists_of_strings: ::std::option::Option::None,
|
10673 11053 | map_of_maps: ::std::option::Option::None,
|
10674 11054 | map_of_strings: ::std::option::Option::None,
|
10675 11055 | map_of_structs: ::std::option::Option::None,
|
10676 11056 | recursive_list: ::std::option::Option::None,
|
10677 11057 | recursive_map: ::std::option::Option::None,
|
10678 11058 | recursive_struct: ::std::option::Option::None,
|
10679 11059 | simple_struct: ::std::option::Option::None,
|
10680 11060 | string: ::std::option::Option::None,
|
10681 11061 | struct_with_json_name: ::std::option::Option::None,
|
10682 11062 | timestamp: ::std::option::Option::None,
|
10683 11063 | unix_timestamp: ::std::option::Option::None,
|
10684 11064 | };
|
10685 11065 | use ::aws_smithy_http_server::response::IntoResponse;
|
10686 11066 | let http_response = output.into_response();
|
10687 11067 | ::pretty_assertions::assert_eq!(
|
10688 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11068 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10689 11069 | http_response.status()
|
10690 11070 | );
|
10691 11071 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10692 11072 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10693 11073 | http_response.headers(),
|
10694 11074 | expected_headers,
|
10695 11075 | ));
|
10696 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11076 + | use ::http_body_util::BodyExt;
|
11077 + | let body = http_response
|
11078 + | .into_body()
|
11079 + | .collect()
|
10697 11080 | .await
|
10698 - | .expect("unable to extract body to bytes");
|
11081 + | .expect("unable to collect body")
|
11082 + | .to_bytes();
|
10699 11083 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10700 11084 | &body,
|
10701 11085 | "{\"Integer\":1234}",
|
10702 11086 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10703 11087 | ));
|
10704 11088 | }
|
10705 11089 |
|
10706 11090 | /// Parses long shapes
|
10707 11091 | /// Test ID: parses_long_shapes
|
10708 11092 | #[::tokio::test]
|
10709 11093 | #[::tracing_test::traced_test]
|
10710 11094 | async fn parses_long_shapes_response() {
|
10711 11095 | let output = crate::output::KitchenSinkOperationOutput {
|
10712 11096 | long: ::std::option::Option::Some(1234567890123456789),
|
10713 11097 | blob: ::std::option::Option::None,
|
10714 11098 | boolean: ::std::option::Option::None,
|
10715 11099 | double: ::std::option::Option::None,
|
10716 11100 | empty_struct: ::std::option::Option::None,
|
10717 11101 | float: ::std::option::Option::None,
|
10718 11102 | httpdate_timestamp: ::std::option::Option::None,
|
10719 11103 | integer: ::std::option::Option::None,
|
10720 11104 | iso8601_timestamp: ::std::option::Option::None,
|
10721 11105 | json_value: ::std::option::Option::None,
|
10722 11106 | list_of_lists: ::std::option::Option::None,
|
10723 11107 | list_of_maps_of_strings: ::std::option::Option::None,
|
10724 11108 | list_of_strings: ::std::option::Option::None,
|
10725 11109 | list_of_structs: ::std::option::Option::None,
|
10726 11110 | map_of_lists_of_strings: ::std::option::Option::None,
|
10727 11111 | map_of_maps: ::std::option::Option::None,
|
10728 11112 | map_of_strings: ::std::option::Option::None,
|
10729 11113 | map_of_structs: ::std::option::Option::None,
|
10730 11114 | recursive_list: ::std::option::Option::None,
|
10731 11115 | recursive_map: ::std::option::Option::None,
|
10732 11116 | recursive_struct: ::std::option::Option::None,
|
10733 11117 | simple_struct: ::std::option::Option::None,
|
10734 11118 | string: ::std::option::Option::None,
|
10735 11119 | struct_with_json_name: ::std::option::Option::None,
|
10736 11120 | timestamp: ::std::option::Option::None,
|
10737 11121 | unix_timestamp: ::std::option::Option::None,
|
10738 11122 | };
|
10739 11123 | use ::aws_smithy_http_server::response::IntoResponse;
|
10740 11124 | let http_response = output.into_response();
|
10741 11125 | ::pretty_assertions::assert_eq!(
|
10742 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11126 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10743 11127 | http_response.status()
|
10744 11128 | );
|
10745 11129 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10746 11130 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10747 11131 | http_response.headers(),
|
10748 11132 | expected_headers,
|
10749 11133 | ));
|
10750 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11134 + | use ::http_body_util::BodyExt;
|
11135 + | let body = http_response
|
11136 + | .into_body()
|
11137 + | .collect()
|
10751 11138 | .await
|
10752 - | .expect("unable to extract body to bytes");
|
11139 + | .expect("unable to collect body")
|
11140 + | .to_bytes();
|
10753 11141 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10754 11142 | &body,
|
10755 11143 | "{\"Long\":1234567890123456789}",
|
10756 11144 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10757 11145 | ));
|
10758 11146 | }
|
10759 11147 |
|
10760 11148 | /// Parses float shapes
|
10761 11149 | /// Test ID: parses_float_shapes
|
10762 11150 | #[::tokio::test]
|
10763 11151 | #[::tracing_test::traced_test]
|
10764 11152 | async fn parses_float_shapes_response() {
|
10765 11153 | let output = crate::output::KitchenSinkOperationOutput {
|
10766 11154 | float: ::std::option::Option::Some(1234.5_f32),
|
10767 11155 | blob: ::std::option::Option::None,
|
10768 11156 | boolean: ::std::option::Option::None,
|
10769 11157 | double: ::std::option::Option::None,
|
10770 11158 | empty_struct: ::std::option::Option::None,
|
10771 11159 | httpdate_timestamp: ::std::option::Option::None,
|
10772 11160 | integer: ::std::option::Option::None,
|
10773 11161 | iso8601_timestamp: ::std::option::Option::None,
|
10774 11162 | json_value: ::std::option::Option::None,
|
10775 11163 | list_of_lists: ::std::option::Option::None,
|
10776 11164 | list_of_maps_of_strings: ::std::option::Option::None,
|
10777 11165 | list_of_strings: ::std::option::Option::None,
|
10778 11166 | list_of_structs: ::std::option::Option::None,
|
10779 11167 | long: ::std::option::Option::None,
|
10780 11168 | map_of_lists_of_strings: ::std::option::Option::None,
|
10781 11169 | map_of_maps: ::std::option::Option::None,
|
10782 11170 | map_of_strings: ::std::option::Option::None,
|
10783 11171 | map_of_structs: ::std::option::Option::None,
|
10784 11172 | recursive_list: ::std::option::Option::None,
|
10785 11173 | recursive_map: ::std::option::Option::None,
|
10786 11174 | recursive_struct: ::std::option::Option::None,
|
10787 11175 | simple_struct: ::std::option::Option::None,
|
10788 11176 | string: ::std::option::Option::None,
|
10789 11177 | struct_with_json_name: ::std::option::Option::None,
|
10790 11178 | timestamp: ::std::option::Option::None,
|
10791 11179 | unix_timestamp: ::std::option::Option::None,
|
10792 11180 | };
|
10793 11181 | use ::aws_smithy_http_server::response::IntoResponse;
|
10794 11182 | let http_response = output.into_response();
|
10795 11183 | ::pretty_assertions::assert_eq!(
|
10796 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11184 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10797 11185 | http_response.status()
|
10798 11186 | );
|
10799 11187 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10800 11188 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10801 11189 | http_response.headers(),
|
10802 11190 | expected_headers,
|
10803 11191 | ));
|
10804 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11192 + | use ::http_body_util::BodyExt;
|
11193 + | let body = http_response
|
11194 + | .into_body()
|
11195 + | .collect()
|
10805 11196 | .await
|
10806 - | .expect("unable to extract body to bytes");
|
11197 + | .expect("unable to collect body")
|
11198 + | .to_bytes();
|
10807 11199 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10808 11200 | &body,
|
10809 11201 | "{\"Float\":1234.5}",
|
10810 11202 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10811 11203 | ));
|
10812 11204 | }
|
10813 11205 |
|
10814 11206 | /// Parses double shapes
|
10815 11207 | /// Test ID: parses_double_shapes
|
10816 11208 | #[::tokio::test]
|
10817 11209 | #[::tracing_test::traced_test]
|
10818 11210 | async fn parses_double_shapes_response() {
|
10819 11211 | let output = crate::output::KitchenSinkOperationOutput {
|
10820 11212 | double: ::std::option::Option::Some(1.2345678912345679E8_f64),
|
10821 11213 | blob: ::std::option::Option::None,
|
10822 11214 | boolean: ::std::option::Option::None,
|
10823 11215 | empty_struct: ::std::option::Option::None,
|
10824 11216 | float: ::std::option::Option::None,
|
10825 11217 | httpdate_timestamp: ::std::option::Option::None,
|
10826 11218 | integer: ::std::option::Option::None,
|
10827 11219 | iso8601_timestamp: ::std::option::Option::None,
|
10828 11220 | json_value: ::std::option::Option::None,
|
10829 11221 | list_of_lists: ::std::option::Option::None,
|
10830 11222 | list_of_maps_of_strings: ::std::option::Option::None,
|
10831 11223 | list_of_strings: ::std::option::Option::None,
|
10832 11224 | list_of_structs: ::std::option::Option::None,
|
10833 11225 | long: ::std::option::Option::None,
|
10834 11226 | map_of_lists_of_strings: ::std::option::Option::None,
|
10835 11227 | map_of_maps: ::std::option::Option::None,
|
10836 11228 | map_of_strings: ::std::option::Option::None,
|
10837 11229 | map_of_structs: ::std::option::Option::None,
|
10838 11230 | recursive_list: ::std::option::Option::None,
|
10839 11231 | recursive_map: ::std::option::Option::None,
|
10840 11232 | recursive_struct: ::std::option::Option::None,
|
10841 11233 | simple_struct: ::std::option::Option::None,
|
10842 11234 | string: ::std::option::Option::None,
|
10843 11235 | struct_with_json_name: ::std::option::Option::None,
|
10844 11236 | timestamp: ::std::option::Option::None,
|
10845 11237 | unix_timestamp: ::std::option::Option::None,
|
10846 11238 | };
|
10847 11239 | use ::aws_smithy_http_server::response::IntoResponse;
|
10848 11240 | let http_response = output.into_response();
|
10849 11241 | ::pretty_assertions::assert_eq!(
|
10850 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11242 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10851 11243 | http_response.status()
|
10852 11244 | );
|
10853 11245 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10854 11246 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10855 11247 | http_response.headers(),
|
10856 11248 | expected_headers,
|
10857 11249 | ));
|
10858 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11250 + | use ::http_body_util::BodyExt;
|
11251 + | let body = http_response
|
11252 + | .into_body()
|
11253 + | .collect()
|
10859 11254 | .await
|
10860 - | .expect("unable to extract body to bytes");
|
11255 + | .expect("unable to collect body")
|
11256 + | .to_bytes();
|
10861 11257 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10862 11258 | &body,
|
10863 11259 | "{\"Double\":123456789.12345679}",
|
10864 11260 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10865 11261 | ));
|
10866 11262 | }
|
10867 11263 |
|
10868 11264 | /// Parses boolean shapes (true)
|
10869 11265 | /// Test ID: parses_boolean_shapes_true
|
10870 11266 | #[::tokio::test]
|
10871 11267 | #[::tracing_test::traced_test]
|
10872 11268 | async fn parses_boolean_shapes_true_response() {
|
10873 11269 | let output = crate::output::KitchenSinkOperationOutput {
|
10874 11270 | boolean: ::std::option::Option::Some(true),
|
10875 11271 | blob: ::std::option::Option::None,
|
10876 11272 | double: ::std::option::Option::None,
|
10877 11273 | empty_struct: ::std::option::Option::None,
|
10878 11274 | float: ::std::option::Option::None,
|
10879 11275 | httpdate_timestamp: ::std::option::Option::None,
|
10880 11276 | integer: ::std::option::Option::None,
|
10881 11277 | iso8601_timestamp: ::std::option::Option::None,
|
10882 11278 | json_value: ::std::option::Option::None,
|
10883 11279 | list_of_lists: ::std::option::Option::None,
|
10884 11280 | list_of_maps_of_strings: ::std::option::Option::None,
|
10885 11281 | list_of_strings: ::std::option::Option::None,
|
10886 11282 | list_of_structs: ::std::option::Option::None,
|
10887 11283 | long: ::std::option::Option::None,
|
10888 11284 | map_of_lists_of_strings: ::std::option::Option::None,
|
10889 11285 | map_of_maps: ::std::option::Option::None,
|
10890 11286 | map_of_strings: ::std::option::Option::None,
|
10891 11287 | map_of_structs: ::std::option::Option::None,
|
10892 11288 | recursive_list: ::std::option::Option::None,
|
10893 11289 | recursive_map: ::std::option::Option::None,
|
10894 11290 | recursive_struct: ::std::option::Option::None,
|
10895 11291 | simple_struct: ::std::option::Option::None,
|
10896 11292 | string: ::std::option::Option::None,
|
10897 11293 | struct_with_json_name: ::std::option::Option::None,
|
10898 11294 | timestamp: ::std::option::Option::None,
|
10899 11295 | unix_timestamp: ::std::option::Option::None,
|
10900 11296 | };
|
10901 11297 | use ::aws_smithy_http_server::response::IntoResponse;
|
10902 11298 | let http_response = output.into_response();
|
10903 11299 | ::pretty_assertions::assert_eq!(
|
10904 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11300 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10905 11301 | http_response.status()
|
10906 11302 | );
|
10907 11303 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10908 11304 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10909 11305 | http_response.headers(),
|
10910 11306 | expected_headers,
|
10911 11307 | ));
|
10912 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11308 + | use ::http_body_util::BodyExt;
|
11309 + | let body = http_response
|
11310 + | .into_body()
|
11311 + | .collect()
|
10913 11312 | .await
|
10914 - | .expect("unable to extract body to bytes");
|
11313 + | .expect("unable to collect body")
|
11314 + | .to_bytes();
|
10915 11315 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10916 11316 | &body,
|
10917 11317 | "{\"Boolean\":true}",
|
10918 11318 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10919 11319 | ));
|
10920 11320 | }
|
10921 11321 |
|
10922 11322 | /// Parses boolean (false)
|
10923 11323 | /// Test ID: parses_boolean_false
|
10924 11324 | #[::tokio::test]
|
10925 11325 | #[::tracing_test::traced_test]
|
10926 11326 | async fn parses_boolean_false_response() {
|
10927 11327 | let output = crate::output::KitchenSinkOperationOutput {
|
10928 11328 | boolean: ::std::option::Option::Some(false),
|
10929 11329 | blob: ::std::option::Option::None,
|
10930 11330 | double: ::std::option::Option::None,
|
10931 11331 | empty_struct: ::std::option::Option::None,
|
10932 11332 | float: ::std::option::Option::None,
|
10933 11333 | httpdate_timestamp: ::std::option::Option::None,
|
10934 11334 | integer: ::std::option::Option::None,
|
10935 11335 | iso8601_timestamp: ::std::option::Option::None,
|
10936 11336 | json_value: ::std::option::Option::None,
|
10937 11337 | list_of_lists: ::std::option::Option::None,
|
10938 11338 | list_of_maps_of_strings: ::std::option::Option::None,
|
10939 11339 | list_of_strings: ::std::option::Option::None,
|
10940 11340 | list_of_structs: ::std::option::Option::None,
|
10941 11341 | long: ::std::option::Option::None,
|
10942 11342 | map_of_lists_of_strings: ::std::option::Option::None,
|
10943 11343 | map_of_maps: ::std::option::Option::None,
|
10944 11344 | map_of_strings: ::std::option::Option::None,
|
10945 11345 | map_of_structs: ::std::option::Option::None,
|
10946 11346 | recursive_list: ::std::option::Option::None,
|
10947 11347 | recursive_map: ::std::option::Option::None,
|
10948 11348 | recursive_struct: ::std::option::Option::None,
|
10949 11349 | simple_struct: ::std::option::Option::None,
|
10950 11350 | string: ::std::option::Option::None,
|
10951 11351 | struct_with_json_name: ::std::option::Option::None,
|
10952 11352 | timestamp: ::std::option::Option::None,
|
10953 11353 | unix_timestamp: ::std::option::Option::None,
|
10954 11354 | };
|
10955 11355 | use ::aws_smithy_http_server::response::IntoResponse;
|
10956 11356 | let http_response = output.into_response();
|
10957 11357 | ::pretty_assertions::assert_eq!(
|
10958 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11358 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
10959 11359 | http_response.status()
|
10960 11360 | );
|
10961 11361 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
10962 11362 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
10963 11363 | http_response.headers(),
|
10964 11364 | expected_headers,
|
10965 11365 | ));
|
10966 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11366 + | use ::http_body_util::BodyExt;
|
11367 + | let body = http_response
|
11368 + | .into_body()
|
11369 + | .collect()
|
10967 11370 | .await
|
10968 - | .expect("unable to extract body to bytes");
|
11371 + | .expect("unable to collect body")
|
11372 + | .to_bytes();
|
10969 11373 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
10970 11374 | &body,
|
10971 11375 | "{\"Boolean\":false}",
|
10972 11376 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
10973 11377 | ));
|
10974 11378 | }
|
10975 11379 |
|
10976 11380 | /// Parses blob shapes
|
10977 11381 | /// Test ID: parses_blob_shapes
|
10978 11382 | #[::tokio::test]
|
10979 11383 | #[::tracing_test::traced_test]
|
10980 11384 | async fn parses_blob_shapes_response() {
|
10981 11385 | let output = crate::output::KitchenSinkOperationOutput {
|
10982 11386 | blob: ::std::option::Option::Some(::aws_smithy_types::Blob::new("binary-value")),
|
10983 11387 | boolean: ::std::option::Option::None,
|
10984 11388 | double: ::std::option::Option::None,
|
10985 11389 | empty_struct: ::std::option::Option::None,
|
10986 11390 | float: ::std::option::Option::None,
|
10987 11391 | httpdate_timestamp: ::std::option::Option::None,
|
10988 11392 | integer: ::std::option::Option::None,
|
10989 11393 | iso8601_timestamp: ::std::option::Option::None,
|
10990 11394 | json_value: ::std::option::Option::None,
|
10991 11395 | list_of_lists: ::std::option::Option::None,
|
10992 11396 | list_of_maps_of_strings: ::std::option::Option::None,
|
10993 11397 | list_of_strings: ::std::option::Option::None,
|
10994 11398 | list_of_structs: ::std::option::Option::None,
|
10995 11399 | long: ::std::option::Option::None,
|
10996 11400 | map_of_lists_of_strings: ::std::option::Option::None,
|
10997 11401 | map_of_maps: ::std::option::Option::None,
|
10998 11402 | map_of_strings: ::std::option::Option::None,
|
10999 11403 | map_of_structs: ::std::option::Option::None,
|
11000 11404 | recursive_list: ::std::option::Option::None,
|
11001 11405 | recursive_map: ::std::option::Option::None,
|
11002 11406 | recursive_struct: ::std::option::Option::None,
|
11003 11407 | simple_struct: ::std::option::Option::None,
|
11004 11408 | string: ::std::option::Option::None,
|
11005 11409 | struct_with_json_name: ::std::option::Option::None,
|
11006 11410 | timestamp: ::std::option::Option::None,
|
11007 11411 | unix_timestamp: ::std::option::Option::None,
|
11008 11412 | };
|
11009 11413 | use ::aws_smithy_http_server::response::IntoResponse;
|
11010 11414 | let http_response = output.into_response();
|
11011 11415 | ::pretty_assertions::assert_eq!(
|
11012 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11416 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11013 11417 | http_response.status()
|
11014 11418 | );
|
11015 11419 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11016 11420 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11017 11421 | http_response.headers(),
|
11018 11422 | expected_headers,
|
11019 11423 | ));
|
11020 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11424 + | use ::http_body_util::BodyExt;
|
11425 + | let body = http_response
|
11426 + | .into_body()
|
11427 + | .collect()
|
11021 11428 | .await
|
11022 - | .expect("unable to extract body to bytes");
|
11429 + | .expect("unable to collect body")
|
11430 + | .to_bytes();
|
11023 11431 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11024 11432 | &body,
|
11025 11433 | "{\"Blob\":\"YmluYXJ5LXZhbHVl\"}",
|
11026 11434 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11027 11435 | ));
|
11028 11436 | }
|
11029 11437 |
|
11030 11438 | /// Parses timestamp shapes
|
11031 11439 | /// Test ID: parses_timestamp_shapes
|
11032 11440 | #[::tokio::test]
|
11033 11441 | #[::tracing_test::traced_test]
|
11034 11442 | async fn parses_timestamp_shapes_response() {
|
11035 11443 | let output = crate::output::KitchenSinkOperationOutput {
|
11036 11444 | timestamp: ::std::option::Option::Some(
|
11037 11445 | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
11038 11446 | ),
|
11039 11447 | blob: ::std::option::Option::None,
|
11040 11448 | boolean: ::std::option::Option::None,
|
11041 11449 | double: ::std::option::Option::None,
|
11042 11450 | empty_struct: ::std::option::Option::None,
|
11043 11451 | float: ::std::option::Option::None,
|
11044 11452 | httpdate_timestamp: ::std::option::Option::None,
|
11045 11453 | integer: ::std::option::Option::None,
|
11046 11454 | iso8601_timestamp: ::std::option::Option::None,
|
11047 11455 | json_value: ::std::option::Option::None,
|
11048 11456 | list_of_lists: ::std::option::Option::None,
|
11049 11457 | list_of_maps_of_strings: ::std::option::Option::None,
|
11050 11458 | list_of_strings: ::std::option::Option::None,
|
11051 11459 | list_of_structs: ::std::option::Option::None,
|
11052 11460 | long: ::std::option::Option::None,
|
11053 11461 | map_of_lists_of_strings: ::std::option::Option::None,
|
11054 11462 | map_of_maps: ::std::option::Option::None,
|
11055 11463 | map_of_strings: ::std::option::Option::None,
|
11056 11464 | map_of_structs: ::std::option::Option::None,
|
11057 11465 | recursive_list: ::std::option::Option::None,
|
11058 11466 | recursive_map: ::std::option::Option::None,
|
11059 11467 | recursive_struct: ::std::option::Option::None,
|
11060 11468 | simple_struct: ::std::option::Option::None,
|
11061 11469 | string: ::std::option::Option::None,
|
11062 11470 | struct_with_json_name: ::std::option::Option::None,
|
11063 11471 | unix_timestamp: ::std::option::Option::None,
|
11064 11472 | };
|
11065 11473 | use ::aws_smithy_http_server::response::IntoResponse;
|
11066 11474 | let http_response = output.into_response();
|
11067 11475 | ::pretty_assertions::assert_eq!(
|
11068 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11476 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11069 11477 | http_response.status()
|
11070 11478 | );
|
11071 11479 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11072 11480 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11073 11481 | http_response.headers(),
|
11074 11482 | expected_headers,
|
11075 11483 | ));
|
11076 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11484 + | use ::http_body_util::BodyExt;
|
11485 + | let body = http_response
|
11486 + | .into_body()
|
11487 + | .collect()
|
11077 11488 | .await
|
11078 - | .expect("unable to extract body to bytes");
|
11489 + | .expect("unable to collect body")
|
11490 + | .to_bytes();
|
11079 11491 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11080 11492 | &body,
|
11081 11493 | "{\"Timestamp\":946845296}",
|
11082 11494 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11083 11495 | ));
|
11084 11496 | }
|
11085 11497 |
|
11086 11498 | /// Parses iso8601 timestamps
|
11087 11499 | /// Test ID: parses_iso8601_timestamps
|
11088 11500 | #[::tokio::test]
|
11089 11501 | #[::tracing_test::traced_test]
|
11090 11502 | async fn parses_iso8601_timestamps_response() {
|
11091 11503 | let output = crate::output::KitchenSinkOperationOutput {
|
11092 11504 | iso8601_timestamp: ::std::option::Option::Some(
|
11093 11505 | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
11094 11506 | ),
|
11095 11507 | blob: ::std::option::Option::None,
|
11096 11508 | boolean: ::std::option::Option::None,
|
11097 11509 | double: ::std::option::Option::None,
|
11098 11510 | empty_struct: ::std::option::Option::None,
|
11099 11511 | float: ::std::option::Option::None,
|
11100 11512 | httpdate_timestamp: ::std::option::Option::None,
|
11101 11513 | integer: ::std::option::Option::None,
|
11102 11514 | json_value: ::std::option::Option::None,
|
11103 11515 | list_of_lists: ::std::option::Option::None,
|
11104 11516 | list_of_maps_of_strings: ::std::option::Option::None,
|
11105 11517 | list_of_strings: ::std::option::Option::None,
|
11106 11518 | list_of_structs: ::std::option::Option::None,
|
11107 11519 | long: ::std::option::Option::None,
|
11108 11520 | map_of_lists_of_strings: ::std::option::Option::None,
|
11109 11521 | map_of_maps: ::std::option::Option::None,
|
11110 11522 | map_of_strings: ::std::option::Option::None,
|
11111 11523 | map_of_structs: ::std::option::Option::None,
|
11112 11524 | recursive_list: ::std::option::Option::None,
|
11113 11525 | recursive_map: ::std::option::Option::None,
|
11114 11526 | recursive_struct: ::std::option::Option::None,
|
11115 11527 | simple_struct: ::std::option::Option::None,
|
11116 11528 | string: ::std::option::Option::None,
|
11117 11529 | struct_with_json_name: ::std::option::Option::None,
|
11118 11530 | timestamp: ::std::option::Option::None,
|
11119 11531 | unix_timestamp: ::std::option::Option::None,
|
11120 11532 | };
|
11121 11533 | use ::aws_smithy_http_server::response::IntoResponse;
|
11122 11534 | let http_response = output.into_response();
|
11123 11535 | ::pretty_assertions::assert_eq!(
|
11124 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11536 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11125 11537 | http_response.status()
|
11126 11538 | );
|
11127 11539 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11128 11540 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11129 11541 | http_response.headers(),
|
11130 11542 | expected_headers,
|
11131 11543 | ));
|
11132 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11544 + | use ::http_body_util::BodyExt;
|
11545 + | let body = http_response
|
11546 + | .into_body()
|
11547 + | .collect()
|
11133 11548 | .await
|
11134 - | .expect("unable to extract body to bytes");
|
11549 + | .expect("unable to collect body")
|
11550 + | .to_bytes();
|
11135 11551 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11136 11552 | &body,
|
11137 11553 | "{\"Iso8601Timestamp\":\"2000-01-02T20:34:56Z\"}",
|
11138 11554 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11139 11555 | ));
|
11140 11556 | }
|
11141 11557 |
|
11142 11558 | /// Parses httpdate timestamps
|
11143 11559 | /// Test ID: parses_httpdate_timestamps
|
11144 11560 | #[::tokio::test]
|
11145 11561 | #[::tracing_test::traced_test]
|
11146 11562 | async fn parses_httpdate_timestamps_response() {
|
11147 11563 | let output = crate::output::KitchenSinkOperationOutput {
|
11148 11564 | httpdate_timestamp: ::std::option::Option::Some(
|
11149 11565 | ::aws_smithy_types::DateTime::from_fractional_secs(946845296, 0_f64),
|
11150 11566 | ),
|
11151 11567 | blob: ::std::option::Option::None,
|
11152 11568 | boolean: ::std::option::Option::None,
|
11153 11569 | double: ::std::option::Option::None,
|
11154 11570 | empty_struct: ::std::option::Option::None,
|
11155 11571 | float: ::std::option::Option::None,
|
11156 11572 | integer: ::std::option::Option::None,
|
11157 11573 | iso8601_timestamp: ::std::option::Option::None,
|
11158 11574 | json_value: ::std::option::Option::None,
|
11159 11575 | list_of_lists: ::std::option::Option::None,
|
11160 11576 | list_of_maps_of_strings: ::std::option::Option::None,
|
11161 11577 | list_of_strings: ::std::option::Option::None,
|
11162 11578 | list_of_structs: ::std::option::Option::None,
|
11163 11579 | long: ::std::option::Option::None,
|
11164 11580 | map_of_lists_of_strings: ::std::option::Option::None,
|
11165 11581 | map_of_maps: ::std::option::Option::None,
|
11166 11582 | map_of_strings: ::std::option::Option::None,
|
11167 11583 | map_of_structs: ::std::option::Option::None,
|
11168 11584 | recursive_list: ::std::option::Option::None,
|
11169 11585 | recursive_map: ::std::option::Option::None,
|
11170 11586 | recursive_struct: ::std::option::Option::None,
|
11171 11587 | simple_struct: ::std::option::Option::None,
|
11172 11588 | string: ::std::option::Option::None,
|
11173 11589 | struct_with_json_name: ::std::option::Option::None,
|
11174 11590 | timestamp: ::std::option::Option::None,
|
11175 11591 | unix_timestamp: ::std::option::Option::None,
|
11176 11592 | };
|
11177 11593 | use ::aws_smithy_http_server::response::IntoResponse;
|
11178 11594 | let http_response = output.into_response();
|
11179 11595 | ::pretty_assertions::assert_eq!(
|
11180 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11596 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11181 11597 | http_response.status()
|
11182 11598 | );
|
11183 11599 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11184 11600 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11185 11601 | http_response.headers(),
|
11186 11602 | expected_headers,
|
11187 11603 | ));
|
11188 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11604 + | use ::http_body_util::BodyExt;
|
11605 + | let body = http_response
|
11606 + | .into_body()
|
11607 + | .collect()
|
11189 11608 | .await
|
11190 - | .expect("unable to extract body to bytes");
|
11609 + | .expect("unable to collect body")
|
11610 + | .to_bytes();
|
11191 11611 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11192 11612 | &body,
|
11193 11613 | "{\"HttpdateTimestamp\":\"Sun, 02 Jan 2000 20:34:56 GMT\"}",
|
11194 11614 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11195 11615 | ));
|
11196 11616 | }
|
11197 11617 |
|
11198 11618 | /// Parses list shapes
|
11199 11619 | /// Test ID: parses_list_shapes
|
11200 11620 | #[::tokio::test]
|
11201 11621 | #[::tracing_test::traced_test]
|
11202 11622 | async fn parses_list_shapes_response() {
|
11203 11623 | let output = crate::output::KitchenSinkOperationOutput {
|
11204 11624 | list_of_strings: ::std::option::Option::Some(vec![
|
11205 11625 | "abc".to_owned(),
|
11206 11626 | "mno".to_owned(),
|
11207 11627 | "xyz".to_owned(),
|
11208 11628 | ]),
|
11209 11629 | blob: ::std::option::Option::None,
|
11210 11630 | boolean: ::std::option::Option::None,
|
11211 11631 | double: ::std::option::Option::None,
|
11212 11632 | empty_struct: ::std::option::Option::None,
|
11213 11633 | float: ::std::option::Option::None,
|
11214 11634 | httpdate_timestamp: ::std::option::Option::None,
|
11215 11635 | integer: ::std::option::Option::None,
|
11216 11636 | iso8601_timestamp: ::std::option::Option::None,
|
11217 11637 | json_value: ::std::option::Option::None,
|
11218 11638 | list_of_lists: ::std::option::Option::None,
|
11219 11639 | list_of_maps_of_strings: ::std::option::Option::None,
|
11220 11640 | list_of_structs: ::std::option::Option::None,
|
11221 11641 | long: ::std::option::Option::None,
|
11222 11642 | map_of_lists_of_strings: ::std::option::Option::None,
|
11223 11643 | map_of_maps: ::std::option::Option::None,
|
11224 11644 | map_of_strings: ::std::option::Option::None,
|
11225 11645 | map_of_structs: ::std::option::Option::None,
|
11226 11646 | recursive_list: ::std::option::Option::None,
|
11227 11647 | recursive_map: ::std::option::Option::None,
|
11228 11648 | recursive_struct: ::std::option::Option::None,
|
11229 11649 | simple_struct: ::std::option::Option::None,
|
11230 11650 | string: ::std::option::Option::None,
|
11231 11651 | struct_with_json_name: ::std::option::Option::None,
|
11232 11652 | timestamp: ::std::option::Option::None,
|
11233 11653 | unix_timestamp: ::std::option::Option::None,
|
11234 11654 | };
|
11235 11655 | use ::aws_smithy_http_server::response::IntoResponse;
|
11236 11656 | let http_response = output.into_response();
|
11237 11657 | ::pretty_assertions::assert_eq!(
|
11238 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11658 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11239 11659 | http_response.status()
|
11240 11660 | );
|
11241 11661 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11242 11662 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11243 11663 | http_response.headers(),
|
11244 11664 | expected_headers,
|
11245 11665 | ));
|
11246 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11666 + | use ::http_body_util::BodyExt;
|
11667 + | let body = http_response
|
11668 + | .into_body()
|
11669 + | .collect()
|
11247 11670 | .await
|
11248 - | .expect("unable to extract body to bytes");
|
11671 + | .expect("unable to collect body")
|
11672 + | .to_bytes();
|
11249 11673 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11250 11674 | &body,
|
11251 11675 | "{\"ListOfStrings\":[\"abc\",\"mno\",\"xyz\"]}",
|
11252 11676 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11253 11677 | ));
|
11254 11678 | }
|
11255 11679 |
|
11256 11680 | /// Parses list of map shapes
|
11257 11681 | /// Test ID: parses_list_of_map_shapes
|
11258 11682 | #[::tokio::test]
|
11259 11683 | #[::tracing_test::traced_test]
|
11260 11684 | async fn parses_list_of_map_shapes_response() {
|
11261 11685 | let output = crate::output::KitchenSinkOperationOutput {
|
11262 11686 | list_of_maps_of_strings: ::std::option::Option::Some(vec![
|
11263 11687 | {
|
11264 11688 | let mut ret = ::std::collections::HashMap::new();
|
11265 11689 | ret.insert("size".to_owned(), "large".to_owned());
|
11266 11690 | ret
|
11267 11691 | },
|
11268 11692 | {
|
11269 11693 | let mut ret = ::std::collections::HashMap::new();
|
11270 11694 | ret.insert("color".to_owned(), "red".to_owned());
|
11271 11695 | ret
|
11272 11696 | },
|
11273 11697 | ]),
|
11274 11698 | blob: ::std::option::Option::None,
|
11275 11699 | boolean: ::std::option::Option::None,
|
11276 11700 | double: ::std::option::Option::None,
|
11277 11701 | empty_struct: ::std::option::Option::None,
|
11278 11702 | float: ::std::option::Option::None,
|
11279 11703 | httpdate_timestamp: ::std::option::Option::None,
|
11280 11704 | integer: ::std::option::Option::None,
|
11281 11705 | iso8601_timestamp: ::std::option::Option::None,
|
11282 11706 | json_value: ::std::option::Option::None,
|
11283 11707 | list_of_lists: ::std::option::Option::None,
|
11284 11708 | list_of_strings: ::std::option::Option::None,
|
11285 11709 | list_of_structs: ::std::option::Option::None,
|
11286 11710 | long: ::std::option::Option::None,
|
11287 11711 | map_of_lists_of_strings: ::std::option::Option::None,
|
11288 11712 | map_of_maps: ::std::option::Option::None,
|
11289 11713 | map_of_strings: ::std::option::Option::None,
|
11290 11714 | map_of_structs: ::std::option::Option::None,
|
11291 11715 | recursive_list: ::std::option::Option::None,
|
11292 11716 | recursive_map: ::std::option::Option::None,
|
11293 11717 | recursive_struct: ::std::option::Option::None,
|
11294 11718 | simple_struct: ::std::option::Option::None,
|
11295 11719 | string: ::std::option::Option::None,
|
11296 11720 | struct_with_json_name: ::std::option::Option::None,
|
11297 11721 | timestamp: ::std::option::Option::None,
|
11298 11722 | unix_timestamp: ::std::option::Option::None,
|
11299 11723 | };
|
11300 11724 | use ::aws_smithy_http_server::response::IntoResponse;
|
11301 11725 | let http_response = output.into_response();
|
11302 11726 | ::pretty_assertions::assert_eq!(
|
11303 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11727 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11304 11728 | http_response.status()
|
11305 11729 | );
|
11306 11730 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11307 11731 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11308 11732 | http_response.headers(),
|
11309 11733 | expected_headers,
|
11310 11734 | ));
|
11311 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11735 + | use ::http_body_util::BodyExt;
|
11736 + | let body = http_response
|
11737 + | .into_body()
|
11738 + | .collect()
|
11312 11739 | .await
|
11313 - | .expect("unable to extract body to bytes");
|
11740 + | .expect("unable to collect body")
|
11741 + | .to_bytes();
|
11314 11742 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11315 11743 | &body,
|
11316 11744 | "{\"ListOfMapsOfStrings\":[{\"size\":\"large\"},{\"color\":\"red\"}]}",
|
11317 11745 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11318 11746 | ));
|
11319 11747 | }
|
11320 11748 |
|
11321 11749 | /// Parses list of list shapes
|
11322 11750 | /// Test ID: parses_list_of_list_shapes
|
11323 11751 | #[::tokio::test]
|
11324 11752 | #[::tracing_test::traced_test]
|
11325 11753 | async fn parses_list_of_list_shapes_response() {
|
11326 11754 | let output = crate::output::KitchenSinkOperationOutput {
|
11327 11755 | list_of_lists: ::std::option::Option::Some(vec![
|
11328 11756 | vec!["abc".to_owned(), "mno".to_owned(), "xyz".to_owned()],
|
11329 11757 | vec!["hjk".to_owned(), "qrs".to_owned(), "tuv".to_owned()],
|
11330 11758 | ]),
|
11331 11759 | blob: ::std::option::Option::None,
|
11332 11760 | boolean: ::std::option::Option::None,
|
11333 11761 | double: ::std::option::Option::None,
|
11334 11762 | empty_struct: ::std::option::Option::None,
|
11335 11763 | float: ::std::option::Option::None,
|
11336 11764 | httpdate_timestamp: ::std::option::Option::None,
|
11337 11765 | integer: ::std::option::Option::None,
|
11338 11766 | iso8601_timestamp: ::std::option::Option::None,
|
11339 11767 | json_value: ::std::option::Option::None,
|
11340 11768 | list_of_maps_of_strings: ::std::option::Option::None,
|
11341 11769 | list_of_strings: ::std::option::Option::None,
|
11342 11770 | list_of_structs: ::std::option::Option::None,
|
11343 11771 | long: ::std::option::Option::None,
|
11344 11772 | map_of_lists_of_strings: ::std::option::Option::None,
|
11345 11773 | map_of_maps: ::std::option::Option::None,
|
11346 11774 | map_of_strings: ::std::option::Option::None,
|
11347 11775 | map_of_structs: ::std::option::Option::None,
|
11348 11776 | recursive_list: ::std::option::Option::None,
|
11349 11777 | recursive_map: ::std::option::Option::None,
|
11350 11778 | recursive_struct: ::std::option::Option::None,
|
11351 11779 | simple_struct: ::std::option::Option::None,
|
11352 11780 | string: ::std::option::Option::None,
|
11353 11781 | struct_with_json_name: ::std::option::Option::None,
|
11354 11782 | timestamp: ::std::option::Option::None,
|
11355 11783 | unix_timestamp: ::std::option::Option::None,
|
11356 11784 | };
|
11357 11785 | use ::aws_smithy_http_server::response::IntoResponse;
|
11358 11786 | let http_response = output.into_response();
|
11359 11787 | ::pretty_assertions::assert_eq!(
|
11360 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11788 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11361 11789 | http_response.status()
|
11362 11790 | );
|
11363 11791 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11364 11792 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11365 11793 | http_response.headers(),
|
11366 11794 | expected_headers,
|
11367 11795 | ));
|
11368 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11796 + | use ::http_body_util::BodyExt;
|
11797 + | let body = http_response
|
11798 + | .into_body()
|
11799 + | .collect()
|
11369 11800 | .await
|
11370 - | .expect("unable to extract body to bytes");
|
11801 + | .expect("unable to collect body")
|
11802 + | .to_bytes();
|
11371 11803 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11372 11804 | &body,
|
11373 11805 | "{\"ListOfLists\":[[\"abc\",\"mno\",\"xyz\"],[\"hjk\",\"qrs\",\"tuv\"]]}",
|
11374 11806 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11375 11807 | ));
|
11376 11808 | }
|
11377 11809 |
|
11378 11810 | /// Parses list of structure shapes
|
11379 11811 | /// Test ID: parses_list_of_structure_shapes
|
11380 11812 | #[::tokio::test]
|
11381 11813 | #[::tracing_test::traced_test]
|
11382 11814 | async fn parses_list_of_structure_shapes_response() {
|
11383 11815 | let output = crate::output::KitchenSinkOperationOutput {
|
11384 11816 | list_of_structs: ::std::option::Option::Some(vec![
|
11385 11817 | crate::model::SimpleStruct {
|
11386 11818 | value: ::std::option::Option::Some("value-1".to_owned()),
|
11387 11819 | },
|
11388 11820 | crate::model::SimpleStruct {
|
11389 11821 | value: ::std::option::Option::Some("value-2".to_owned()),
|
11390 11822 | },
|
11391 11823 | ]),
|
11392 11824 | blob: ::std::option::Option::None,
|
11393 11825 | boolean: ::std::option::Option::None,
|
11394 11826 | double: ::std::option::Option::None,
|
11395 11827 | empty_struct: ::std::option::Option::None,
|
11396 11828 | float: ::std::option::Option::None,
|
11397 11829 | httpdate_timestamp: ::std::option::Option::None,
|
11398 11830 | integer: ::std::option::Option::None,
|
11399 11831 | iso8601_timestamp: ::std::option::Option::None,
|
11400 11832 | json_value: ::std::option::Option::None,
|
11401 11833 | list_of_lists: ::std::option::Option::None,
|
11402 11834 | list_of_maps_of_strings: ::std::option::Option::None,
|
11403 11835 | list_of_strings: ::std::option::Option::None,
|
11404 11836 | long: ::std::option::Option::None,
|
11405 11837 | map_of_lists_of_strings: ::std::option::Option::None,
|
11406 11838 | map_of_maps: ::std::option::Option::None,
|
11407 11839 | map_of_strings: ::std::option::Option::None,
|
11408 11840 | map_of_structs: ::std::option::Option::None,
|
11409 11841 | recursive_list: ::std::option::Option::None,
|
11410 11842 | recursive_map: ::std::option::Option::None,
|
11411 11843 | recursive_struct: ::std::option::Option::None,
|
11412 11844 | simple_struct: ::std::option::Option::None,
|
11413 11845 | string: ::std::option::Option::None,
|
11414 11846 | struct_with_json_name: ::std::option::Option::None,
|
11415 11847 | timestamp: ::std::option::Option::None,
|
11416 11848 | unix_timestamp: ::std::option::Option::None,
|
11417 11849 | };
|
11418 11850 | use ::aws_smithy_http_server::response::IntoResponse;
|
11419 11851 | let http_response = output.into_response();
|
11420 11852 | ::pretty_assertions::assert_eq!(
|
11421 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11853 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11422 11854 | http_response.status()
|
11423 11855 | );
|
11424 11856 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11425 11857 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11426 11858 | http_response.headers(),
|
11427 11859 | expected_headers,
|
11428 11860 | ));
|
11429 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
11861 + | use ::http_body_util::BodyExt;
|
11862 + | let body = http_response
|
11863 + | .into_body()
|
11864 + | .collect()
|
11430 11865 | .await
|
11431 - | .expect("unable to extract body to bytes");
|
11866 + | .expect("unable to collect body")
|
11867 + | .to_bytes();
|
11432 11868 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11433 11869 | &body,
|
11434 11870 | "{\"ListOfStructs\":[{\"Value\":\"value-1\"},{\"Value\":\"value-2\"}]}",
|
11435 11871 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11436 11872 | ));
|
11437 11873 | }
|
11438 11874 |
|
11439 11875 | /// Parses list of recursive structure shapes
|
11440 11876 | /// Test ID: parses_list_of_recursive_structure_shapes
|
11441 11877 | #[::tokio::test]
|
11546 11982 | recursive_struct: ::std::option::Option::None,
|
11547 11983 | simple_struct: ::std::option::Option::None,
|
11548 11984 | string: ::std::option::Option::None,
|
11549 11985 | struct_with_json_name: ::std::option::Option::None,
|
11550 11986 | timestamp: ::std::option::Option::None,
|
11551 11987 | unix_timestamp: ::std::option::Option::None,
|
11552 11988 | };
|
11553 11989 | use ::aws_smithy_http_server::response::IntoResponse;
|
11554 11990 | let http_response = output.into_response();
|
11555 11991 | ::pretty_assertions::assert_eq!(
|
11556 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11992 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11557 11993 | http_response.status()
|
11558 11994 | );
|
11559 11995 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11560 11996 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11561 11997 | http_response.headers(),
|
11562 11998 | expected_headers,
|
11563 11999 | ));
|
11564 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
12000 + | use ::http_body_util::BodyExt;
|
12001 + | let body = http_response
|
12002 + | .into_body()
|
12003 + | .collect()
|
11565 12004 | .await
|
11566 - | .expect("unable to extract body to bytes");
|
12005 + | .expect("unable to collect body")
|
12006 + | .to_bytes();
|
11567 12007 | ::aws_smithy_protocol_test::assert_ok(
|
11568 12008 | ::aws_smithy_protocol_test::validate_body(&body, "{\"RecursiveList\":[{\"RecursiveList\":[{\"RecursiveList\":[{\"String\":\"value\"}]}]}]}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
11569 12009 | );
|
11570 12010 | }
|
11571 12011 |
|
11572 12012 | /// Parses map shapes
|
11573 12013 | /// Test ID: parses_map_shapes
|
11574 12014 | #[::tokio::test]
|
11575 12015 | #[::tracing_test::traced_test]
|
11576 12016 | async fn parses_map_shapes_response() {
|
11577 12017 | let output = crate::output::KitchenSinkOperationOutput {
|
11578 12018 | map_of_strings: ::std::option::Option::Some({
|
11579 12019 | let mut ret = ::std::collections::HashMap::new();
|
11580 12020 | ret.insert("size".to_owned(), "large".to_owned());
|
11581 12021 | ret.insert("color".to_owned(), "red".to_owned());
|
11582 12022 | ret
|
11583 12023 | }),
|
11584 12024 | blob: ::std::option::Option::None,
|
11585 12025 | boolean: ::std::option::Option::None,
|
11586 12026 | double: ::std::option::Option::None,
|
11587 12027 | empty_struct: ::std::option::Option::None,
|
11588 12028 | float: ::std::option::Option::None,
|
11589 12029 | httpdate_timestamp: ::std::option::Option::None,
|
11590 12030 | integer: ::std::option::Option::None,
|
11591 12031 | iso8601_timestamp: ::std::option::Option::None,
|
11592 12032 | json_value: ::std::option::Option::None,
|
11593 12033 | list_of_lists: ::std::option::Option::None,
|
11594 12034 | list_of_maps_of_strings: ::std::option::Option::None,
|
11595 12035 | list_of_strings: ::std::option::Option::None,
|
11596 12036 | list_of_structs: ::std::option::Option::None,
|
11597 12037 | long: ::std::option::Option::None,
|
11598 12038 | map_of_lists_of_strings: ::std::option::Option::None,
|
11599 12039 | map_of_maps: ::std::option::Option::None,
|
11600 12040 | map_of_structs: ::std::option::Option::None,
|
11601 12041 | recursive_list: ::std::option::Option::None,
|
11602 12042 | recursive_map: ::std::option::Option::None,
|
11603 12043 | recursive_struct: ::std::option::Option::None,
|
11604 12044 | simple_struct: ::std::option::Option::None,
|
11605 12045 | string: ::std::option::Option::None,
|
11606 12046 | struct_with_json_name: ::std::option::Option::None,
|
11607 12047 | timestamp: ::std::option::Option::None,
|
11608 12048 | unix_timestamp: ::std::option::Option::None,
|
11609 12049 | };
|
11610 12050 | use ::aws_smithy_http_server::response::IntoResponse;
|
11611 12051 | let http_response = output.into_response();
|
11612 12052 | ::pretty_assertions::assert_eq!(
|
11613 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12053 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11614 12054 | http_response.status()
|
11615 12055 | );
|
11616 12056 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11617 12057 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11618 12058 | http_response.headers(),
|
11619 12059 | expected_headers,
|
11620 12060 | ));
|
11621 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
12061 + | use ::http_body_util::BodyExt;
|
12062 + | let body = http_response
|
12063 + | .into_body()
|
12064 + | .collect()
|
11622 12065 | .await
|
11623 - | .expect("unable to extract body to bytes");
|
12066 + | .expect("unable to collect body")
|
12067 + | .to_bytes();
|
11624 12068 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11625 12069 | &body,
|
11626 12070 | "{\"MapOfStrings\":{\"size\":\"large\",\"color\":\"red\"}}",
|
11627 12071 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11628 12072 | ));
|
11629 12073 | }
|
11630 12074 |
|
11631 12075 | /// Parses map of list shapes
|
11632 12076 | /// Test ID: parses_map_of_list_shapes
|
11633 12077 | #[::tokio::test]
|
11634 12078 | #[::tracing_test::traced_test]
|
11635 12079 | async fn parses_map_of_list_shapes_response() {
|
11636 12080 | let output = crate::output::KitchenSinkOperationOutput {
|
11637 12081 | map_of_lists_of_strings: ::std::option::Option::Some({
|
11638 12082 | let mut ret = ::std::collections::HashMap::new();
|
11639 12083 | ret.insert(
|
11640 12084 | "sizes".to_owned(),
|
11641 12085 | vec!["large".to_owned(), "small".to_owned()],
|
11642 12086 | );
|
11643 12087 | ret.insert(
|
11644 12088 | "colors".to_owned(),
|
11645 12089 | vec!["red".to_owned(), "green".to_owned()],
|
11646 12090 | );
|
11647 12091 | ret
|
11648 12092 | }),
|
11649 12093 | blob: ::std::option::Option::None,
|
11650 12094 | boolean: ::std::option::Option::None,
|
11651 12095 | double: ::std::option::Option::None,
|
11652 12096 | empty_struct: ::std::option::Option::None,
|
11653 12097 | float: ::std::option::Option::None,
|
11654 12098 | httpdate_timestamp: ::std::option::Option::None,
|
11655 12099 | integer: ::std::option::Option::None,
|
11656 12100 | iso8601_timestamp: ::std::option::Option::None,
|
11657 12101 | json_value: ::std::option::Option::None,
|
11658 12102 | list_of_lists: ::std::option::Option::None,
|
11659 12103 | list_of_maps_of_strings: ::std::option::Option::None,
|
11660 12104 | list_of_strings: ::std::option::Option::None,
|
11661 12105 | list_of_structs: ::std::option::Option::None,
|
11662 12106 | long: ::std::option::Option::None,
|
11663 12107 | map_of_maps: ::std::option::Option::None,
|
11664 12108 | map_of_strings: ::std::option::Option::None,
|
11665 12109 | map_of_structs: ::std::option::Option::None,
|
11666 12110 | recursive_list: ::std::option::Option::None,
|
11667 12111 | recursive_map: ::std::option::Option::None,
|
11668 12112 | recursive_struct: ::std::option::Option::None,
|
11669 12113 | simple_struct: ::std::option::Option::None,
|
11670 12114 | string: ::std::option::Option::None,
|
11671 12115 | struct_with_json_name: ::std::option::Option::None,
|
11672 12116 | timestamp: ::std::option::Option::None,
|
11673 12117 | unix_timestamp: ::std::option::Option::None,
|
11674 12118 | };
|
11675 12119 | use ::aws_smithy_http_server::response::IntoResponse;
|
11676 12120 | let http_response = output.into_response();
|
11677 12121 | ::pretty_assertions::assert_eq!(
|
11678 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12122 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11679 12123 | http_response.status()
|
11680 12124 | );
|
11681 12125 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11682 12126 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11683 12127 | http_response.headers(),
|
11684 12128 | expected_headers,
|
11685 12129 | ));
|
11686 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
12130 + | use ::http_body_util::BodyExt;
|
12131 + | let body = http_response
|
12132 + | .into_body()
|
12133 + | .collect()
|
11687 12134 | .await
|
11688 - | .expect("unable to extract body to bytes");
|
12135 + | .expect("unable to collect body")
|
12136 + | .to_bytes();
|
11689 12137 | ::aws_smithy_protocol_test::assert_ok(
|
11690 12138 | ::aws_smithy_protocol_test::validate_body(&body, "{\"MapOfListsOfStrings\":{\"sizes\":[\"large\",\"small\"],\"colors\":[\"red\",\"green\"]}}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
11691 12139 | );
|
11692 12140 | }
|
11693 12141 |
|
11694 12142 | /// Parses map of map shapes
|
11695 12143 | /// Test ID: parses_map_of_map_shapes
|
11696 12144 | #[::tokio::test]
|
11697 12145 | #[::tracing_test::traced_test]
|
11698 12146 | async fn parses_map_of_map_shapes_response() {
|
11699 12147 | let output = crate::output::KitchenSinkOperationOutput {
|
11700 12148 | map_of_maps: ::std::option::Option::Some({
|
11701 12149 | let mut ret = ::std::collections::HashMap::new();
|
11702 12150 | ret.insert("sizes".to_owned(), {
|
11703 12151 | let mut ret = ::std::collections::HashMap::new();
|
11704 12152 | ret.insert("large".to_owned(), "L".to_owned());
|
11705 12153 | ret.insert("medium".to_owned(), "M".to_owned());
|
11706 12154 | ret
|
11707 12155 | });
|
11708 12156 | ret.insert("colors".to_owned(), {
|
11709 12157 | let mut ret = ::std::collections::HashMap::new();
|
11710 12158 | ret.insert("red".to_owned(), "R".to_owned());
|
11711 12159 | ret.insert("blue".to_owned(), "B".to_owned());
|
11712 12160 | ret
|
11713 12161 | });
|
11714 12162 | ret
|
11715 12163 | }),
|
11716 12164 | blob: ::std::option::Option::None,
|
11717 12165 | boolean: ::std::option::Option::None,
|
11718 12166 | double: ::std::option::Option::None,
|
11719 12167 | empty_struct: ::std::option::Option::None,
|
11720 12168 | float: ::std::option::Option::None,
|
11721 12169 | httpdate_timestamp: ::std::option::Option::None,
|
11722 12170 | integer: ::std::option::Option::None,
|
11723 12171 | iso8601_timestamp: ::std::option::Option::None,
|
11724 12172 | json_value: ::std::option::Option::None,
|
11725 12173 | list_of_lists: ::std::option::Option::None,
|
11726 12174 | list_of_maps_of_strings: ::std::option::Option::None,
|
11727 12175 | list_of_strings: ::std::option::Option::None,
|
11728 12176 | list_of_structs: ::std::option::Option::None,
|
11729 12177 | long: ::std::option::Option::None,
|
11730 12178 | map_of_lists_of_strings: ::std::option::Option::None,
|
11731 12179 | map_of_strings: ::std::option::Option::None,
|
11732 12180 | map_of_structs: ::std::option::Option::None,
|
11733 12181 | recursive_list: ::std::option::Option::None,
|
11734 12182 | recursive_map: ::std::option::Option::None,
|
11735 12183 | recursive_struct: ::std::option::Option::None,
|
11736 12184 | simple_struct: ::std::option::Option::None,
|
11737 12185 | string: ::std::option::Option::None,
|
11738 12186 | struct_with_json_name: ::std::option::Option::None,
|
11739 12187 | timestamp: ::std::option::Option::None,
|
11740 12188 | unix_timestamp: ::std::option::Option::None,
|
11741 12189 | };
|
11742 12190 | use ::aws_smithy_http_server::response::IntoResponse;
|
11743 12191 | let http_response = output.into_response();
|
11744 12192 | ::pretty_assertions::assert_eq!(
|
11745 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12193 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11746 12194 | http_response.status()
|
11747 12195 | );
|
11748 12196 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11749 12197 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11750 12198 | http_response.headers(),
|
11751 12199 | expected_headers,
|
11752 12200 | ));
|
11753 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
12201 + | use ::http_body_util::BodyExt;
|
12202 + | let body = http_response
|
12203 + | .into_body()
|
12204 + | .collect()
|
11754 12205 | .await
|
11755 - | .expect("unable to extract body to bytes");
|
12206 + | .expect("unable to collect body")
|
12207 + | .to_bytes();
|
11756 12208 | ::aws_smithy_protocol_test::assert_ok(
|
11757 12209 | ::aws_smithy_protocol_test::validate_body(&body, "{\"MapOfMaps\":{\"sizes\":{\"large\":\"L\",\"medium\":\"M\"},\"colors\":{\"red\":\"R\",\"blue\":\"B\"}}}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
11758 12210 | );
|
11759 12211 | }
|
11760 12212 |
|
11761 12213 | /// Parses map of structure shapes
|
11762 12214 | /// Test ID: parses_map_of_structure_shapes
|
11763 12215 | #[::tokio::test]
|
11764 12216 | #[::tracing_test::traced_test]
|
11765 12217 | async fn parses_map_of_structure_shapes_response() {
|
11766 12218 | let output = crate::output::KitchenSinkOperationOutput {
|
11767 12219 | map_of_structs: ::std::option::Option::Some({
|
11768 12220 | let mut ret = ::std::collections::HashMap::new();
|
11769 12221 | ret.insert(
|
11770 12222 | "size".to_owned(),
|
11771 12223 | crate::model::SimpleStruct {
|
11772 12224 | value: ::std::option::Option::Some("small".to_owned()),
|
11773 12225 | },
|
11774 12226 | );
|
11775 12227 | ret.insert(
|
11776 12228 | "color".to_owned(),
|
11777 12229 | crate::model::SimpleStruct {
|
11778 12230 | value: ::std::option::Option::Some("red".to_owned()),
|
11779 12231 | },
|
11780 12232 | );
|
11781 12233 | ret
|
11782 12234 | }),
|
11783 12235 | blob: ::std::option::Option::None,
|
11784 12236 | boolean: ::std::option::Option::None,
|
11785 12237 | double: ::std::option::Option::None,
|
11786 12238 | empty_struct: ::std::option::Option::None,
|
11787 12239 | float: ::std::option::Option::None,
|
11788 12240 | httpdate_timestamp: ::std::option::Option::None,
|
11789 12241 | integer: ::std::option::Option::None,
|
11790 12242 | iso8601_timestamp: ::std::option::Option::None,
|
11791 12243 | json_value: ::std::option::Option::None,
|
11792 12244 | list_of_lists: ::std::option::Option::None,
|
11793 12245 | list_of_maps_of_strings: ::std::option::Option::None,
|
11794 12246 | list_of_strings: ::std::option::Option::None,
|
11795 12247 | list_of_structs: ::std::option::Option::None,
|
11796 12248 | long: ::std::option::Option::None,
|
11797 12249 | map_of_lists_of_strings: ::std::option::Option::None,
|
11798 12250 | map_of_maps: ::std::option::Option::None,
|
11799 12251 | map_of_strings: ::std::option::Option::None,
|
11800 12252 | recursive_list: ::std::option::Option::None,
|
11801 12253 | recursive_map: ::std::option::Option::None,
|
11802 12254 | recursive_struct: ::std::option::Option::None,
|
11803 12255 | simple_struct: ::std::option::Option::None,
|
11804 12256 | string: ::std::option::Option::None,
|
11805 12257 | struct_with_json_name: ::std::option::Option::None,
|
11806 12258 | timestamp: ::std::option::Option::None,
|
11807 12259 | unix_timestamp: ::std::option::Option::None,
|
11808 12260 | };
|
11809 12261 | use ::aws_smithy_http_server::response::IntoResponse;
|
11810 12262 | let http_response = output.into_response();
|
11811 12263 | ::pretty_assertions::assert_eq!(
|
11812 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12264 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11813 12265 | http_response.status()
|
11814 12266 | );
|
11815 12267 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11816 12268 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11817 12269 | http_response.headers(),
|
11818 12270 | expected_headers,
|
11819 12271 | ));
|
11820 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
12272 + | use ::http_body_util::BodyExt;
|
12273 + | let body = http_response
|
12274 + | .into_body()
|
12275 + | .collect()
|
11821 12276 | .await
|
11822 - | .expect("unable to extract body to bytes");
|
12277 + | .expect("unable to collect body")
|
12278 + | .to_bytes();
|
11823 12279 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
11824 12280 | &body,
|
11825 12281 | "{\"MapOfStructs\":{\"size\":{\"Value\":\"small\"},\"color\":{\"Value\":\"red\"}}}",
|
11826 12282 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
11827 12283 | ));
|
11828 12284 | }
|
11829 12285 |
|
11830 12286 | /// Parses map of recursive structure shapes
|
11831 12287 | /// Test ID: parses_map_of_recursive_structure_shapes
|
11832 12288 | #[::tokio::test]
|
11962 12418 | recursive_struct: ::std::option::Option::None,
|
11963 12419 | simple_struct: ::std::option::Option::None,
|
11964 12420 | string: ::std::option::Option::None,
|
11965 12421 | struct_with_json_name: ::std::option::Option::None,
|
11966 12422 | timestamp: ::std::option::Option::None,
|
11967 12423 | unix_timestamp: ::std::option::Option::None,
|
11968 12424 | };
|
11969 12425 | use ::aws_smithy_http_server::response::IntoResponse;
|
11970 12426 | let http_response = output.into_response();
|
11971 12427 | ::pretty_assertions::assert_eq!(
|
11972 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12428 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
11973 12429 | http_response.status()
|
11974 12430 | );
|
11975 12431 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
11976 12432 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
11977 12433 | http_response.headers(),
|
11978 12434 | expected_headers,
|
11979 12435 | ));
|
11980 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
12436 + | use ::http_body_util::BodyExt;
|
12437 + | let body = http_response
|
12438 + | .into_body()
|
12439 + | .collect()
|
11981 12440 | .await
|
11982 - | .expect("unable to extract body to bytes");
|
12441 + | .expect("unable to collect body")
|
12442 + | .to_bytes();
|
11983 12443 | ::aws_smithy_protocol_test::assert_ok(
|
11984 12444 | ::aws_smithy_protocol_test::validate_body(&body, "{\"RecursiveMap\":{\"key-1\":{\"RecursiveMap\":{\"key-2\":{\"RecursiveMap\":{\"key-3\":{\"String\":\"value\"}}}}}}}", ::aws_smithy_protocol_test::MediaType::from("application/json"))
|
11985 12445 | );
|
11986 12446 | }
|
11987 12447 |
|
11988 12448 | /// Parses the request id from the response
|
11989 12449 | /// Test ID: parses_the_request_id_from_the_response
|
11990 12450 | #[::tokio::test]
|
11991 12451 | #[::tracing_test::traced_test]
|
11992 12452 | #[should_panic]
|
11993 12453 | async fn parses_the_request_id_from_the_response_response() {
|
11994 12454 | let output = crate::output::KitchenSinkOperationOutput {
|
11995 12455 | blob: ::std::option::Option::None,
|
11996 12456 | boolean: ::std::option::Option::None,
|
11997 12457 | double: ::std::option::Option::None,
|
11998 12458 | empty_struct: ::std::option::Option::None,
|
11999 12459 | float: ::std::option::Option::None,
|
12000 12460 | httpdate_timestamp: ::std::option::Option::None,
|
12001 12461 | integer: ::std::option::Option::None,
|
12002 12462 | iso8601_timestamp: ::std::option::Option::None,
|
12003 12463 | json_value: ::std::option::Option::None,
|
12004 12464 | list_of_lists: ::std::option::Option::None,
|
12005 12465 | list_of_maps_of_strings: ::std::option::Option::None,
|
12006 12466 | list_of_strings: ::std::option::Option::None,
|
12007 12467 | list_of_structs: ::std::option::Option::None,
|
12008 12468 | long: ::std::option::Option::None,
|
12009 12469 | map_of_lists_of_strings: ::std::option::Option::None,
|
12010 12470 | map_of_maps: ::std::option::Option::None,
|
12011 12471 | map_of_strings: ::std::option::Option::None,
|
12012 12472 | map_of_structs: ::std::option::Option::None,
|
12013 12473 | recursive_list: ::std::option::Option::None,
|
12014 12474 | recursive_map: ::std::option::Option::None,
|
12015 12475 | recursive_struct: ::std::option::Option::None,
|
12016 12476 | simple_struct: ::std::option::Option::None,
|
12017 12477 | string: ::std::option::Option::None,
|
12018 12478 | struct_with_json_name: ::std::option::Option::None,
|
12019 12479 | timestamp: ::std::option::Option::None,
|
12020 12480 | unix_timestamp: ::std::option::Option::None,
|
12021 12481 | };
|
12022 12482 | use ::aws_smithy_http_server::response::IntoResponse;
|
12023 12483 | let http_response = output.into_response();
|
12024 12484 | ::pretty_assertions::assert_eq!(
|
12025 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12485 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12026 12486 | http_response.status()
|
12027 12487 | );
|
12028 12488 | let expected_headers = [
|
12029 12489 | ("Content-Type", "application/x-amz-json-1.1"),
|
12030 12490 | ("X-Amzn-Requestid", "amazon-uniq-request-id"),
|
12031 12491 | ];
|
12032 12492 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12033 12493 | http_response.headers(),
|
12034 12494 | expected_headers,
|
12035 12495 | ));
|
12036 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
12496 + | use ::http_body_util::BodyExt;
|
12497 + | let body = http_response
|
12498 + | .into_body()
|
12499 + | .collect()
|
12037 12500 | .await
|
12038 - | .expect("unable to extract body to bytes");
|
12501 + | .expect("unable to collect body")
|
12502 + | .to_bytes();
|
12039 12503 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_body(
|
12040 12504 | &body,
|
12041 12505 | "{}",
|
12042 12506 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
12043 12507 | ));
|
12044 12508 | }
|
12045 12509 | }
|
12046 12510 |
|
12047 12511 | ::pin_project_lite::pin_project! {
|
12048 12512 | /// A [`Future`](std::future::Future) aggregating the body bytes of a [`Request`] and constructing the
|
12049 12513 | /// [`EmptyOperationInput`](crate::input::EmptyOperationInput) using modelled bindings.
|
12050 12514 | pub struct EmptyOperationInputFuture {
|
12051 12515 | inner: std::pin::Pin<Box<dyn std::future::Future<Output = Result<crate::input::EmptyOperationInput, ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError>> + Send>>
|
12052 12516 | }
|
12053 12517 | }
|
12054 12518 |
|
12055 12519 | impl std::future::Future for EmptyOperationInputFuture {
|
12056 12520 | type Output = Result<
|
12057 12521 | crate::input::EmptyOperationInput,
|
12058 12522 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError,
|
12059 12523 | >;
|
12060 12524 |
|
12061 12525 | fn poll(
|
12062 12526 | self: std::pin::Pin<&mut Self>,
|
12063 12527 | cx: &mut std::task::Context<'_>,
|
12064 12528 | ) -> std::task::Poll<Self::Output> {
|
12065 12529 | let this = self.project();
|
12066 12530 | this.inner.as_mut().poll(cx)
|
12067 12531 | }
|
12068 12532 | }
|
12069 12533 |
|
12070 12534 | impl<B>
|
12071 12535 | ::aws_smithy_http_server::request::FromRequest<
|
12072 12536 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12073 12537 | B,
|
12074 12538 | > for crate::input::EmptyOperationInput
|
12075 12539 | where
|
12076 12540 | B: ::aws_smithy_http_server::body::HttpBody + Send,
|
12077 12541 | B: 'static,
|
12078 12542 |
|
12079 12543 | B::Data: Send,
|
12080 12544 | ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection:
|
12081 12545 | From<<B as ::aws_smithy_http_server::body::HttpBody>::Error>,
|
12082 12546 | {
|
12083 12547 | type Rejection = ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError;
|
12084 12548 | type Future = EmptyOperationInputFuture;
|
12085 12549 |
|
12086 - | fn from_request(request: ::http::Request<B>) -> Self::Future {
|
12550 + | fn from_request(request: ::http_1x::Request<B>) -> Self::Future {
|
12087 12551 | let fut = async move {
|
12088 12552 | if !::aws_smithy_http_server::protocol::accept_header_classifier(
|
12089 12553 | request.headers(),
|
12090 12554 | &crate::mimes::CONTENT_TYPE_APPLICATION_X_AMZ_JSON_1_1,
|
12091 12555 | ) {
|
12092 12556 | return Err(::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection::NotAcceptable);
|
12093 12557 | }
|
12094 12558 | crate::protocol_serde::shape_empty_operation::de_empty_operation_http_request(request)
|
12095 12559 | .await
|
12096 12560 | };
|
12097 12561 | use ::futures_util::future::TryFutureExt;
|
12098 12562 | let fut = fut.map_err(
|
12099 12563 | |e: ::aws_smithy_http_server::protocol::aws_json::rejection::RequestRejection| {
|
12100 12564 | ::tracing::debug!(error = %e, "failed to deserialize request");
|
12101 12565 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(e)
|
12102 12566 | },
|
12103 12567 | );
|
12104 12568 | EmptyOperationInputFuture {
|
12105 12569 | inner: Box::pin(fut),
|
12106 12570 | }
|
12107 12571 | }
|
12108 12572 | }
|
12109 12573 | impl
|
12110 12574 | ::aws_smithy_http_server::response::IntoResponse<
|
12111 12575 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12112 12576 | > for crate::output::EmptyOperationOutput
|
12113 12577 | {
|
12114 12578 | fn into_response(self) -> ::aws_smithy_http_server::response::Response {
|
12115 12579 | match crate::protocol_serde::shape_empty_operation::ser_empty_operation_http_response(self)
|
12116 12580 | {
|
12117 12581 | Ok(response) => response,
|
12118 12582 | Err(e) => {
|
12119 12583 | ::tracing::error!(error = %e, "failed to serialize response");
|
12120 12584 | ::aws_smithy_http_server::response::IntoResponse::<
|
12121 12585 | ::aws_smithy_http_server::protocol::aws_json_11::AwsJson1_1,
|
12122 12586 | >::into_response(
|
12123 12587 | ::aws_smithy_http_server::protocol::aws_json::runtime_error::RuntimeError::from(
|
12124 12588 | e,
|
12125 12589 | ),
|
12126 12590 | )
|
12127 12591 | }
|
12128 12592 | }
|
12129 12593 | }
|
12130 12594 | }
|
12131 12595 |
|
12132 12596 | #[allow(unreachable_code, unused_variables)]
|
12133 12597 | #[cfg(test)]
|
12134 12598 | mod empty_operation_test {
|
12135 12599 |
|
12136 12600 | /// Sends requests to /
|
12137 12601 | /// Test ID: sends_requests_to_slash
|
12138 12602 | #[::tokio::test]
|
12139 12603 | #[::tracing_test::traced_test]
|
12140 12604 | async fn sends_requests_to_slash_request() {
|
12141 12605 | #[allow(unused_mut)]
|
12142 - | let mut http_request = http::Request::builder()
|
12606 + | let mut http_request = ::http_1x::Request::builder()
|
12143 12607 | .uri("/")
|
12144 12608 | .method("POST")
|
12145 12609 | .header("Content-Type", "application/x-amz-json-1.1")
|
12146 12610 | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
12147 - | .body(::aws_smithy_http_server::body::Body::empty())
|
12611 + | .body(::aws_smithy_http_server::body::boxed(
|
12612 + | ::http_body_util::Empty::new(),
|
12613 + | ))
|
12148 12614 | .unwrap();
|
12149 12615 | #[allow(unused_mut)]
|
12150 12616 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12151 12617 | let config = crate::service::JsonProtocolConfig::builder().build();
|
12152 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
12618 + | let service = crate::service::JsonProtocol::builder::<
|
12619 + | ::aws_smithy_http_server::body::BoxBody,
|
12620 + | _,
|
12621 + | _,
|
12622 + | _,
|
12623 + | >(config)
|
12153 12624 | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
12154 12625 | let sender = sender.clone();
|
12155 12626 | async move {
|
12156 12627 | let result = {
|
12157 12628 | let expected = crate::input::EmptyOperationInput {};
|
12158 12629 | ::pretty_assertions::assert_eq!(input, expected);
|
12159 12630 | let output = crate::output::EmptyOperationOutput {};
|
12160 12631 | output
|
12161 12632 | };
|
12162 12633 | sender.send(()).await.expect("receiver dropped early");
|
12163 12634 | result
|
12164 12635 | }
|
12165 12636 | })
|
12166 12637 | .build_unchecked();
|
12167 12638 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12168 12639 | .await
|
12169 12640 | .expect("unable to make an HTTP request");
|
12170 12641 | assert!(
|
12171 12642 | receiver.recv().await.is_some(),
|
12172 12643 | "we expected operation handler to be invoked but it was not entered"
|
12173 12644 | );
|
12174 12645 | }
|
12175 12646 |
|
12176 12647 | /// Includes X-Amz-Target header and Content-Type
|
12177 12648 | /// Test ID: includes_x_amz_target_and_content_type
|
12178 12649 | #[::tokio::test]
|
12179 12650 | #[::tracing_test::traced_test]
|
12180 12651 | async fn includes_x_amz_target_and_content_type_request() {
|
12181 12652 | #[allow(unused_mut)]
|
12182 - | let mut http_request = http::Request::builder()
|
12653 + | let mut http_request = ::http_1x::Request::builder()
|
12183 12654 | .uri("/")
|
12184 12655 | .method("POST")
|
12185 12656 | .header("Content-Type", "application/x-amz-json-1.1")
|
12186 12657 | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
12187 - | .body(::aws_smithy_http_server::body::Body::empty())
|
12658 + | .body(::aws_smithy_http_server::body::boxed(
|
12659 + | ::http_body_util::Empty::new(),
|
12660 + | ))
|
12188 12661 | .unwrap();
|
12189 12662 | #[allow(unused_mut)]
|
12190 12663 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12191 12664 | let config = crate::service::JsonProtocolConfig::builder().build();
|
12192 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
12665 + | let service = crate::service::JsonProtocol::builder::<
|
12666 + | ::aws_smithy_http_server::body::BoxBody,
|
12667 + | _,
|
12668 + | _,
|
12669 + | _,
|
12670 + | >(config)
|
12193 12671 | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
12194 12672 | let sender = sender.clone();
|
12195 12673 | async move {
|
12196 12674 | let result = {
|
12197 12675 | let expected = crate::input::EmptyOperationInput {};
|
12198 12676 | ::pretty_assertions::assert_eq!(input, expected);
|
12199 12677 | let output = crate::output::EmptyOperationOutput {};
|
12200 12678 | output
|
12201 12679 | };
|
12202 12680 | sender.send(()).await.expect("receiver dropped early");
|
12203 12681 | result
|
12204 12682 | }
|
12205 12683 | })
|
12206 12684 | .build_unchecked();
|
12207 12685 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12208 12686 | .await
|
12209 12687 | .expect("unable to make an HTTP request");
|
12210 12688 | assert!(
|
12211 12689 | receiver.recv().await.is_some(),
|
12212 12690 | "we expected operation handler to be invoked but it was not entered"
|
12213 12691 | );
|
12214 12692 | }
|
12215 12693 |
|
12216 12694 | /// Clients must always send an empty JSON object payload for
|
12217 12695 | /// operations with no input (that is, `{}`). While AWS service
|
12218 12696 | /// implementations support requests with no payload or requests
|
12219 12697 | /// that send `{}`, always sending `{}` from the client is
|
12220 12698 | /// preferred for forward compatibility in case input is ever
|
12221 12699 | /// added to an operation.
|
12222 12700 | /// Test ID: json_1_1_client_sends_empty_payload_for_no_input_shape
|
12223 12701 | #[::tokio::test]
|
12224 12702 | #[::tracing_test::traced_test]
|
12225 12703 | async fn json_1_1_client_sends_empty_payload_for_no_input_shape_request() {
|
12226 12704 | #[allow(unused_mut)]
|
12227 - | let mut http_request = http::Request::builder()
|
12705 + | let mut http_request = ::http_1x::Request::builder()
|
12228 12706 | .uri("/")
|
12229 12707 | .method("POST")
|
12230 12708 | .header("Content-Type", "application/x-amz-json-1.1")
|
12231 12709 | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
12232 - | .body(::aws_smithy_http_server::body::Body::from(
|
12233 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
12710 + | .body(::aws_smithy_http_server::body::boxed(
|
12711 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
12712 + | &::aws_smithy_protocol_test::decode_body_data(
|
12234 12713 | "{}".as_bytes(),
|
12235 12714 | ::aws_smithy_protocol_test::MediaType::from("application/json"),
|
12715 + | ),
|
12236 12716 | )),
|
12237 12717 | ))
|
12238 12718 | .unwrap();
|
12239 12719 | #[allow(unused_mut)]
|
12240 12720 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12241 12721 | let config = crate::service::JsonProtocolConfig::builder().build();
|
12242 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
12722 + | let service = crate::service::JsonProtocol::builder::<
|
12723 + | ::aws_smithy_http_server::body::BoxBody,
|
12724 + | _,
|
12725 + | _,
|
12726 + | _,
|
12727 + | >(config)
|
12243 12728 | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
12244 12729 | let sender = sender.clone();
|
12245 12730 | async move {
|
12246 12731 | let result = {
|
12247 12732 | let expected = crate::input::EmptyOperationInput {};
|
12248 12733 | ::pretty_assertions::assert_eq!(input, expected);
|
12249 12734 | let output = crate::output::EmptyOperationOutput {};
|
12250 12735 | output
|
12251 12736 | };
|
12252 12737 | sender.send(()).await.expect("receiver dropped early");
|
12253 12738 | result
|
12254 12739 | }
|
12255 12740 | })
|
12256 12741 | .build_unchecked();
|
12257 12742 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12258 12743 | .await
|
12259 12744 | .expect("unable to make an HTTP request");
|
12260 12745 | assert!(
|
12261 12746 | receiver.recv().await.is_some(),
|
12262 12747 | "we expected operation handler to be invoked but it was not entered"
|
12263 12748 | );
|
12264 12749 | }
|
12265 12750 |
|
12266 12751 | /// Service implementations must support no payload or an empty
|
12267 12752 | /// object payload for operations that define no input. However,
|
12268 12753 | /// despite the lack of a payload, a Content-Type header is still
|
12269 12754 | /// required in order for the service to properly detect the
|
12270 12755 | /// protocol.
|
12271 12756 | /// Test ID: json_1_1_service_supports_empty_payload_for_no_input_shape
|
12272 12757 | #[::tokio::test]
|
12273 12758 | #[::tracing_test::traced_test]
|
12274 12759 | async fn json_1_1_service_supports_empty_payload_for_no_input_shape_request() {
|
12275 12760 | #[allow(unused_mut)]
|
12276 - | let mut http_request = http::Request::builder()
|
12761 + | let mut http_request = ::http_1x::Request::builder()
|
12277 12762 | .uri("/")
|
12278 12763 | .method("POST")
|
12279 12764 | .header("Content-Type", "application/x-amz-json-1.1")
|
12280 12765 | .header("X-Amz-Target", "JsonProtocol.EmptyOperation")
|
12281 - | .body(::aws_smithy_http_server::body::Body::from(
|
12282 - | ::bytes::Bytes::copy_from_slice(&::aws_smithy_protocol_test::decode_body_data(
|
12766 + | .body(::aws_smithy_http_server::body::boxed(
|
12767 + | ::http_body_util::Full::new(::bytes::Bytes::copy_from_slice(
|
12768 + | &::aws_smithy_protocol_test::decode_body_data(
|
12283 12769 | "".as_bytes(),
|
12284 12770 | ::aws_smithy_protocol_test::MediaType::from("unknown"),
|
12771 + | ),
|
12285 12772 | )),
|
12286 12773 | ))
|
12287 12774 | .unwrap();
|
12288 12775 | #[allow(unused_mut)]
|
12289 12776 | let (sender, mut receiver) = ::tokio::sync::mpsc::channel(1);
|
12290 12777 | let config = crate::service::JsonProtocolConfig::builder().build();
|
12291 - | let service = crate::service::JsonProtocol::builder::<::hyper::body::Body, _, _, _>(config)
|
12778 + | let service = crate::service::JsonProtocol::builder::<
|
12779 + | ::aws_smithy_http_server::body::BoxBody,
|
12780 + | _,
|
12781 + | _,
|
12782 + | _,
|
12783 + | >(config)
|
12292 12784 | .empty_operation(move |input: crate::input::EmptyOperationInput| {
|
12293 12785 | let sender = sender.clone();
|
12294 12786 | async move {
|
12295 12787 | let result = {
|
12296 12788 | let expected = crate::input::EmptyOperationInput {};
|
12297 12789 | ::pretty_assertions::assert_eq!(input, expected);
|
12298 12790 | let output = crate::output::EmptyOperationOutput {};
|
12299 12791 | output
|
12300 12792 | };
|
12301 12793 | sender.send(()).await.expect("receiver dropped early");
|
12302 12794 | result
|
12303 12795 | }
|
12304 12796 | })
|
12305 12797 | .build_unchecked();
|
12306 12798 | let http_response = ::tower::ServiceExt::oneshot(service, http_request)
|
12307 12799 | .await
|
12308 12800 | .expect("unable to make an HTTP request");
|
12309 12801 | assert!(
|
12310 12802 | receiver.recv().await.is_some(),
|
12311 12803 | "we expected operation handler to be invoked but it was not entered"
|
12312 12804 | );
|
12313 12805 | }
|
12314 12806 |
|
12315 12807 | /// When no output is defined, the service is expected to return
|
12316 12808 | /// an empty payload. Despite the lack of a payload, the service
|
12317 12809 | /// is expected to always send a Content-Type header. Clients must
|
12318 12810 | /// handle cases where a service returns a JSON object and where
|
12319 12811 | /// a service returns no JSON at all.
|
12320 12812 | /// Test ID: json_1_1_service_responds_with_no_payload
|
12321 12813 | #[::tokio::test]
|
12322 12814 | #[::tracing_test::traced_test]
|
12323 12815 | async fn json_1_1_service_responds_with_no_payload_response() {
|
12324 12816 | let output = crate::output::EmptyOperationOutput {};
|
12325 12817 | use ::aws_smithy_http_server::response::IntoResponse;
|
12326 12818 | let http_response = output.into_response();
|
12327 12819 | ::pretty_assertions::assert_eq!(
|
12328 - | http::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12820 + | ::http_1x::StatusCode::from_u16(200).expect("invalid expected HTTP status code"),
|
12329 12821 | http_response.status()
|
12330 12822 | );
|
12331 12823 | let expected_headers = [("Content-Type", "application/x-amz-json-1.1")];
|
12332 12824 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(
|
12333 12825 | http_response.headers(),
|
12334 12826 | expected_headers,
|
12335 12827 | ));
|
12336 - | let body = ::hyper::body::to_bytes(http_response.into_body())
|
12828 + | use ::http_body_util::BodyExt;
|
12829 + | let body = http_response
|
12830 + | .into_body()
|
12831 + | .collect()
|
12337 12832 | .await
|
12338 - | .expect("unable to extract body to bytes");
|
12833 + | .expect("unable to collect body")
|
12834 + | .to_bytes();
|
12339 12835 | // No body.
|
12340 12836 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
12341 12837 | }
|
12342 12838 | }
|