Unverified Commit 8abeb04f authored by John DiSanti's avatar John DiSanti Committed by GitHub
Browse files

Move http types out of client and split headers out of request (#3138)

This PR moves the HTTP types into the root of aws-smithy-runtime-api
since they're not client-specific, and the serializers/deserializers
will need to rely on them. It also refactors the headers and errors out
of the request module.

----

_By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice._
parent 59a47833
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -16,3 +16,9 @@ message = "Fix aws-sdk-rust#930 (PutSnapshotBlock)"
references = ["smithy-rs#3126", "aws-sdk-rust#930"]
meta = { "breaking" = false, "tada" = false, "bug" = true }
author = "rcoh"

[[smithy-rs]]
message = "The HTTP `Request`, `Response`, `Headers`, and `HeaderValue` types have been moved from `aws_smithy_runtime_api::client::http::*` into `aws_smithy_runtime_api::http`"
references = ["smithy-rs#3138"]
meta = { "breaking" = true, "tada" = false, "bug" = false, "target" = "client" }
author = "jdisanti"
+2 −2
Original line number Diff line number Diff line
@@ -16,8 +16,8 @@ mod xml;
use crate::sealed::GetNormalizedHeader;
use crate::xml::try_xml_equivalent;
use assert_json_diff::assert_json_eq_no_panic;
use aws_smithy_runtime_api::client::http::request::Headers;
use aws_smithy_runtime_api::client::orchestrator::HttpRequest;
use aws_smithy_runtime_api::http::Headers;
use http::{HeaderMap, Uri};
use pretty_assertions::Comparison;
use std::collections::HashSet;
@@ -413,8 +413,8 @@ mod tests {
        forbid_headers, forbid_query_params, require_headers, require_query_params, validate_body,
        validate_headers, validate_query_string, FloatEquals, MediaType, ProtocolTestFailure,
    };
    use aws_smithy_runtime_api::client::http::request::Headers;
    use aws_smithy_runtime_api::client::orchestrator::HttpRequest;
    use aws_smithy_runtime_api::http::Headers;

    fn make_request(uri: &str) -> HttpRequest {
        let mut req = HttpRequest::empty();
+19 −3
Original line number Diff line number Diff line
@@ -50,9 +50,6 @@
//! [`tower`]: https://crates.io/crates/tower
//! [`aws-smithy-runtime`]: https://crates.io/crates/aws-smithy-runtime

pub mod request;
pub mod response;

use crate::client::orchestrator::{HttpRequest, HttpResponse};
use crate::client::result::ConnectorError;
use crate::client::runtime_components::sealed::ValidateConfig;
@@ -62,6 +59,25 @@ use std::fmt;
use std::sync::Arc;
use std::time::Duration;

/// Http Request Types
pub mod request {
    /// Deprecated: This type has moved to `aws_smithy_runtime_api::http::HttpError`.
    #[deprecated(note = "This type has moved to `aws_smithy_runtime_api::http::HttpError`.")]
    pub type HttpError = crate::http::HttpError;
    /// Deprecated: This type has moved to `aws_smithy_runtime_api::http::HeaderValue`.
    #[deprecated(note = "This type has moved to `aws_smithy_runtime_api::http::HeaderValue`.")]
    pub type HeaderValue = crate::http::HeaderValue;
    /// Deprecated: This type has moved to `aws_smithy_runtime_api::http::Headers`.
    #[deprecated(note = "This type has moved to `aws_smithy_runtime_api::http::Headers`.")]
    pub type Headers = crate::http::Headers;
    /// Deprecated: This type has moved to `aws_smithy_runtime_api::http::HeadersIter`.
    #[deprecated(note = "This type has moved to `aws_smithy_runtime_api::http::HeadersIter`.")]
    pub type HeadersIter<'a> = crate::http::HeadersIter<'a>;
    /// Deprecated: This type has moved to `aws_smithy_runtime_api::http::Request`.
    #[deprecated(note = "This type has moved to `aws_smithy_runtime_api::http::Request`.")]
    pub type Request = crate::http::Request;
}

new_type_future! {
    #[doc = "Future for [`HttpConnector::call`]."]
    pub struct HttpConnectorFuture<'static, HttpResponse, ConnectorError>;
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ use std::error::Error as StdError;
use std::fmt;

/// Type alias for the HTTP request type that the orchestrator uses.
pub type HttpRequest = crate::client::http::request::Request;
pub type HttpRequest = crate::http::Request;

/// Type alias for the HTTP response type that the orchestrator uses.
pub type HttpResponse = http::Response<SdkBody>;
+14 −0
Original line number Diff line number Diff line
@@ -3,4 +3,12 @@
 * SPDX-License-Identifier: Apache-2.0
 */

//! Http Response Types
//! HTTP request and response types

mod error;
mod headers;
mod request;

pub use error::HttpError;
pub use headers::{HeaderValue, Headers, HeadersIter};
pub use request::Request;
Loading