mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-07 00:00:12 +02:00
Update to latest versions of hyper and http-body (#1882)
Co-authored-by: Michael Scofield <[email protected]> Co-authored-by: Jonas Platte <[email protected]>
This commit is contained in:
co-authored by
Michael Scofield
Jonas Platte
parent
2f4720907a
commit
43b14a5f02
@@ -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