From 6722fe611585fd165e293ad3a9677f4c39d2ef08 Mon Sep 17 00:00:00 2001 From: tottoto Date: Tue, 17 Feb 2026 20:57:41 +0900 Subject: [PATCH] examples: Use axum::body::to_bytes --- examples/axum-key-value-store/Cargo.toml | 3 --- examples/axum-key-value-store/src/main.rs | 3 +-- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/examples/axum-key-value-store/Cargo.toml b/examples/axum-key-value-store/Cargo.toml index d364d0e2..1e3500a7 100644 --- a/examples/axum-key-value-store/Cargo.toml +++ b/examples/axum-key-value-store/Cargo.toml @@ -14,6 +14,3 @@ tracing = "0.1" tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } axum = "0.8" clap = { version = "4.4.4", features = ["derive"] } - -[dev-dependencies] -http-body-util = "0.1" diff --git a/examples/axum-key-value-store/src/main.rs b/examples/axum-key-value-store/src/main.rs index 44b9c315..36614cd8 100644 --- a/examples/axum-key-value-store/src/main.rs +++ b/examples/axum-key-value-store/src/main.rs @@ -112,7 +112,6 @@ async fn set_key(Path(path): Path, state: State, value: Bytes) #[cfg(test)] mod tests { use axum::{body::Body, http::Request}; - use http_body_util::BodyExt; use tower::ServiceExt; use super::*; @@ -137,7 +136,7 @@ mod tests { .oneshot(Request::get("/foo").body(Body::empty())?) .await?; assert_eq!(response.status(), StatusCode::OK); - let body = response.into_body().collect().await?.to_bytes(); + let body = axum::body::to_bytes(response.into_body(), usize::MAX).await?; assert_eq!(body.as_ref(), b"Hello, World!"); Ok(())