239 239 | mod http_prefix_headers_test {
|
240 240 |
|
241 241 | /// Adds headers by prefix
|
242 242 | /// Test ID: HttpPrefixHeadersArePresent
|
243 243 | #[::tokio::test]
|
244 244 | #[::tracing_test::traced_test]
|
245 245 | async fn http_prefix_headers_are_present_request() {
|
246 246 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
247 247 | let config_builder = crate::config::Config::builder()
|
248 248 | .with_test_defaults()
|
249 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
249 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
250 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
251 + | .allow_no_auth()
|
250 252 | .endpoint_url("https://example.com");
|
251 253 |
|
252 254 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
253 255 | let result = client
|
254 256 | .http_prefix_headers()
|
255 257 | .set_foo(::std::option::Option::Some("Foo".to_owned()))
|
256 258 | .set_foo_map(::std::option::Option::Some({
|
257 259 | let mut ret = ::std::collections::HashMap::new();
|
258 260 | ret.insert("abc".to_owned().to_ascii_lowercase(), "Abc value".to_owned());
|
259 261 | ret.insert("def".to_owned().to_ascii_lowercase(), "Def value".to_owned());
|
260 262 | ret
|
261 263 | }))
|
262 264 | .send()
|
263 265 | .await;
|
264 266 | let _ = dbg!(result);
|
265 267 | let http_request = request_receiver.expect_request();
|
266 268 | let expected_headers = [("x-foo", "Foo"), ("x-foo-abc", "Abc value"), ("x-foo-def", "Def value")];
|
267 269 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
268 270 | let body = http_request.body().bytes().expect("body should be strict");
|
269 271 | // No body.
|
270 272 | ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
|
271 273 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
272 274 | ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
|
273 275 | ::pretty_assertions::assert_eq!(uri.path(), "/HttpPrefixHeaders", "path was incorrect");
|
274 276 | }
|
275 277 |
|
276 278 | /// No prefix headers are serialized because the value is not present
|
277 279 | /// Test ID: HttpPrefixHeadersAreNotPresent
|
278 280 | #[::tokio::test]
|
279 281 | #[::tracing_test::traced_test]
|
280 282 | async fn http_prefix_headers_are_not_present_request() {
|
281 283 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
282 284 | let config_builder = crate::config::Config::builder()
|
283 285 | .with_test_defaults()
|
284 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
286 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
287 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
288 + | .allow_no_auth()
|
285 289 | .endpoint_url("https://example.com");
|
286 290 |
|
287 291 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
288 292 | let result = client
|
289 293 | .http_prefix_headers()
|
290 294 | .set_foo(::std::option::Option::Some("Foo".to_owned()))
|
291 295 | .set_foo_map(::std::option::Option::Some(::std::collections::HashMap::new()))
|
292 296 | .send()
|
293 297 | .await;
|
294 298 | let _ = dbg!(result);
|
295 299 | let http_request = request_receiver.expect_request();
|
296 300 | let expected_headers = [("x-foo", "Foo")];
|
297 301 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
298 302 | let body = http_request.body().bytes().expect("body should be strict");
|
299 303 | // No body.
|
300 304 | ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
|
301 305 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
302 306 | ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
|
303 307 | ::pretty_assertions::assert_eq!(uri.path(), "/HttpPrefixHeaders", "path was incorrect");
|
304 308 | }
|
305 309 |
|
306 310 | /// Serialize prefix headers were the value is present but empty
|
307 311 | /// Test ID: HttpPrefixEmptyHeaders
|
308 312 | #[::tokio::test]
|
309 313 | #[::tracing_test::traced_test]
|
310 314 | async fn http_prefix_empty_headers_request() {
|
311 315 | let (http_client, request_receiver) = ::aws_smithy_http_client::test_util::capture_request(None);
|
312 316 | let config_builder = crate::config::Config::builder()
|
313 317 | .with_test_defaults()
|
314 - | .auth_scheme_resolver(crate::config::auth::NoAuthSchemeResolver)
|
318 + | // TODO(https://github.com/smithy-lang/smithy-rs/issues/4177):
|
319 + | // Until the incorrect separation is addressed, we need to rely on this workaround.
|
320 + | .allow_no_auth()
|
315 321 | .endpoint_url("https://example.com");
|
316 322 |
|
317 323 | let client = crate::Client::from_conf(config_builder.http_client(http_client).build());
|
318 324 | let result = client
|
319 325 | .http_prefix_headers()
|
320 326 | .set_foo_map(::std::option::Option::Some({
|
321 327 | let mut ret = ::std::collections::HashMap::new();
|
322 328 | ret.insert("abc".to_owned().to_ascii_lowercase(), "".to_owned());
|
323 329 | ret
|
324 330 | }))
|
325 331 | .send()
|
326 332 | .await;
|
327 333 | let _ = dbg!(result);
|
328 334 | let http_request = request_receiver.expect_request();
|
329 335 | let expected_headers = [("x-foo-abc", "")];
|
330 336 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
331 337 | let body = http_request.body().bytes().expect("body should be strict");
|
332 338 | // No body.
|
333 339 | ::pretty_assertions::assert_eq!(&body, &::bytes::Bytes::new());
|
334 340 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
335 341 | ::pretty_assertions::assert_eq!(http_request.method(), "GET", "method was incorrect");
|
336 342 | ::pretty_assertions::assert_eq!(uri.path(), "/HttpPrefixHeaders", "path was incorrect");
|
337 343 | }
|
338 344 |
|
339 345 | /// Adds headers by prefix
|
340 346 | /// Test ID: HttpPrefixHeadersArePresent
|
341 347 | #[::tokio::test]
|
342 348 | #[::tracing_test::traced_test]
|
343 349 | async fn http_prefix_headers_are_present_response() {
|
344 350 | let expected_output = crate::operation::http_prefix_headers::HttpPrefixHeadersOutput::builder()
|