-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Http updates #3059
Http updates #3059
Conversation
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
A new generated diff is ready to view.
A new doc preview is ready to view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on this! I only have minor comments so far.
self.0.uri() | ||
} | ||
|
||
/// 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) -> &http::HeaderMap<http::HeaderValue> { | ||
self.0.headers() | ||
pub fn headers(&self) -> impl Iterator<Item = (&str, &str)> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the sensitive flag on headers for presigning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my take is this header is probably not that sensitive to make it worthwhile to return a custom type here. Open to thoughts though.
@@ -3,6 +3,8 @@ | |||
* SPDX-License-Identifier: Apache-2.0 | |||
*/ | |||
|
|||
#![cfg(feature = "test-util")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that integration tests are predicated on features, we should update the check-aws-sdk-standalone-integration-tests
script here:
pushd "${tmp_dir}/aws/sdk/integration-tests"
cargo check --tests
popd
It should check with --all-features
.
@@ -18,10 +18,10 @@ fun String.doubleQuote(): String = | |||
*/ | |||
fun String.dq(): String = this.doubleQuote() | |||
|
|||
val completeWords: List<String> = listOf("ipv4", "ipv6", "sigv4", "mib", "gib", "kib", "ttl") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
val completeWords: List<String> = listOf("ipv4", "ipv6", "sigv4", "mib", "gib", "kib", "ttl") | |
private val completeWords: List<String> = listOf("ipv4", "ipv6", "sigv4", "mib", "gib", "kib", "ttl") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why GitHub thinks this file is binary 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see #3778. The original author put non-printable characters into this file.
@@ -168,62 +170,46 @@ impl PresigningConfigBuilder { | |||
/// | |||
/// **This struct has conversion convenience functions:** | |||
/// | |||
/// - [`PresignedRequest::to_http_request<B>`][Self::to_http_request] returns an [`http::Request<B>`](https://docs.rs/http/0.2.6/http/request/struct.Request.html) | |||
/// - [`PresignedRequest::to_http_02x_request<B>`][Self::to_http_03x_request] returns an [`http::Request<B>`](https://docs.rs/http/0.2.6/http/request/struct.Request.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// - [`PresignedRequest::to_http_02x_request<B>`][Self::to_http_03x_request] returns an [`http::Request<B>`](https://docs.rs/http/0.2.6/http/request/struct.Request.html) | |
/// - [`PresignedRequest::to_http_02x_request<B>`][Self::to_http_02x_request] returns an [`http::Request<B>`](https://docs.rs/http/0.2.6/http/request/struct.Request.html) |
rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr.rs
Outdated
Show resolved
Hide resolved
rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr.rs
Outdated
Show resolved
Hide resolved
@@ -29,8 +29,11 @@ pub struct ReplayEvent { | |||
|
|||
impl ReplayEvent { | |||
/// Creates a new `ReplayEvent`. | |||
pub fn new(request: HttpRequest, response: HttpResponse) -> Self { | |||
Self { request, response } | |||
pub fn new(request: impl TryInto<HttpRequest>, response: impl TryInto<HttpResponse>) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
A new generated diff is ready to view.
A new doc preview is ready to view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lots of places to update. Thanks for the work 🙇
@@ -55,5 +56,5 @@ async fn test_presigning() { | |||
][..], | |||
&query_params | |||
); | |||
assert!(presigned.headers().is_empty()); | |||
assert_eq!(presigned.headers().count(), 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert_eq!(presigned.headers().count(), 0); | |
assert_eq!(0, presigned.headers().count()); |
@@ -97,7 +100,7 @@ async fn test_presigning() { | |||
][..], | |||
&query_params | |||
); | |||
assert!(presigned.headers().is_empty()); | |||
assert_eq!(presigned.headers().count(), 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert_eq!(presigned.headers().count(), 0); | |
assert_eq!(0, presigned.headers().count()); |
assert_eq!( | ||
headers.get(CONTENT_TYPE.as_str()), | ||
Some(&"application/x-test") | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert_eq!( | |
headers.get(CONTENT_TYPE.as_str()), | |
Some(&"application/x-test") | |
); | |
assert_eq!( | |
Some(&"application/x-test"), | |
headers.get(CONTENT_TYPE.as_str()) | |
); |
headers.get(CONTENT_TYPE.as_str()), | ||
Some(&"application/x-test") | ||
); | ||
assert_eq!(headers.get(CONTENT_LENGTH.as_str()), Some(&"12345")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert_eq!(headers.get(CONTENT_LENGTH.as_str()), Some(&"12345")); | |
assert_eq!(Some(&"12345"), headers.get(CONTENT_LENGTH.as_str())); |
Some(&"application/x-test") | ||
); | ||
assert_eq!(headers.get(CONTENT_LENGTH.as_str()), Some(&"12345")); | ||
assert_eq!(headers.len(), 2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert_eq!(headers.len(), 2); | |
assert_eq!(2, headers.len()); |
@@ -15,6 +16,11 @@ pub struct QueryWriter { | |||
} | |||
|
|||
impl QueryWriter { | |||
/// Creates a new `QueryWriter` from a string | |||
pub fn new_from_string(uri: &str) -> Result<Self, InvalidUri> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, why not impl FromStr for QueryWriter
?
A new generated diff is ready to view.
A new doc preview is ready to view. |
For the same reason that the request wrapper types were created in #3059, this PR establishes the response wrapper types and refactors existing code to use them. ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
## Motivation and Context In #3059 there was an accidental deletion of a test ## Description Re-introduce checking the URL in protocol tests ## Checklist <!--- If a checkbox below is not applicable, then please DELETE it rather than leaving it unchecked --> - [ ] I have updated `CHANGELOG.next.toml` if I made changes to the smithy-rs codegen or runtime crates - [ ] I have updated `CHANGELOG.next.toml` if I made changes to the AWS SDK, generated SDK code, or SDK runtime crates ---- _By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice._
Motivation and Context
To allow seamless adoption of the incoming
http
crate, we're updating our client crates to use an intermediate type.Description
Update client code to use
HttpRequest
. Some internal code still useshttp::Request
but those usages are limited.Testing
CI
Checklist
CHANGELOG.next.toml
if I made changes to the smithy-rs codegen or runtime cratesCHANGELOG.next.toml
if I made changes to the AWS SDK, generated SDK code, or SDK runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.