219 219 |
|
220 220 | #[allow(unreachable_code, unused_variables)]
|
221 221 | #[cfg(test)]
|
222 222 | mod http_prefix_headers_test {
|
223 223 |
|
224 224 | /// Adds headers by prefix
|
225 225 | /// Test ID: HttpPrefixHeadersArePresent
|
226 226 | #[::tokio::test]
|
227 227 | #[::tracing_test::traced_test]
|
228 228 | async fn http_prefix_headers_are_present_request() {
|
229 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
229 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
230 230 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
231 231 |
|
232 232 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
233 233 | let result = client
|
234 234 | .http_prefix_headers()
|
235 235 | .set_foo(::std::option::Option::Some("Foo".to_owned()))
|
236 236 | .set_foo_map(::std::option::Option::Some({
|
237 237 | let mut ret = ::std::collections::HashMap::new();
|
238 238 | ret.insert("Abc".to_owned().to_ascii_lowercase(), "Abc value".to_owned());
|
239 239 | ret.insert("Def".to_owned().to_ascii_lowercase(), "Def value".to_owned());
|
240 240 | ret
|
241 241 | }))
|
242 242 | .send()
|
243 243 | .await;
|
244 244 | let _ = dbg!(result);
|
245 245 | let http_request = request_receiver.expect_request();
|
246 246 | let expected_headers = [("X-Foo", "Foo"), ("X-Foo-Abc", "Abc value"), ("X-Foo-Def", "Def value")];
|
247 247 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
248 248 | let body = http_request.body().bytes().expect("body should be strict");
|
249 249 | // No body.
|
250 250 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
251 251 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
252 252 | ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
|
253 253 | ::pretty_assertions::assert_eq!(uri.path(), "/HttpPrefixHeaders", "path was incorrect");
|
254 254 | }
|
255 255 |
|
256 256 | /// No prefix headers are serialized because the value is not present
|
257 257 | /// Test ID: HttpPrefixHeadersAreNotPresent
|
258 258 | #[::tokio::test]
|
259 259 | #[::tracing_test::traced_test]
|
260 260 | async fn http_prefix_headers_are_not_present_request() {
|
261 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
261 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
262 262 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
263 263 |
|
264 264 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
265 265 | let result = client
|
266 266 | .http_prefix_headers()
|
267 267 | .set_foo(::std::option::Option::Some("Foo".to_owned()))
|
268 268 | .set_foo_map(::std::option::Option::Some(::std::collections::HashMap::new()))
|
269 269 | .send()
|
270 270 | .await;
|
271 271 | let _ = dbg!(result);
|
272 272 | let http_request = request_receiver.expect_request();
|
273 273 | let expected_headers = [("X-Foo", "Foo")];
|
274 274 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
275 275 | let body = http_request.body().bytes().expect("body should be strict");
|
276 276 | // No body.
|
277 277 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
278 278 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
279 279 | ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
|
280 280 | ::pretty_assertions::assert_eq!(uri.path(), "/HttpPrefixHeaders", "path was incorrect");
|
281 281 | }
|
282 282 |
|
283 283 | /// Serialize prefix headers were the value is present but empty
|
284 284 | /// Test ID: HttpPrefixEmptyHeaders
|
285 285 | #[::tokio::test]
|
286 286 | #[::tracing_test::traced_test]
|
287 287 | async fn http_prefix_empty_headers_request() {
|
288 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
288 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
289 289 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
290 290 |
|
291 291 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
292 292 | let result = client
|
293 293 | .http_prefix_headers()
|
294 294 | .set_foo_map(::std::option::Option::Some({
|
295 295 | let mut ret = ::std::collections::HashMap::new();
|
296 296 | ret.insert("Abc".to_owned().to_ascii_lowercase(), "".to_owned());
|
297 297 | ret
|
298 298 | }))
|
299 299 | .send()
|
300 300 | .await;
|
301 301 | let _ = dbg!(result);
|
302 302 | let http_request = request_receiver.expect_request();
|
303 303 | let expected_headers = [("X-Foo-Abc", "")];
|
304 304 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
305 305 | let body = http_request.body().bytes().expect("body should be strict");
|
306 306 | // No body.
|
307 307 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
308 308 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
309 309 | ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
|
310 310 | ::pretty_assertions::assert_eq!(uri.path(), "/HttpPrefixHeaders", "path was incorrect");
|
311 311 | }
|
312 312 |
|
313 313 | /// Adds headers by prefix
|
314 314 | /// Test ID: HttpPrefixHeadersArePresent
|
315 315 | #[::tokio::test]
|
316 316 | #[::tracing_test::traced_test]
|
317 317 | async fn http_prefix_headers_are_present_response() {
|
318 318 | let expected_output = crate::operation::http_prefix_headers::HttpPrefixHeadersOutput::builder()
|