mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-16 00:00:18 +02:00
fix(json-lines): Respect default body limit (#3591)
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
# Unreleased
|
||||
|
||||
- **fixed:** `JsonLines` now correctly respects the default body limit ([#3591])
|
||||
|
||||
[#3591]: https://github.com/tokio-rs/axum/pull/3591
|
||||
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
@@ -4,7 +4,7 @@ use axum_core::{
|
||||
body::Body,
|
||||
extract::{FromRequest, Request},
|
||||
response::{IntoResponse, Response},
|
||||
BoxError,
|
||||
BoxError, RequestExt,
|
||||
};
|
||||
use bytes::{BufMut, BytesMut};
|
||||
use futures_util::stream::{BoxStream, Stream, TryStream, TryStreamExt};
|
||||
@@ -108,7 +108,7 @@ where
|
||||
async fn from_request(req: Request, _state: &S) -> Result<Self, Self::Rejection> {
|
||||
// `Stream::lines` isn't a thing so we have to convert it into an `AsyncRead`
|
||||
// so we can call `AsyncRead::lines` and then convert it back to a `Stream`
|
||||
let body = req.into_body();
|
||||
let body = req.into_limited_body();
|
||||
let stream = body.into_data_stream();
|
||||
let stream = stream.map_err(io::Error::other);
|
||||
let read = StreamReader::new(stream);
|
||||
|
||||
Reference in New Issue
Block a user