mirror of
https://gitlab.com/famedly/conduit.git
synced 2025-09-05 18:41:00 +00:00
fix: Respond with HTTP code 413, when request size is too big
This commit is contained in:
parent
c23c15e512
commit
1b32cfe955
2 changed files with 4 additions and 2 deletions
|
@ -152,6 +152,7 @@ tikv-jemallocator = { version = "0.6", features = [
|
||||||
], optional = true }
|
], optional = true }
|
||||||
|
|
||||||
sd-notify = { version = "0.4", optional = true }
|
sd-notify = { version = "0.4", optional = true }
|
||||||
|
# Used for inspecting request errors
|
||||||
http-body-util = "0.1.3"
|
http-body-util = "0.1.3"
|
||||||
|
|
||||||
# Used for matrix spec type definitions and helpers
|
# Used for matrix spec type definitions and helpers
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use std::{collections::BTreeMap, iter::FromIterator, str};
|
use std::{collections::BTreeMap, iter::FromIterator, str};
|
||||||
|
use std::error::Error as _;
|
||||||
|
|
||||||
use axum::{
|
use axum::{
|
||||||
body::Body,
|
body::Body,
|
||||||
|
@ -60,9 +61,9 @@ where
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
if std::error::Error::source(&err)
|
if err.source()
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|err| std::error::Error::source(err))
|
.and_then(|err| err.source())
|
||||||
.is_some_and(|err| err.is::<http_body_util::LengthLimitError>())
|
.is_some_and(|err| err.is::<http_body_util::LengthLimitError>())
|
||||||
{
|
{
|
||||||
Error::BadRequest(ErrorKind::TooLarge, "Reached maximum request size")
|
Error::BadRequest(ErrorKind::TooLarge, "Reached maximum request size")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue