276 276 | .set_force_path_style(cfg.load::<crate::config::ForcePathStyle>().map(|ty| ty.0))
|
277 277 | .set_use_arn_region(cfg.load::<crate::config::UseArnRegion>().map(|ty| ty.0))
|
278 278 | .set_disable_multi_region_access_points(cfg.load::<crate::config::DisableMultiRegionAccessPoints>().map(|ty| ty.0))
|
279 279 | .set_accelerate(cfg.load::<crate::config::Accelerate>().map(|ty| ty.0))
|
280 280 | .set_disable_s3_express_session_auth(cfg.load::<crate::config::DisableS3ExpressSessionAuth>().map(|ty| ty.0))
|
281 281 | .set_bucket(Some(
|
282 282 | _input
|
283 283 | .bucket
|
284 284 | .clone()
|
285 285 | .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
|
286 286 | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("bucket", "A required field was not set"))?,
|
287 287 | ))
|
288 288 | .set_key(Some(
|
289 289 | _input
|
290 290 | .key
|
291 291 | .clone()
|
292 292 | .filter(|f| !AsRef::<str>::as_ref(f).trim().is_empty())
|
293 293 | .ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("key", "A required field was not set"))?,
|
294 294 | ))
|
295 295 | .build()
|
296 296 | .map_err(|err| {
|
297 297 | ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err)
|
298 298 | })?;
|
299 299 | cfg.interceptor_state()
|
300 300 | .store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params));
|
301 301 | ::std::result::Result::Ok(())
|
302 302 | }
|
303 303 | }
|
304 304 | #[allow(unreachable_code, unused_variables)]
|
305 305 | #[cfg(test)]
|
306 - | mod put_object_request_test {
|
306 + | mod put_object_test {
|
307 + |
|
307 308 | /// This test validates that if a content-type is specified, that only one content-type header is sent
|
308 309 | /// Test ID: DontSendDuplicateContentType
|
309 310 | #[::tokio::test]
|
310 - | #[allow(unused_mut)]
|
311 + | #[::tracing_test::traced_test]
|
311 312 | async fn dont_send_duplicate_content_type_request() {
|
312 313 | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
313 314 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
314 315 | let config_builder = config_builder.region(::aws_types::region::Region::new("us-east-1"));
|
315 316 | let mut config_builder = config_builder;
|
316 317 | config_builder.set_region(Some(crate::config::Region::new("us-east-1")));
|
317 318 |
|
318 319 | let config = config_builder.http_client(http_client).build();
|
319 320 | let client = crate::Client::from_conf(config);
|
320 321 | let result = client
|
321 322 | .put_object()
|
322 323 | .set_bucket(::std::option::Option::Some("test-bucket".to_owned()))
|
323 324 | .set_key(::std::option::Option::Some("test-key".to_owned()))
|
324 325 | .set_content_type(::std::option::Option::Some("text/html".to_owned()))
|
325 326 | .send()
|
326 327 | .await;
|
327 328 | let _ = dbg!(result);
|
328 329 | let http_request = request_receiver.expect_request();
|
329 330 | let expected_headers = [("content-type", "text/html")];
|
330 331 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
331 332 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
332 333 | ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
|
333 334 | ::pretty_assertions::assert_eq!(uri.path(), "/test-key", "path was incorrect");
|
334 335 | }
|
335 336 | /// This test validates that if a content-length is specified, that only one content-length header is sent
|
336 337 | /// Test ID: DontSendDuplicateContentLength
|
337 338 | #[::tokio::test]
|
338 - | #[allow(unused_mut)]
|
339 + | #[::tracing_test::traced_test]
|
339 340 | async fn dont_send_duplicate_content_length_request() {
|
340 341 | let (http_client, request_receiver) = ::aws_smithy_runtime::client::http::test_util::capture_request(None);
|
341 342 | let config_builder = crate::config::Config::builder().with_test_defaults().endpoint_url("https://example.com");
|
342 343 | let config_builder = config_builder.region(::aws_types::region::Region::new("us-east-1"));
|
343 344 | let mut config_builder = config_builder;
|
344 345 | config_builder.set_region(Some(crate::config::Region::new("us-east-1")));
|
345 346 |
|
346 347 | let config = config_builder.http_client(http_client).build();
|
347 348 | let client = crate::Client::from_conf(config);
|
348 349 | let result = client
|
349 350 | .put_object()
|
350 351 | .set_bucket(::std::option::Option::Some("test-bucket".to_owned()))
|
351 352 | .set_key(::std::option::Option::Some("test-key".to_owned()))
|
352 353 | .set_content_length(::std::option::Option::Some(2))
|
353 354 | .set_body(::std::option::Option::Some(::aws_smithy_types::byte_stream::ByteStream::from_static(
|
354 355 | b"ab",
|
355 356 | )))
|
356 357 | .send()
|
357 358 | .await;
|
358 359 | let _ = dbg!(result);
|
359 360 | let http_request = request_receiver.expect_request();
|
360 361 | let expected_headers = [("content-length", "2")];
|
361 362 | ::aws_smithy_protocol_test::assert_ok(::aws_smithy_protocol_test::validate_headers(http_request.headers(), expected_headers));
|
362 363 | let uri: ::http::Uri = http_request.uri().parse().expect("invalid URI sent");
|
363 364 | ::pretty_assertions::assert_eq!(http_request.method(), "PUT", "method was incorrect");
|
364 365 | ::pretty_assertions::assert_eq!(uri.path(), "/test-key", "path was incorrect");
|
365 366 | }
|
366 367 | }
|
367 368 |
|
368 369 | /// Error type for the `PutObjectError` operation.
|