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