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
5c8b030c1e
commit
617ea3614e
4 changed files with 12 additions and 1 deletions
|
@ -59,7 +59,15 @@ where
|
|||
.unwrap_or(usize::MAX),
|
||||
)
|
||||
.await
|
||||
.map_err(|_| Error::BadRequest(ErrorKind::MissingToken, "Missing token."))?;
|
||||
.map_err(|err| {
|
||||
if std::error::Error::source(&err).as_ref().and_then(|err| std::error::Error::source(err)).is_some() {
|
||||
Error::BadRequest(
|
||||
ErrorKind::ResourceLimitExceeded{ admin_contact: String::default() },
|
||||
"Reached maximum request size")
|
||||
} else {
|
||||
Error::BadRequest(ErrorKind::Unknown, "An unknown error has occurred")
|
||||
}
|
||||
})?;
|
||||
(parts, body)
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue