Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
23aa48a
Add aws-smithy-http-server - http@1 support
Oct 31, 2025
5659608
Update docs and tests
Oct 31, 2025
c1c3faf
Use crate::http
Oct 31, 2025
97dd8f7
Use crate::http throughout
Oct 31, 2025
6b02aea
fix docs
Oct 31, 2025
892eb10
Fix docs and cargo fmt
Nov 1, 2025
89edd58
Update gracefulshutdown to support coordinator
Nov 2, 2025
a373d35
Remove strategy based traits and use plain branching
Nov 2, 2025
9f88057
Removed benches, and other non-necessary examples
Nov 3, 2025
33ad5e9
Protocol test changes
Nov 7, 2025
3c88748
Add back Cargo.lock
Nov 7, 2025
bfbef4f
Update lambda-runtime to version 1
Nov 24, 2025
b9de587
Custom accept loop example updated
Nov 24, 2025
885211b
Update examples to keep only relevant ones
Nov 24, 2025
1102e5a
Remove format warnings
Nov 24, 2025
ce2bc40
Fix docs
Nov 25, 2025
669a431
Update dependencies
Nov 26, 2025
511bdd2
Update tower dev dependencies
Nov 26, 2025
f10012f
Use qualified module
Nov 26, 2025
b6281ba
Update test to cover custom data type for wrap_stream
Nov 26, 2025
13a7ce3
Use http:: instead of aws_smithy_http_server::http
Nov 26, 2025
ed9dd28
Use http_body::Body, and fix warnings
Nov 26, 2025
202b5a2
Add test for custom body type in alb_health_check
Nov 26, 2025
0b19266
Add test for incremental stream reading
Nov 26, 2025
4348260
Remove unnecessary use statements
Nov 27, 2025
b0bb68b
Fix comments
Nov 27, 2025
6039224
Fix comments
Nov 27, 2025
0c4b88d
Fix imports
Nov 27, 2025
483679f
Remove rust_toolchain.toml from PR
Nov 27, 2025
0d4f8e6
Restore rust-toolchain.toml to match feature/http-1.x
Nov 27, 2025
bf0b610
Restore Cargo.lock to match feature/http-1.x
Nov 27, 2025
ec8940f
Merge branch 'feature/http-1.x' into fahadzub/http-1.x-server-runtime
drganjoo Nov 27, 2025
515d0d8
Do not re-export serve::serve as that makes it hard to reference in docs
Nov 28, 2025
cb3ece8
Merge branch 'feature/http-1.x' into fahadzub/http-1.x-server-runtime
drganjoo Dec 1, 2025
fb0c9e2
Add copyright to files in tests/ directory
Dec 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove unnecessary use statements
  • Loading branch information
Fahad Zubair committed Nov 27, 2025
commit 43482602c4faea5c8ad1807569a5ff2bf491a036
11 changes: 6 additions & 5 deletions rust-runtime/aws-smithy-http-server/examples/request_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

#![cfg_attr(
not(feature = "request-id"),
allow(unused_imports, dead_code, unreachable_code)
)]
#![cfg_attr(not(feature = "request-id"), allow(unused_imports, dead_code, unreachable_code))]

//! Example showing how to use request IDs for tracing and observability.
//!
Expand All @@ -32,7 +29,11 @@
//!
//! Look for the `x-request-id` header in the response.

use aws_smithy_http_server::{body::{boxed, BoxBody}, routing::IntoMakeService, serve::serve};
use aws_smithy_http_server::{
body::{boxed, BoxBody},
routing::IntoMakeService,
serve::serve,
};

#[cfg(feature = "request-id")]
use aws_smithy_http_server::request::request_id::{ServerRequestId, ServerRequestIdProviderLayer};
Expand Down
2 changes: 0 additions & 2 deletions rust-runtime/aws-smithy-http-server/src/operation/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ use pin_project_lite::pin_project;
use tower::{util::Oneshot, Service, ServiceExt};
use tracing::error;

use crate::http;

use crate::{
body::BoxBody, plugin::Plugin, request::FromRequest, response::IntoResponse,
runtime_error::InternalFailureException, service::ServiceShape,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ use crate::rejection::MissingContentTypeReason;
use aws_smithy_runtime_api::http::HttpError;
use thiserror::Error;

use crate::http;

#[derive(Debug, Error)]
pub enum ResponseRejection {
#[error("error building HTTP response: {0}")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ use crate::routing::tiny_map::TinyMap;
use crate::routing::Route;
use crate::routing::Router;

use crate::http;

use crate::http::header::ToStrError;
use http::header::ToStrError;
use thiserror::Error;

/// An AWS JSON routing error.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ use crate::response::IntoResponse;
use crate::runtime_error::{InternalFailureException, INVALID_HTTP_RESPONSE_FOR_RUNTIME_ERROR_PANIC_MESSAGE};
use crate::{extension::RuntimeErrorExtension, protocol::aws_json_10::AwsJson1_0};

use crate::http;

use crate::http::StatusCode;
use http::StatusCode;

use super::rejection::{RequestRejection, ResponseRejection};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

use crate::http;

use crate::body::{empty, BoxBody};
use crate::extension::RuntimeErrorExtension;
use crate::response::IntoResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

use crate::http;

use crate::body::{empty, BoxBody};
use crate::extension::RuntimeErrorExtension;
use crate::response::IntoResponse;
Expand Down
8 changes: 2 additions & 6 deletions rust-runtime/aws-smithy-http-server/src/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ pub mod rpc_v2_cbor;

use crate::rejection::MissingContentTypeReason;
use aws_smithy_runtime_api::http::Headers as SmithyHeaders;

use crate::http;

use crate::http::header::CONTENT_TYPE;
use crate::http::HeaderMap;
use http::header::CONTENT_TYPE;
use http::HeaderMap;

#[cfg(test)]
pub mod test_helpers {
use http;
use http::{HeaderMap, Method, Request};

/// Helper function to build a `Request`. Used in other test modules.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ use tower::Service;

use thiserror::Error;

use crate::http;

/// An AWS REST routing error.
#[derive(Debug, Error, PartialEq)]
pub enum Error {
Expand Down Expand Up @@ -113,8 +111,6 @@ mod tests {
use super::*;
use crate::{protocol::test_helpers::req, routing::request_spec::*};

use http;

use http::Method;

// This test is a rewrite of `mux.spec.ts`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ use aws_smithy_runtime_api::http::HttpError;
use std::num::TryFromIntError;
use thiserror::Error;

use crate::http;

/// Errors that can occur when serializing the operation output provided by the service implementer
/// into an HTTP response.
#[derive(Debug, Error)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* SPDX-License-Identifier: Apache-2.0
*/

use crate::http;

use crate::body::BoxBody;
use crate::extension::RuntimeErrorExtension;
use crate::response::IntoResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ use crate::response::IntoResponse;
use crate::runtime_error::InternalFailureException;
use crate::runtime_error::INVALID_HTTP_RESPONSE_FOR_RUNTIME_ERROR_PANIC_MESSAGE;

use crate::http;

use crate::http::StatusCode;
use http::StatusCode;

#[derive(Debug, thiserror::Error)]
pub enum RuntimeError {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ use aws_smithy_runtime_api::http::HttpError;
use std::num::TryFromIntError;
use thiserror::Error;

use crate::http;

#[derive(Debug, Error)]
pub enum ResponseRejection {
#[error("invalid bound HTTP status code; status codes must be inside the 100-999 range: {0}")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
*/

use crate::body::empty;
use crate::http;

use crate::body::BoxBody;
use crate::extension::RuntimeErrorExtension;
use crate::response::IntoResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ use crate::protocol::rest_xml::RestXml;
use crate::response::IntoResponse;
use crate::runtime_error::InternalFailureException;
use crate::{extension::RuntimeErrorExtension, runtime_error::INVALID_HTTP_RESPONSE_FOR_RUNTIME_ERROR_PANIC_MESSAGE};

use crate::http;

use crate::http::StatusCode;
use http::StatusCode;

use super::rejection::{RequestRejection, ResponseRejection};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ use crate::rejection::MissingContentTypeReason;
use aws_smithy_runtime_api::http::HttpError;
use thiserror::Error;

use crate::http;

#[derive(Debug, Error)]
pub enum ResponseRejection {
#[error("invalid bound HTTP status code; status codes must be inside the 100-999 range: {0}")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ use std::convert::Infallible;
use std::str::FromStr;
use std::sync::LazyLock;

use crate::http;
use crate::http::header::ToStrError;
use crate::http::HeaderMap;
use http::header::ToStrError;
use http::HeaderMap;
use regex::Regex;
use thiserror::Error;
use tower::Layer;
Expand Down Expand Up @@ -252,7 +251,7 @@ impl<S> FromIterator<(&'static str, S)> for RpcV2CborRouter<S> {

#[cfg(test)]
mod tests {
use crate::http::{HeaderMap, HeaderValue, Method};
use http::{HeaderMap, HeaderValue, Method};
use regex::Regex;

use crate::protocol::test_helpers::req;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ use crate::runtime_error::{InternalFailureException, INVALID_HTTP_RESPONSE_FOR_R
use crate::{extension::RuntimeErrorExtension, protocol::rpc_v2_cbor::RpcV2Cbor};
use bytes::Bytes;

use crate::http;

use crate::http::StatusCode;
use http::StatusCode;

use super::rejection::{RequestRejection, ResponseRejection};

Expand Down
1 change: 0 additions & 1 deletion rust-runtime/aws-smithy-http-server/src/rejection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ pub mod any_rejections {
//! [`IntoResponse`].

use super::IntoResponse;
use http;
use thiserror::Error;

macro_rules! any_rejection {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
//! illustrates the use of [`IntoMakeServiceWithConnectInfo`](crate::routing::IntoMakeServiceWithConnectInfo)
//! and [`ConnectInfo`] with a service builder.

use crate::http;

use crate::http::request::Parts;
use http::request::Parts;
use thiserror::Error;

use crate::{body::BoxBody, response::IntoResponse};
Expand Down
2 changes: 0 additions & 2 deletions rust-runtime/aws-smithy-http-server/src/request/extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ use std::ops::Deref;

use thiserror::Error;

use crate::http;

use crate::{body::BoxBody, request::FromParts, response::IntoResponse};

use super::internal_server_error;
Expand Down
2 changes: 0 additions & 2 deletions rust-runtime/aws-smithy-http-server/src/request/lambda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
//! The [`lambda_http`] types included in [`http::Request`]s when [`LambdaHandler`](crate::routing::LambdaHandler) is
//! used. Each are given a [`FromParts`] implementation for easy use within handlers.

use crate::http;

use lambda_http::request::RequestContext;
#[doc(inline)]
pub use lambda_http::{
Expand Down
4 changes: 1 addition & 3 deletions rust-runtime/aws-smithy-http-server/src/request/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ use futures_util::{
TryFutureExt,
};

use crate::http;

use crate::http::{request::Parts, Request, StatusCode};
use http::{request::Parts, Request, StatusCode};

use crate::{
body::{empty, BoxBody},
Expand Down
7 changes: 2 additions & 5 deletions rust-runtime/aws-smithy-http-server/src/request/request_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,12 @@ use std::{
};

use futures_util::TryFuture;
use http::request::Parts;
use http::{header::HeaderName, HeaderValue, Response};
use thiserror::Error;
use tower::{Layer, Service};
use uuid::Uuid;

use crate::http;

use crate::http::request::Parts;
use crate::http::{header::HeaderName, HeaderValue, Response};

use crate::{body::BoxBody, response::IntoResponse};

use super::{internal_server_error, FromParts};
Expand Down
2 changes: 0 additions & 2 deletions rust-runtime/aws-smithy-http-server/src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@

use crate::body::BoxBody;

use crate::http;

pub type Response<T = BoxBody> = http::Response<T>;

/// A protocol aware function taking `self` to [`http::Response`].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use std::{
};
use tower::Service;

use crate::http;
use lambda_http::{Request, RequestExt};

use crate::body::{self, BoxBodySync};
Expand Down
3 changes: 1 addition & 2 deletions rust-runtime/aws-smithy-http-server/src/routing/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ use futures_util::{
};
use tower::{util::Oneshot, Service, ServiceExt};

use crate::http;
use http_body::Body as HttpBody;

use crate::http::Response;
use http::Response;

use crate::{
body::{boxed, BoxBody},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@

use std::borrow::Cow;

use crate::http;

use crate::http::Request;
use http::Request;
use regex::Regex;

#[derive(Debug, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion rust-runtime/aws-smithy-http-server/src/routing/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

use crate::body::BoxBody;

use crate::http::{Request, Response};
use http::{Request, Response};
use std::{
convert::Infallible,
fmt,
Expand Down