diff --git a/aws/rust-runtime/aws-inlineable/src/presigning.rs b/aws/rust-runtime/aws-inlineable/src/presigning.rs index 3829e6b968..76adace263 100644 --- a/aws/rust-runtime/aws-inlineable/src/presigning.rs +++ b/aws/rust-runtime/aws-inlineable/src/presigning.rs @@ -13,7 +13,6 @@ //! Only operations that support presigning have the `presigned()` method on them. use aws_smithy_runtime_api::box_error::BoxError; -use aws_smithy_runtime_api::client::http::request::Headers; use aws_smithy_runtime_api::client::orchestrator::HttpRequest; use std::fmt; use std::time::{Duration, SystemTime}; @@ -195,8 +194,8 @@ impl PresignedRequest { /// Returns any HTTP headers that need to go along with the request, except for `Host`, /// which should be sent based on the endpoint in the URI by the HTTP client rather than /// added directly. - pub fn headers(&self) -> &Headers { - self.0.headers() + pub fn headers(&self) -> impl Iterator { + self.0.headers().iter() } /// Given a body, convert this `PresignedRequest` into an `http::Request` @@ -210,22 +209,7 @@ impl fmt::Debug for PresignedRequest { f.debug_struct("PresignedRequest") .field("method", &self.method()) .field("uri", &self.uri()) - .field("headers", self.headers()) + .field("headers", self.0.headers()) .finish() } } - -/* -impl From for http::request::Builder { - fn from(req: PresignedRequest) -> Self { - let mut builder = http::request::Builder::new() - .uri(req.uri()) - .method(req.method()); - - if let Some(headers) = builder.headers_mut() { - *headers = req.headers().clone(); - } - - builder - } -}*/ diff --git a/aws/sdk/integration-tests/polly/tests/presigning.rs b/aws/sdk/integration-tests/polly/tests/presigning.rs index 790a23c6c7..f6841b932a 100644 --- a/aws/sdk/integration-tests/polly/tests/presigning.rs +++ b/aws/sdk/integration-tests/polly/tests/presigning.rs @@ -56,5 +56,5 @@ async fn test_presigning() { ][..], &query_params ); - assert!(presigned.headers().is_empty()); + assert_eq!(presigned.headers().count(), 0); } diff --git a/aws/sdk/integration-tests/s3/tests/presigning.rs b/aws/sdk/integration-tests/s3/tests/presigning.rs index b97c9480fb..768dd563bb 100644 --- a/aws/sdk/integration-tests/s3/tests/presigning.rs +++ b/aws/sdk/integration-tests/s3/tests/presigning.rs @@ -4,6 +4,7 @@ */ use aws_sdk_s3 as s3; +use std::collections::HashMap; use futures_util::future::FutureExt; use futures_util::Future; @@ -99,7 +100,7 @@ async fn test_presigning() { ][..], &query_params ); - assert!(presigned.headers().is_empty()); + assert_eq!(presigned.headers().count(), 0); } #[tokio::test] @@ -140,13 +141,14 @@ async fn test_presigning_with_payload_headers() { ][..], &query_params ); + let headers = presigned.headers().collect::>(); assert_eq!( - presigned.headers().get(CONTENT_TYPE), - Some("application/x-test") + headers.get(CONTENT_TYPE.as_str()), + Some(&"application/x-test") ); - assert_eq!(presigned.headers().get(CONTENT_LENGTH), Some("12345")); - assert_eq!(presigned.headers().iter().count(), 2); + assert_eq!(headers.get(CONTENT_LENGTH.as_str()), Some(&"12345")); + assert_eq!(headers.len(), 2); } #[tokio::test] diff --git a/examples/pokemon-service-common/src/lib.rs b/examples/pokemon-service-common/src/lib.rs index 54503d4d61..c4c8bc4e75 100644 --- a/examples/pokemon-service-common/src/lib.rs +++ b/examples/pokemon-service-common/src/lib.rs @@ -334,7 +334,7 @@ pub async fn stream_pokemon_radio( .body(SdkBody::empty()) .unwrap() .try_into() - .uwrap(), + .unwrap(), ) .await .unwrap();