From 336bb7e264199506732f71ce2f65e54e26feabd5 Mon Sep 17 00:00:00 2001 From: Russell Cohen Date: Thu, 12 Oct 2023 13:57:20 -0400 Subject: [PATCH] Fix broken doc links, name into_http function properly --- aws/rust-runtime/aws-inlineable/src/presigning.rs | 4 ++-- aws/sdk/integration-tests/webassembly/src/http.rs | 2 +- examples/pokemon-service-common/src/lib.rs | 4 +++- .../src/client/http/request.rs | 12 ++++++------ .../aws-smithy-runtime/src/client/http/hyper_014.rs | 2 +- .../src/client/http/test_util/dvr/replay.rs | 2 +- .../src/client/http/test_util/infallible.rs | 2 +- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/aws/rust-runtime/aws-inlineable/src/presigning.rs b/aws/rust-runtime/aws-inlineable/src/presigning.rs index 7f8cea59ef..3829e6b968 100644 --- a/aws/rust-runtime/aws-inlineable/src/presigning.rs +++ b/aws/rust-runtime/aws-inlineable/src/presigning.rs @@ -171,7 +171,7 @@ impl PresigningConfigBuilder { /// /// **This struct has conversion convenience functions:** /// -/// - [`PresignedRequest::to_http_request`][Self::to_http_request] returns an [`http::Request`](https://docs.rs/http/0.2.6/http/request/struct.Request.html) +/// - [`PresignedRequest::to_http_02x_request`][Self::to_http_03x_request] returns an [`http::Request`](https://docs.rs/http/0.2.6/http/request/struct.Request.html) /// - [`PresignedRequest::into`](#impl-From) returns an [`http::request::Builder`](https://docs.rs/http/0.2.6/http/request/struct.Builder.html) #[non_exhaustive] pub struct PresignedRequest(HttpRequest); @@ -201,7 +201,7 @@ impl PresignedRequest { /// Given a body, convert this `PresignedRequest` into an `http::Request` pub fn to_http_03x_request(self, body: B) -> Result, BoxError> { - Ok(self.0.into_http03x()?.map(|_req| body)) + Ok(self.0.into_http02x()?.map(|_req| body)) } } diff --git a/aws/sdk/integration-tests/webassembly/src/http.rs b/aws/sdk/integration-tests/webassembly/src/http.rs index 22d52b2609..b13f4bf2b0 100644 --- a/aws/sdk/integration-tests/webassembly/src/http.rs +++ b/aws/sdk/integration-tests/webassembly/src/http.rs @@ -45,7 +45,7 @@ impl WasmHttpConnector { impl HttpConnector for WasmHttpConnector { fn call(&self, request: HttpRequest) -> HttpConnectorFuture { println!("Adapter: sending request..."); - let res = make_request(request.into_http03x().unwrap()).unwrap(); + let res = make_request(request.into_http02x().unwrap()).unwrap(); println!("{:?}", res); HttpConnectorFuture::new(async move { Ok(res) }) } diff --git a/examples/pokemon-service-common/src/lib.rs b/examples/pokemon-service-common/src/lib.rs index be15b07117..54503d4d61 100644 --- a/examples/pokemon-service-common/src/lib.rs +++ b/examples/pokemon-service-common/src/lib.rs @@ -332,7 +332,9 @@ pub async fn stream_pokemon_radio( http::Request::builder() .uri(radio_stream_url) .body(SdkBody::empty()) - .unwrap(), + .unwrap() + .try_into() + .uwrap(), ) .await .unwrap(); diff --git a/rust-runtime/aws-smithy-runtime-api/src/client/http/request.rs b/rust-runtime/aws-smithy-runtime-api/src/client/http/request.rs index 01a600b32a..28c9e3d6ab 100644 --- a/rust-runtime/aws-smithy-runtime-api/src/client/http/request.rs +++ b/rust-runtime/aws-smithy-runtime-api/src/client/http/request.rs @@ -115,7 +115,7 @@ impl TryInto> for Request { type Error = HttpError; fn try_into(self) -> Result, Self::Error> { - self.into_http03x() + self.into_http02x() } } @@ -124,7 +124,7 @@ impl Request { /// /// Depending on the internal storage type, this operation may be free or it may have an internal /// cost. - pub fn into_http03x(self) -> Result, HttpError> { + pub fn into_http02x(self) -> Result, HttpError> { let mut req = http::Request::builder() .uri(self.uri.parsed) .method(self.method) @@ -135,7 +135,7 @@ impl Request { self.headers .headers .into_iter() - .map(|(k, v)| (k, v.into_http03x())), + .map(|(k, v)| (k, v.into_http02x())), ); *req.headers_mut() = headers; *req.extensions_mut() = self.extensions; @@ -496,7 +496,7 @@ mod header_value { Ok(Self { _private: value }) } - pub(crate) fn into_http03x(self) -> http0::HeaderValue { + pub(crate) fn into_http02x(self) -> http0::HeaderValue { self._private } } @@ -652,7 +652,7 @@ mod test { assert_eq!(req.headers().get("a").unwrap(), "b"); req.headers_mut().append("a", "c"); assert_eq!(req.headers().get("a").unwrap(), "b"); - let http0 = req.into_http03x().unwrap(); + let http0 = req.into_http02x().unwrap(); assert_eq!(http0.uri(), "http://foo.com"); } @@ -666,7 +666,7 @@ mod test { assert_eq!(req.uri(), "http://foo.com/"); req.set_uri("http://bar.com").unwrap(); assert_eq!(req.uri(), "http://bar.com"); - let http0 = req.into_http03x().unwrap(); + let http0 = req.into_http02x().unwrap(); assert_eq!(http0.uri(), "http://bar.com"); } diff --git a/rust-runtime/aws-smithy-runtime/src/client/http/hyper_014.rs b/rust-runtime/aws-smithy-runtime/src/client/http/hyper_014.rs index 2258e95756..541b11d699 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/http/hyper_014.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/http/hyper_014.rs @@ -346,7 +346,7 @@ where { fn call(&self, request: HttpRequest) -> HttpConnectorFuture { let mut request = request - .into_http03x() + .into_http02x() .expect("TODO(httpRefactor): no panics"); let capture_connection = capture_connection(&mut request); if let Some(capture_smithy_connection) = diff --git a/rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr/replay.rs b/rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr/replay.rs index 563937c9f5..72c4d2d861 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr/replay.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/http/test_util/dvr/replay.rs @@ -303,7 +303,7 @@ impl HttpConnector for ReplayingClient { .extend_from_slice(data.expect("in memory request should not fail").as_ref()) } request - .into_http03x() + .into_http02x() .unwrap() .map(|_body| Bytes::from(data_read)) }); diff --git a/rust-runtime/aws-smithy-runtime/src/client/http/test_util/infallible.rs b/rust-runtime/aws-smithy-runtime/src/client/http/test_util/infallible.rs index 7216833acc..3c4cea5065 100644 --- a/rust-runtime/aws-smithy-runtime/src/client/http/test_util/infallible.rs +++ b/rust-runtime/aws-smithy-runtime/src/client/http/test_util/infallible.rs @@ -60,7 +60,7 @@ impl InfallibleClientFn { impl HttpConnector for InfallibleClientFn { fn call(&self, request: HttpRequest) -> HttpConnectorFuture { - HttpConnectorFuture::ready((self.response)(request.into_http03x().unwrap())) + HttpConnectorFuture::ready((self.response)(request.into_http02x().unwrap())) } }