226 226 | #[allow(unreachable_code, unused_variables)]
|
227 227 | #[cfg(test)]
|
228 228 | mod input_and_output_with_headers_test {
|
229 229 | use ::aws_smithy_protocol_test::FloatEquals;
|
230 230 |
|
231 231 | /// Tests requests with string header bindings
|
232 232 | /// Test ID: RestJsonInputAndOutputWithStringHeaders
|
233 233 | #[::tokio::test]
|
234 234 | #[::tracing_test::traced_test]
|
235 235 | async fn rest_json_input_and_output_with_string_headers_request() {
|
236 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
236 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
237 237 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
238 238 |
|
239 239 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
240 240 | let result = client
|
241 241 | .input_and_output_with_headers()
|
242 242 | .set_header_string(::std::option::Option::Some("Hello".to_owned()))
|
243 243 | .set_header_string_list(::std::option::Option::Some(vec!["a".to_owned(), "b".to_owned(), "c".to_owned()]))
|
244 244 | .set_header_string_set(::std::option::Option::Some(vec!["a".to_owned(), "b".to_owned(), "c".to_owned()]))
|
245 245 | .send()
|
246 246 | .await;
|
247 247 | let _ = dbg!(result);
|
248 248 | let http_request = request_receiver.expect_request();
|
249 249 | let expected_headers = [("X-String", "Hello"), ("X-StringList", "a, b, c"), ("X-StringSet", "a, b, c")];
|
250 250 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
251 251 | let body = http_request.body().bytes().expect("body should be strict");
|
252 252 | // No body.
|
253 253 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
254 254 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
255 255 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
256 256 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
257 257 | }
|
258 258 |
|
259 259 | /// Tests requests with string list header bindings that require quoting
|
260 260 | /// Test ID: RestJsonInputAndOutputWithQuotedStringHeaders
|
261 261 | #[::tokio::test]
|
262 262 | #[::tracing_test::traced_test]
|
263 263 | async fn rest_json_input_and_output_with_quoted_string_headers_request() {
|
264 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
264 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
265 265 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
266 266 |
|
267 267 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
268 268 | let result = client
|
269 269 | .input_and_output_with_headers()
|
270 270 | .set_header_string_list(::std::option::Option::Some(vec!["b,c".to_owned(), "\"def\"".to_owned(), "a".to_owned()]))
|
271 271 | .send()
|
272 272 | .await;
|
273 273 | let _ = dbg!(result);
|
274 274 | let http_request = request_receiver.expect_request();
|
275 275 | let expected_headers = [("X-StringList", "\"b,c\", \"\\\"def\\\"\", a")];
|
276 276 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
277 277 | let body = http_request.body().bytes().expect("body should be strict");
|
278 278 | // No body.
|
279 279 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
280 280 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
281 281 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
282 282 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
283 283 | }
|
284 284 |
|
285 285 | /// Tests requests with numeric header bindings
|
286 286 | /// Test ID: RestJsonInputAndOutputWithNumericHeaders
|
287 287 | #[::tokio::test]
|
288 288 | #[::tracing_test::traced_test]
|
289 289 | async fn rest_json_input_and_output_with_numeric_headers_request() {
|
290 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
290 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
291 291 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
292 292 |
|
293 293 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
294 294 | let result = client
|
295 295 | .input_and_output_with_headers()
|
296 296 | .set_header_byte(::std::option::Option::Some(1))
|
297 297 | .set_header_short(::std::option::Option::Some(123))
|
298 298 | .set_header_integer(::std::option::Option::Some(123))
|
299 299 | .set_header_long(::std::option::Option::Some(123))
|
300 300 | .set_header_float(::std::option::Option::Some(1.1_f32))
|
301 301 | .set_header_double(::std::option::Option::Some(1.1_f64))
|
302 302 | .set_header_integer_list(::std::option::Option::Some(vec![1, 2, 3]))
|
303 303 | .send()
|
304 304 | .await;
|
305 305 | let _ = dbg!(result);
|
306 306 | let http_request = request_receiver.expect_request();
|
307 307 | let expected_headers = [
|
308 308 | ("X-Byte", "1"),
|
309 309 | ("X-Double", "1.1"),
|
310 310 | ("X-Float", "1.1"),
|
311 311 | ("X-Integer", "123"),
|
312 312 | ("X-IntegerList", "1, 2, 3"),
|
313 313 | ("X-Long", "123"),
|
314 314 | ("X-Short", "123"),
|
315 315 | ];
|
316 316 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
317 317 | let body = http_request.body().bytes().expect("body should be strict");
|
318 318 | // No body.
|
319 319 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
320 320 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
321 321 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
322 322 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
323 323 | }
|
324 324 |
|
325 325 | /// Tests requests with boolean header bindings
|
326 326 | /// Test ID: RestJsonInputAndOutputWithBooleanHeaders
|
327 327 | #[::tokio::test]
|
328 328 | #[::tracing_test::traced_test]
|
329 329 | async fn rest_json_input_and_output_with_boolean_headers_request() {
|
330 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
330 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
331 331 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
332 332 |
|
333 333 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
334 334 | let result = client
|
335 335 | .input_and_output_with_headers()
|
336 336 | .set_header_true_bool(::std::option::Option::Some(true))
|
337 337 | .set_header_false_bool(::std::option::Option::Some(false))
|
338 338 | .set_header_boolean_list(::std::option::Option::Some(vec![true, false, true]))
|
339 339 | .send()
|
340 340 | .await;
|
341 341 | let _ = dbg!(result);
|
342 342 | let http_request = request_receiver.expect_request();
|
343 343 | let expected_headers = [("X-Boolean1", "true"), ("X-Boolean2", "false"), ("X-BooleanList", "true, false, true")];
|
344 344 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
345 345 | let body = http_request.body().bytes().expect("body should be strict");
|
346 346 | // No body.
|
347 347 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
348 348 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
349 349 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
350 350 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
351 351 | }
|
352 352 |
|
353 353 | /// Tests requests with timestamp header bindings
|
354 354 | /// Test ID: RestJsonInputAndOutputWithTimestampHeaders
|
355 355 | #[::tokio::test]
|
356 356 | #[::tracing_test::traced_test]
|
357 357 | async fn rest_json_input_and_output_with_timestamp_headers_request() {
|
358 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
358 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
359 359 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
360 360 |
|
361 361 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
362 362 | let result = client
|
363 363 | .input_and_output_with_headers()
|
364 364 | .set_header_timestamp_list(::std::option::Option::Some(vec![
|
365 365 | ::aws_smithy_types::DateTime::from_fractional_secs(1576540098, 0_f64),
|
366 366 | ::aws_smithy_types::DateTime::from_fractional_secs(1576540098, 0_f64),
|
367 367 | ]))
|
368 368 | .send()
|
369 369 | .await;
|
370 370 | let _ = dbg!(result);
|
371 371 | let http_request = request_receiver.expect_request();
|
372 372 | let expected_headers = [("X-TimestampList", "Mon, 16 Dec 2019 23:48:18 GMT, Mon, 16 Dec 2019 23:48:18 GMT")];
|
373 373 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
374 374 | let body = http_request.body().bytes().expect("body should be strict");
|
375 375 | // No body.
|
376 376 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
377 377 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
378 378 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
379 379 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
380 380 | }
|
381 381 |
|
382 382 | /// Tests requests with enum header bindings
|
383 383 | /// Test ID: RestJsonInputAndOutputWithEnumHeaders
|
384 384 | #[::tokio::test]
|
385 385 | #[::tracing_test::traced_test]
|
386 386 | async fn rest_json_input_and_output_with_enum_headers_request() {
|
387 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
387 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
388 388 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
389 389 |
|
390 390 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
391 391 | let result = client
|
392 392 | .input_and_output_with_headers()
|
393 393 | .set_header_enum(::std::option::Option::Some(
|
394 394 | "Foo".parse::<crate::types::FooEnum>().expect("static value validated to member"),
|
395 395 | ))
|
396 396 | .set_header_enum_list(::std::option::Option::Some(vec![
|
397 397 | "Foo".parse::<crate::types::FooEnum>().expect("static value validated to member"),
|
398 398 | "Bar".parse::<crate::types::FooEnum>().expect("static value validated to member"),
|
399 399 | "Baz".parse::<crate::types::FooEnum>().expect("static value validated to member"),
|
400 400 | ]))
|
401 401 | .send()
|
402 402 | .await;
|
403 403 | let _ = dbg!(result);
|
404 404 | let http_request = request_receiver.expect_request();
|
405 405 | let expected_headers = [("X-Enum", "Foo"), ("X-EnumList", "Foo, Bar, Baz")];
|
406 406 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
407 407 | let body = http_request.body().bytes().expect("body should be strict");
|
408 408 | // No body.
|
409 409 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
410 410 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
411 411 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
412 412 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
413 413 | }
|
414 414 |
|
415 415 | /// Tests requests with intEnum header bindings
|
416 416 | /// Test ID: RestJsonInputAndOutputWithIntEnumHeaders
|
417 417 | #[::tokio::test]
|
418 418 | #[::tracing_test::traced_test]
|
419 419 | async fn rest_json_input_and_output_with_int_enum_headers_request() {
|
420 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
420 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
421 421 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
422 422 |
|
423 423 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
424 424 | let result = client
|
425 425 | .input_and_output_with_headers()
|
426 426 | .set_header_integer_enum(::std::option::Option::Some(1))
|
427 427 | .set_header_integer_enum_list(::std::option::Option::Some(vec![1, 2, 3]))
|
428 428 | .send()
|
429 429 | .await;
|
430 430 | let _ = dbg!(result);
|
431 431 | let http_request = request_receiver.expect_request();
|
432 432 | let expected_headers = [("X-IntegerEnum", "1"), ("X-IntegerEnumList", "1, 2, 3")];
|
433 433 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
434 434 | let body = http_request.body().bytes().expect("body should be strict");
|
435 435 | // No body.
|
436 436 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
437 437 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
438 438 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
439 439 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
440 440 | }
|
441 441 |
|
442 442 | /// Supports handling NaN float header values.
|
443 443 | /// Test ID: RestJsonSupportsNaNFloatHeaderInputs
|
444 444 | #[::tokio::test]
|
445 445 | #[::tracing_test::traced_test]
|
446 446 | async fn rest_json_supports_na_n_float_header_inputs_request() {
|
447 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
447 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
448 448 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
449 449 |
|
450 450 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
451 451 | let result = client
|
452 452 | .input_and_output_with_headers()
|
453 453 | .set_header_float(::std::option::Option::Some(
|
454 454 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
|
455 455 | ))
|
456 456 | .set_header_double(::std::option::Option::Some(
|
457 457 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
|
458 458 | ))
|
459 459 | .send()
|
460 460 | .await;
|
461 461 | let _ = dbg!(result);
|
462 462 | let http_request = request_receiver.expect_request();
|
463 463 | let expected_headers = [("X-Double", "NaN"), ("X-Float", "NaN")];
|
464 464 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
465 465 | let body = http_request.body().bytes().expect("body should be strict");
|
466 466 | // No body.
|
467 467 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
468 468 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
469 469 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
470 470 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
471 471 | }
|
472 472 |
|
473 473 | /// Supports handling Infinity float header values.
|
474 474 | /// Test ID: RestJsonSupportsInfinityFloatHeaderInputs
|
475 475 | #[::tokio::test]
|
476 476 | #[::tracing_test::traced_test]
|
477 477 | async fn rest_json_supports_infinity_float_header_inputs_request() {
|
478 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
478 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
479 479 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
480 480 |
|
481 481 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
482 482 | let result = client
|
483 483 | .input_and_output_with_headers()
|
484 484 | .set_header_float(::std::option::Option::Some(
|
485 485 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number"),
|
486 486 | ))
|
487 487 | .set_header_double(::std::option::Option::Some(
|
488 488 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number"),
|
489 489 | ))
|
490 490 | .send()
|
491 491 | .await;
|
492 492 | let _ = dbg!(result);
|
493 493 | let http_request = request_receiver.expect_request();
|
494 494 | let expected_headers = [("X-Double", "Infinity"), ("X-Float", "Infinity")];
|
495 495 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
496 496 | let body = http_request.body().bytes().expect("body should be strict");
|
497 497 | // No body.
|
498 498 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
499 499 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
500 500 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
501 501 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
502 502 | }
|
503 503 |
|
504 504 | /// Supports handling -Infinity float header values.
|
505 505 | /// Test ID: RestJsonSupportsNegativeInfinityFloatHeaderInputs
|
506 506 | #[::tokio::test]
|
507 507 | #[::tracing_test::traced_test]
|
508 508 | async fn rest_json_supports_negative_infinity_float_header_inputs_request() {
|
509 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
509 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
510 510 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
511 511 |
|
512 512 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
513 513 | let result = client
|
514 514 | .input_and_output_with_headers()
|
515 515 | .set_header_float(::std::option::Option::Some(
|
516 516 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number"),
|
517 517 | ))
|
518 518 | .set_header_double(::std::option::Option::Some(
|
519 519 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number"),
|