mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-02 00:00:22 +02:00
Update to hyper 1.0-rc.3 and http-body-util 0.1.0-rc.2
This commit is contained in:
@@ -6,6 +6,7 @@ publish = false
|
||||
|
||||
[dependencies]
|
||||
axum = { path = "../../axum" }
|
||||
http-body-util = "0.1.0-rc.2"
|
||||
hyper = { version = "1.0.0-rc.3", features = ["full"] }
|
||||
tokio = { version = "1.0", features = ["full"] }
|
||||
tower = { version = "0.4", features = ["util", "filter"] }
|
||||
|
||||
@@ -13,6 +13,7 @@ use axum::{
|
||||
routing::post,
|
||||
Router,
|
||||
};
|
||||
use http_body_util::BodyExt;
|
||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||
|
||||
#[tokio::main]
|
||||
@@ -58,8 +59,8 @@ where
|
||||
B: axum::body::HttpBody<Data = Bytes>,
|
||||
B::Error: std::fmt::Display,
|
||||
{
|
||||
let bytes = match hyper::body::to_bytes(body).await {
|
||||
Ok(bytes) => bytes,
|
||||
let bytes = match body.collect().await {
|
||||
Ok(collected) => collected.to_bytes(),
|
||||
Err(err) => {
|
||||
return Err((
|
||||
StatusCode::BAD_REQUEST,
|
||||
|
||||
Reference in New Issue
Block a user