Skip to content

Commit

Permalink
Fix broken doc links, name into_http function properly
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoh committed Oct 12, 2023
1 parent edecd5c commit 336bb7e
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 13 deletions.
4 changes: 2 additions & 2 deletions aws/rust-runtime/aws-inlineable/src/presigning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ 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)
/// - [`PresignedRequest::into`](#impl-From<PresignedRequest>) returns an [`http::request::Builder`](https://docs.rs/http/0.2.6/http/request/struct.Builder.html)
#[non_exhaustive]
pub struct PresignedRequest(HttpRequest);
Expand Down Expand Up @@ -201,7 +201,7 @@ impl PresignedRequest {

/// Given a body, convert this `PresignedRequest` into an `http::Request`
pub fn to_http_03x_request<B>(self, body: B) -> Result<http::Request<B>, BoxError> {
Ok(self.0.into_http03x()?.map(|_req| body))
Ok(self.0.into_http02x()?.map(|_req| body))
}
}

Expand Down
2 changes: 1 addition & 1 deletion aws/sdk/integration-tests/webassembly/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) })
}
Expand Down
4 changes: 3 additions & 1 deletion examples/pokemon-service-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 6 additions & 6 deletions rust-runtime/aws-smithy-runtime-api/src/client/http/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl<B> TryInto<http0::Request<B>> for Request<B> {
type Error = HttpError;

fn try_into(self) -> Result<http::Request<B>, Self::Error> {
self.into_http03x()
self.into_http02x()
}
}

Expand All @@ -124,7 +124,7 @@ impl<B> Request<B> {
///
/// Depending on the internal storage type, this operation may be free or it may have an internal
/// cost.
pub fn into_http03x(self) -> Result<http0::Request<B>, HttpError> {
pub fn into_http02x(self) -> Result<http0::Request<B>, HttpError> {
let mut req = http::Request::builder()
.uri(self.uri.parsed)
.method(self.method)
Expand All @@ -135,7 +135,7 @@ impl<B> Request<B> {
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;
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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");
}

Expand All @@ -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");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
}
}

Expand Down

0 comments on commit 336bb7e

Please sign in to comment.