240 240 | use ::aws_smithy_protocol_test::FloatEquals;
|
241 241 |
|
242 242 | /// Tests requests with string header bindings
|
243 243 | /// Test ID: InputAndOutputWithStringHeaders
|
244 244 | #[::tokio::test]
|
245 245 | #[::tracing_test::traced_test]
|
246 246 | async fn 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 numeric header bindings
|
274 276 | /// Test ID: InputAndOutputWithNumericHeaders
|
275 277 | #[::tokio::test]
|
276 278 | #[::tracing_test::traced_test]
|
277 279 | async fn input_and_output_with_numeric_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_byte(::std::option::Option::Some(1))
|
288 292 | .set_header_short(::std::option::Option::Some(123))
|
289 293 | .set_header_integer(::std::option::Option::Some(123))
|
290 294 | .set_header_long(::std::option::Option::Some(123))
|
291 295 | .set_header_float(::std::option::Option::Some(1.1_f32))
|
292 296 | .set_header_double(::std::option::Option::Some(1.1_f64))
|
293 297 | .set_header_integer_list(::std::option::Option::Some(vec![1, 2, 3]))
|
294 298 | .send()
|
295 299 | .await;
|
296 300 | let _ = dbg!(result);
|
297 301 | let http_request = request_receiver.expect_request();
|
298 302 | let expected_headers = [
|
299 303 | ("X-Byte", "1"),
|
300 304 | ("X-Double", "1.1"),
|
301 305 | ("X-Float", "1.1"),
|
302 306 | ("X-Integer", "123"),
|
303 307 | ("X-IntegerList", "1, 2, 3"),
|
304 308 | ("X-Long", "123"),
|
305 309 | ("X-Short", "123"),
|
306 310 | ];
|
307 311 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
308 312 | let body = http_request.body().bytes().expect("body should be strict");
|
309 313 | // No body.
|
310 314 | ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
|
311 315 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
312 316 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
313 317 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
314 318 | }
|
315 319 |
|
316 320 | /// Tests requests with boolean header bindings
|
317 321 | /// Test ID: InputAndOutputWithBooleanHeaders
|
318 322 | #[::tokio::test]
|
319 323 | #[::tracing_test::traced_test]
|
320 324 | async fn input_and_output_with_boolean_headers_request() {
|
321 325 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
322 326 | let config_builder = crate::config::Config::builder()
|
323 327 | .with_test_defaults()
|
324 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
328 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
329 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
330 + | .allow_no_auth()
|
325 331 | .endpoint_url("https://example.com");
|
326 332 |
|
327 333 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
328 334 | let result = client
|
329 335 | .input_and_output_with_headers()
|
330 336 | .set_header_true_bool(::std::option::Option::Some(true))
|
331 337 | .set_header_false_bool(::std::option::Option::Some(false))
|
332 338 | .set_header_boolean_list(::std::option::Option::Some(vec![true, false, true]))
|
333 339 | .send()
|
334 340 | .await;
|
335 341 | let _ = dbg!(result);
|
336 342 | let http_request = request_receiver.expect_request();
|
337 343 | let expected_headers = [("X-Boolean1", "true"), ("X-Boolean2", "false"), ("X-BooleanList", "true, false, true")];
|
338 344 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
339 345 | let body = http_request.body().bytes().expect("body should be strict");
|
340 346 | // No body.
|
341 347 | ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
|
342 348 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
343 349 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
344 350 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
345 351 | }
|
346 352 |
|
347 353 | /// Tests requests with timestamp header bindings
|
348 354 | /// Test ID: InputAndOutputWithTimestampHeaders
|
349 355 | #[::tokio::test]
|
350 356 | #[::tracing_test::traced_test]
|
351 357 | async fn input_and_output_with_timestamp_headers_request() {
|
352 358 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
353 359 | let config_builder = crate::config::Config::builder()
|
354 360 | .with_test_defaults()
|
355 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
361 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
362 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
363 + | .allow_no_auth()
|
356 364 | .endpoint_url("https://example.com");
|
357 365 |
|
358 366 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
359 367 | let result = client
|
360 368 | .input_and_output_with_headers()
|
361 369 | .set_header_timestamp_list(::std::option::Option::Some(vec![
|
362 370 | ::aws_smithy_types::DateTime::from_fractional_secs(1576540098, 0_f64),
|
363 371 | ::aws_smithy_types::DateTime::from_fractional_secs(1576540098, 0_f64),
|
364 372 | ]))
|
365 373 | .send()
|
366 374 | .await;
|
367 375 | let _ = dbg!(result);
|
368 376 | let http_request = request_receiver.expect_request();
|
369 377 | let expected_headers = [("X-TimestampList", "Mon, 16 Dec 2019 23:48:18 GMT, Mon, 16 Dec 2019 23:48:18 GMT")];
|
370 378 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
371 379 | let body = http_request.body().bytes().expect("body should be strict");
|
372 380 | // No body.
|
373 381 | ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
|
374 382 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
375 383 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
376 384 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
377 385 | }
|
378 386 |
|
379 387 | /// Tests requests with enum header bindings
|
380 388 | /// Test ID: InputAndOutputWithEnumHeaders
|
381 389 | #[::tokio::test]
|
382 390 | #[::tracing_test::traced_test]
|
383 391 | async fn input_and_output_with_enum_headers_request() {
|
384 392 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
385 393 | let config_builder = crate::config::Config::builder()
|
386 394 | .with_test_defaults()
|
387 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
395 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
396 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
397 + | .allow_no_auth()
|
388 398 | .endpoint_url("https://example.com");
|
389 399 |
|
390 400 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
391 401 | let result = client
|
392 402 | .input_and_output_with_headers()
|
393 403 | .set_header_enum(::std::option::Option::Some(
|
394 404 | "Foo".parse::<crate::types::FooEnum>().expect("static value validated to member"),
|
395 405 | ))
|
396 406 | .set_header_enum_list(::std::option::Option::Some(vec![
|
397 407 | "Foo".parse::<crate::types::FooEnum>().expect("static value validated to member"),
|
398 408 | "Bar".parse::<crate::types::FooEnum>().expect("static value validated to member"),
|
399 409 | "Baz".parse::<crate::types::FooEnum>().expect("static value validated to member"),
|
400 410 | ]))
|
401 411 | .send()
|
402 412 | .await;
|
403 413 | let _ = dbg!(result);
|
404 414 | let http_request = request_receiver.expect_request();
|
405 415 | let expected_headers = [("X-Enum", "Foo"), ("X-EnumList", "Foo, Bar, Baz")];
|
406 416 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
407 417 | let body = http_request.body().bytes().expect("body should be strict");
|
408 418 | // No body.
|
409 419 | ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
|
410 420 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
411 421 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
412 422 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
413 423 | }
|
414 424 |
|
415 425 | /// Supports handling NaN float header values.
|
416 426 | /// Test ID: RestXmlSupportsNaNFloatHeaderInputs
|
417 427 | #[::tokio::test]
|
418 428 | #[::tracing_test::traced_test]
|
419 429 | async fn rest_xml_supports_na_n_float_header_inputs_request() {
|
420 430 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
421 431 | let config_builder = crate::config::Config::builder()
|
422 432 | .with_test_defaults()
|
423 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
433 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
434 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
435 + | .allow_no_auth()
|
424 436 | .endpoint_url("https://example.com");
|
425 437 |
|
426 438 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
427 439 | let result = client
|
428 440 | .input_and_output_with_headers()
|
429 441 | .set_header_float(::std::option::Option::Some(
|
430 442 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
|
431 443 | ))
|
432 444 | .set_header_double(::std::option::Option::Some(
|
433 445 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
|
434 446 | ))
|
435 447 | .send()
|
436 448 | .await;
|
437 449 | let _ = dbg!(result);
|
438 450 | let http_request = request_receiver.expect_request();
|
439 451 | let expected_headers = [("X-Double", "NaN"), ("X-Float", "NaN")];
|
440 452 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
441 453 | let body = http_request.body().bytes().expect("body should be strict");
|
442 454 | // No body.
|
443 455 | ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
|
444 456 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
445 457 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
446 458 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
447 459 | }
|
448 460 |
|
449 461 | /// Supports handling Infinity float header values.
|
450 462 | /// Test ID: RestXmlSupportsInfinityFloatHeaderInputs
|
451 463 | #[::tokio::test]
|
452 464 | #[::tracing_test::traced_test]
|
453 465 | async fn rest_xml_supports_infinity_float_header_inputs_request() {
|
454 466 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
455 467 | let config_builder = crate::config::Config::builder()
|
456 468 | .with_test_defaults()
|
457 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
469 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
470 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
471 + | .allow_no_auth()
|
458 472 | .endpoint_url("https://example.com");
|
459 473 |
|
460 474 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
461 475 | let result = client
|
462 476 | .input_and_output_with_headers()
|
463 477 | .set_header_float(::std::option::Option::Some(
|
464 478 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number"),
|
465 479 | ))
|
466 480 | .set_header_double(::std::option::Option::Some(
|
467 481 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number"),
|
468 482 | ))
|
469 483 | .send()
|
470 484 | .await;
|
471 485 | let _ = dbg!(result);
|
472 486 | let http_request = request_receiver.expect_request();
|
473 487 | let expected_headers = [("X-Double", "Infinity"), ("X-Float", "Infinity")];
|
474 488 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
475 489 | let body = http_request.body().bytes().expect("body should be strict");
|
476 490 | // No body.
|
477 491 | ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
|
478 492 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
479 493 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
480 494 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
481 495 | }
|
482 496 |
|
483 497 | /// Supports handling -Infinity float header values.
|
484 498 | /// Test ID: RestXmlSupportsNegativeInfinityFloatHeaderInputs
|
485 499 | #[::tokio::test]
|
486 500 | #[::tracing_test::traced_test]
|
487 501 | async fn rest_xml_supports_negative_infinity_float_header_inputs_request() {
|
488 502 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
489 503 | let config_builder = crate::config::Config::builder()
|
490 504 | .with_test_defaults()
|
491 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
505 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
506 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
507 + | .allow_no_auth()
|
492 508 | .endpoint_url("https://example.com");
|
493 509 |
|
494 510 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
495 511 | let result = client
|
496 512 | .input_and_output_with_headers()
|
497 513 | .set_header_float(::std::option::Option::Some(
|
498 514 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number"),
|
499 515 | ))
|
500 516 | .set_header_double(::std::option::Option::Some(
|
501 517 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number"),
|