Skip to content

Commit

Permalink
Clear out external-types issue
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoh committed Oct 12, 2023
1 parent 336bb7e commit 0996ce6
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 26 deletions.
22 changes: 3 additions & 19 deletions aws/rust-runtime/aws-inlineable/src/presigning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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<Item = (&str, &str)> {
self.0.headers().iter()
}

/// Given a body, convert this `PresignedRequest` into an `http::Request`
Expand All @@ -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<PresignedRequest> 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
}
}*/
2 changes: 1 addition & 1 deletion aws/sdk/integration-tests/polly/tests/presigning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ async fn test_presigning() {
][..],
&query_params
);
assert!(presigned.headers().is_empty());
assert_eq!(presigned.headers().count(), 0);
}
12 changes: 7 additions & 5 deletions aws/sdk/integration-tests/s3/tests/presigning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

use aws_sdk_s3 as s3;
use std::collections::HashMap;

use futures_util::future::FutureExt;
use futures_util::Future;
Expand Down Expand Up @@ -99,7 +100,7 @@ async fn test_presigning() {
][..],
&query_params
);
assert!(presigned.headers().is_empty());
assert_eq!(presigned.headers().count(), 0);
}

#[tokio::test]
Expand Down Expand Up @@ -140,13 +141,14 @@ async fn test_presigning_with_payload_headers() {
][..],
&query_params
);
let headers = presigned.headers().collect::<HashMap<_, _>>();

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]
Expand Down
2 changes: 1 addition & 1 deletion examples/pokemon-service-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ pub async fn stream_pokemon_radio(
.body(SdkBody::empty())
.unwrap()
.try_into()
.uwrap(),
.unwrap(),
)
.await
.unwrap();
Expand Down

0 comments on commit 0996ce6

Please sign in to comment.