mirror of
https://github.com/tokio-rs/axum.git
synced 2026-08-28 00:00:20 +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
|
# Changelog
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use axum_core::{
|
|||||||
body::Body,
|
body::Body,
|
||||||
extract::{FromRequest, Request},
|
extract::{FromRequest, Request},
|
||||||
response::{IntoResponse, Response},
|
response::{IntoResponse, Response},
|
||||||
BoxError,
|
BoxError, RequestExt,
|
||||||
};
|
};
|
||||||
use bytes::{BufMut, BytesMut};
|
use bytes::{BufMut, BytesMut};
|
||||||
use futures_core::{stream::BoxStream, Stream, TryStream};
|
use futures_core::{stream::BoxStream, Stream, TryStream};
|
||||||
@@ -109,7 +109,7 @@ where
|
|||||||
async fn from_request(req: Request, _state: &S) -> Result<Self, Self::Rejection> {
|
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`
|
// `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`
|
// 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 = body.into_data_stream();
|
||||||
let stream = stream.map_err(io::Error::other);
|
let stream = stream.map_err(io::Error::other);
|
||||||
let read = StreamReader::new(stream);
|
let read = StreamReader::new(stream);
|
||||||
|
|||||||
Reference in New Issue
Block a user