Skip to content

Commit

Permalink
STS code generates end-to-end and tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoh committed Oct 11, 2023
1 parent a543a3f commit d0812be
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class RequestSerializerGenerator(
};
let body = #{generate_body};
#{add_content_length}
#{Ok}(request_builder.body(body).expect("valid request"))
#{Ok}(request_builder.body(body).expect("valid request").try_into().unwrap())
}
}
""",
Expand Down
12 changes: 7 additions & 5 deletions rust-runtime/aws-smithy-protocol-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,18 @@ fn extract_params(uri: &Uri) -> HashSet<&str> {
}

#[track_caller]
pub fn assert_uris_match(left: &Uri, right: &Uri) {
if left == right {
pub fn assert_uris_match(left: impl AsRef<str>, right: impl AsRef<str>) {
if left.as_ref() == right.as_ref() {
return;
}
let left: Uri = left.as_ref().parse().expect("left is not a valid URI");
let right: Uri = right.as_ref().parse().expect("left is not a valid URI");
assert_eq!(left.authority(), right.authority());
assert_eq!(left.scheme(), right.scheme());
assert_eq!(left.path(), right.path());
assert_eq!(
extract_params(left),
extract_params(right),
extract_params(&left),
extract_params(&right),
"Query parameters did not match. left: {}, right: {}",
left,
right
Expand Down Expand Up @@ -383,7 +385,7 @@ mod tests {
validate_headers, validate_query_string, FloatEquals, MediaType, ProtocolTestFailure,
};
use aws_smithy_runtime_api::client::http::request::Headers;
use http::{header::HeaderMap, Request};
use http::Request;

#[test]
fn test_validate_empty_query_string() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ impl ReplayingClient {
))?
.take()
.await;
aws_smithy_protocol_test::assert_uris_match(expected.uri(), actual.uri());
body_comparer(expected.body().as_ref(), actual.body().as_ref())?;
let actual: HttpRequest = actual.map(SdkBody::from).try_into()?;
aws_smithy_protocol_test::assert_uris_match(&expected.uri().to_string(), actual.uri());
let expected_headers = expected
.headers()
.keys()
Expand Down

0 comments on commit d0812be

Please sign in to comment.