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: InputAndOutputWithStringHeaders
|
233 233 | #[::tokio::test]
|
234 234 | #[::tracing_test::traced_test]
|
235 235 | async fn 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 numeric header bindings
|
260 260 | /// Test ID: InputAndOutputWithNumericHeaders
|
261 261 | #[::tokio::test]
|
262 262 | #[::tracing_test::traced_test]
|
263 263 | async fn input_and_output_with_numeric_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_byte(::std::option::Option::Some(1))
|
271 271 | .set_header_short(::std::option::Option::Some(123))
|
272 272 | .set_header_integer(::std::option::Option::Some(123))
|
273 273 | .set_header_long(::std::option::Option::Some(123))
|
274 274 | .set_header_float(::std::option::Option::Some(1.1_f32))
|
275 275 | .set_header_double(::std::option::Option::Some(1.1_f64))
|
276 276 | .set_header_integer_list(::std::option::Option::Some(vec![1, 2, 3]))
|
277 277 | .send()
|
278 278 | .await;
|
279 279 | let _ = dbg!(result);
|
280 280 | let http_request = request_receiver.expect_request();
|
281 281 | let expected_headers = [
|
282 282 | ("X-Byte", "1"),
|
283 283 | ("X-Double", "1.1"),
|
284 284 | ("X-Float", "1.1"),
|
285 285 | ("X-Integer", "123"),
|
286 286 | ("X-IntegerList", "1, 2, 3"),
|
287 287 | ("X-Long", "123"),
|
288 288 | ("X-Short", "123"),
|
289 289 | ];
|
290 290 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
291 291 | let body = http_request.body().bytes().expect("body should be strict");
|
292 292 | // No body.
|
293 293 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
294 294 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
295 295 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
296 296 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
297 297 | }
|
298 298 |
|
299 299 | /// Tests requests with boolean header bindings
|
300 300 | /// Test ID: InputAndOutputWithBooleanHeaders
|
301 301 | #[::tokio::test]
|
302 302 | #[::tracing_test::traced_test]
|
303 303 | async fn input_and_output_with_boolean_headers_request() {
|
304 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
304 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
305 305 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
306 306 |
|
307 307 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
308 308 | let result = client
|
309 309 | .input_and_output_with_headers()
|
310 310 | .set_header_true_bool(::std::option::Option::Some(true))
|
311 311 | .set_header_false_bool(::std::option::Option::Some(false))
|
312 312 | .set_header_boolean_list(::std::option::Option::Some(vec![true, false, true]))
|
313 313 | .send()
|
314 314 | .await;
|
315 315 | let _ = dbg!(result);
|
316 316 | let http_request = request_receiver.expect_request();
|
317 317 | let expected_headers = [("X-Boolean1", "true"), ("X-Boolean2", "false"), ("X-BooleanList", "true, false, true")];
|
318 318 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
319 319 | let body = http_request.body().bytes().expect("body should be strict");
|
320 320 | // No body.
|
321 321 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
322 322 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
323 323 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
324 324 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
325 325 | }
|
326 326 |
|
327 327 | /// Tests requests with timestamp header bindings
|
328 328 | /// Test ID: InputAndOutputWithTimestampHeaders
|
329 329 | #[::tokio::test]
|
330 330 | #[::tracing_test::traced_test]
|
331 331 | async fn input_and_output_with_timestamp_headers_request() {
|
332 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
332 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
333 333 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
334 334 |
|
335 335 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
336 336 | let result = client
|
337 337 | .input_and_output_with_headers()
|
338 338 | .set_header_timestamp_list(::std::option::Option::Some(vec![
|
339 339 | ::aws_smithy_types::DateTime::from_fractional_secs(1576540098, 0_f64),
|
340 340 | ::aws_smithy_types::DateTime::from_fractional_secs(1576540098, 0_f64),
|
341 341 | ]))
|
342 342 | .send()
|
343 343 | .await;
|
344 344 | let _ = dbg!(result);
|
345 345 | let http_request = request_receiver.expect_request();
|
346 346 | let expected_headers = [("X-TimestampList", "Mon, 16 Dec 2019 23:48:18 GMT, Mon, 16 Dec 2019 23:48:18 GMT")];
|
347 347 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
348 348 | let body = http_request.body().bytes().expect("body should be strict");
|
349 349 | // No body.
|
350 350 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
351 351 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
352 352 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
353 353 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
354 354 | }
|
355 355 |
|
356 356 | /// Tests requests with enum header bindings
|
357 357 | /// Test ID: InputAndOutputWithEnumHeaders
|
358 358 | #[::tokio::test]
|
359 359 | #[::tracing_test::traced_test]
|
360 360 | async fn input_and_output_with_enum_headers_request() {
|
361 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
361 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
362 362 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
363 363 |
|
364 364 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
365 365 | let result = client
|
366 366 | .input_and_output_with_headers()
|
367 367 | .set_header_enum(::std::option::Option::Some(
|
368 368 | "Foo".parse::<crate::types::FooEnum>().expect("static value validated to member"),
|
369 369 | ))
|
370 370 | .set_header_enum_list(::std::option::Option::Some(vec![
|
371 371 | "Foo".parse::<crate::types::FooEnum>().expect("static value validated to member"),
|
372 372 | "Bar".parse::<crate::types::FooEnum>().expect("static value validated to member"),
|
373 373 | "Baz".parse::<crate::types::FooEnum>().expect("static value validated to member"),
|
374 374 | ]))
|
375 375 | .send()
|
376 376 | .await;
|
377 377 | let _ = dbg!(result);
|
378 378 | let http_request = request_receiver.expect_request();
|
379 379 | let expected_headers = [("X-Enum", "Foo"), ("X-EnumList", "Foo, Bar, Baz")];
|
380 380 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
381 381 | let body = http_request.body().bytes().expect("body should be strict");
|
382 382 | // No body.
|
383 383 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
384 384 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
385 385 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
386 386 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
387 387 | }
|
388 388 |
|
389 389 | /// Supports handling NaN float header values.
|
390 390 | /// Test ID: RestXmlSupportsNaNFloatHeaderInputs
|
391 391 | #[::tokio::test]
|
392 392 | #[::tracing_test::traced_test]
|
393 393 | async fn rest_xml_supports_na_n_float_header_inputs_request() {
|
394 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
394 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
395 395 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
396 396 |
|
397 397 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
398 398 | let result = client
|
399 399 | .input_and_output_with_headers()
|
400 400 | .set_header_float(::std::option::Option::Some(
|
401 401 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
|
402 402 | ))
|
403 403 | .set_header_double(::std::option::Option::Some(
|
404 404 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("NaN").expect("invalid string for number"),
|
405 405 | ))
|
406 406 | .send()
|
407 407 | .await;
|
408 408 | let _ = dbg!(result);
|
409 409 | let http_request = request_receiver.expect_request();
|
410 410 | let expected_headers = [("X-Double", "NaN"), ("X-Float", "NaN")];
|
411 411 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
412 412 | let body = http_request.body().bytes().expect("body should be strict");
|
413 413 | // No body.
|
414 414 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
415 415 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
416 416 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
417 417 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
418 418 | }
|
419 419 |
|
420 420 | /// Supports handling Infinity float header values.
|
421 421 | /// Test ID: RestXmlSupportsInfinityFloatHeaderInputs
|
422 422 | #[::tokio::test]
|
423 423 | #[::tracing_test::traced_test]
|
424 424 | async fn rest_xml_supports_infinity_float_header_inputs_request() {
|
425 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
425 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
426 426 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
427 427 |
|
428 428 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
429 429 | let result = client
|
430 430 | .input_and_output_with_headers()
|
431 431 | .set_header_float(::std::option::Option::Some(
|
432 432 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number"),
|
433 433 | ))
|
434 434 | .set_header_double(::std::option::Option::Some(
|
435 435 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("Infinity").expect("invalid string for number"),
|
436 436 | ))
|
437 437 | .send()
|
438 438 | .await;
|
439 439 | let _ = dbg!(result);
|
440 440 | let http_request = request_receiver.expect_request();
|
441 441 | let expected_headers = [("X-Double", "Infinity"), ("X-Float", "Infinity")];
|
442 442 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
443 443 | let body = http_request.body().bytes().expect("body should be strict");
|
444 444 | // No body.
|
445 445 | ::pretty_assertions::assert_eq!(&body, &bytes::Bytes::new());
|
446 446 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
447 447 | ::pretty_assertions::assert_eq!(http_request.method(), "POST", "method was incorrect");
|
448 448 | ::pretty_assertions::assert_eq!(uri.path(), "/InputAndOutputWithHeaders", "path was incorrect");
|
449 449 | }
|
450 450 |
|
451 451 | /// Supports handling -Infinity float header values.
|
452 452 | /// Test ID: RestXmlSupportsNegativeInfinityFloatHeaderInputs
|
453 453 | #[::tokio::test]
|
454 454 | #[::tracing_test::traced_test]
|
455 455 | async fn rest_xml_supports_negative_infinity_float_header_inputs_request() {
|
456 - | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
456 + | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
457 457 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
458 458 |
|
459 459 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
460 460 | let result = client
|
461 461 | .input_and_output_with_headers()
|
462 462 | .set_header_float(::std::option::Option::Some(
|
463 463 | <f32 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number"),
|
464 464 | ))
|
465 465 | .set_header_double(::std::option::Option::Some(
|
466 466 | <f64 as ::aws_smithy_types::primitive::Parse>::parse_smithy_primitive("-Infinity").expect("invalid string for number"),
|