Skip to content

Commit

Permalink
Bump axum-core to 0.4, http to 1.0 (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
cole-h authored Nov 27, 2023
1 parent 534fa42 commit d5fdc8e
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 23 deletions.
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,24 @@ private = ["cookie/secure"]

[dependencies]
async-trait = "0.1"
axum-core = { version = "0.3", optional = true }
axum-core = { version = "0.4", optional = true }
cookie = { version = "0.17", features = ["percent-encode"] }
futures-util = "0.3"
http = "0.2"
http = "1.0"
parking_lot = "0.12"
pin-project-lite = "0.2"
tower-layer = "0.3"
tower-service = "0.3"

[dev-dependencies]
axum = "0.6"
hyper = "0.14"
axum = "0.7"
hyper = "1.0"
once_cell = "1.9"
rusty-hook = "0.11"
tokio = { version = "1", features = ["full"] }
tower = "0.4"
tracing-subscriber = "0.3"
http-body-util = "0.1"

[package.metadata.docs.rs]
all-features = true
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ async fn main() {
.layer(CookieManagerLayer::new());
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
axum::Server::bind(&addr)
.serve(app.into_make_service())
let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
axum::serve(listener, app.into_make_service())
.await
.unwrap();
}
Expand Down
4 changes: 2 additions & 2 deletions examples/counter-extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ async fn main() {
.layer(CookieManagerLayer::new());

let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
axum::Server::bind(&addr)
.serve(app.into_make_service())
let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
axum::serve(listener, app.into_make_service())
.await
.unwrap();
}
Expand Down
4 changes: 2 additions & 2 deletions examples/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ async fn main() {
.layer(CookieManagerLayer::new());

let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
axum::Server::bind(&addr)
.serve(app.into_make_service())
let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
axum::serve(listener, app.into_make_service())
.await
.unwrap();
}
Expand Down
4 changes: 2 additions & 2 deletions examples/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ async fn main() {
.layer(CookieManagerLayer::new());

let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
axum::Server::bind(&addr)
.serve(app.into_make_service())
let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
axum::serve(listener, app.into_make_service())
.await
.unwrap();
}
Expand Down
4 changes: 2 additions & 2 deletions examples/signed_private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ async fn main() {
.layer(CookieManagerLayer::new());

let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
axum::Server::bind(&addr)
.serve(app.into_make_service())
let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
axum::serve(listener, app.into_make_service())
.await
.unwrap();
}
Expand Down
15 changes: 6 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
//! .layer(CookieManagerLayer::new());
//!
//! let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
//! axum::Server::bind(&addr)
//! .serve(app.into_make_service())
//! let listener = tokio::net::TcpListener::bind(&addr).await.unwrap();
//! axum::serve(listener, app.into_make_service())
//! .await
//! .unwrap();
//! }
Expand Down Expand Up @@ -197,13 +197,10 @@ impl Inner {
#[cfg(all(test, feature = "axum-core"))]
mod tests {
use crate::{CookieManagerLayer, Cookies};
use axum::{
body::{Body, BoxBody},
routing::get,
Router,
};
use axum::{body::Body, routing::get, Router};
use cookie::Cookie;
use http::{header, Request};
use http_body_util::BodyExt;
use tower::ServiceExt;

fn app() -> Router {
Expand Down Expand Up @@ -236,8 +233,8 @@ mod tests {
.layer(CookieManagerLayer::new())
}

async fn body_string(body: BoxBody) -> String {
let bytes = hyper::body::to_bytes(body).await.unwrap();
async fn body_string(body: Body) -> String {
let bytes = body.collect().await.unwrap().to_bytes();
String::from_utf8_lossy(&bytes).into()
}

Expand Down

0 comments on commit d5fdc8e

Please sign in to comment.