1
0
Fork 0
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:
Jakub Pieńkowski 2025-07-03 23:07:57 +00:00
parent 8f3959b3f3
commit c23c15e512

View file

@ -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")