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
8f3959b3f3
commit
c23c15e512
1 changed files with 5 additions and 1 deletions
|
@ -60,7 +60,11 @@ where
|
||||||
)
|
)
|
||||||
.await
|
.await
|
||||||
.map_err(|err| {
|
.map_err(|err| {
|
||||||
if std::error::Error::source(&err).as_ref().and_then(|err| std::error::Error::source(err)).is_some() {
|
if std::error::Error::source(&err)
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|err| std::error::Error::source(err))
|
||||||
|
.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")
|
||||||
} else {
|
} else {
|
||||||
Error::BadRequest(ErrorKind::Unknown, "An unknown error has occurred")
|
Error::BadRequest(ErrorKind::Unknown, "An unknown error has occurred")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue