mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-31 00:00:10 +02:00
Update to hyper 1.0-rc.3 and http-body-util 0.1.0-rc.2
This commit is contained in:
@@ -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