Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
  • Loading branch information
davidpdrsn and jplatte committed Jun 8, 2022
1 parent e99186c commit b6c6f08
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions axum-core/src/extract/rejection.rs
Expand Up @@ -39,10 +39,10 @@ pub struct FailedToBufferBody(FailedToBufferBodyInner);
impl FailedToBufferBody {
/// Check if the body failed to be buffered because a length limit was hit.
///
/// This can _only_ happen when you're using [`tower_http::limit::RequestBodyLimitLayer`] or
/// This can _only_ happen when you're using [`tower_http::limit::RequestBodyLimitLayer`] or
/// otherwise wrapping request bodies in [`http_body::Limited`].
///
/// [`tower_http::limit::RequestBodyLimitLayer`]: https://docs.rs/tower-http/latest/tower_http/limit/struct.RequestBodyLimitLayer.html
/// [`tower_http::limit::RequestBodyLimitLayer`]: https://docs.rs/tower-http/0.3/tower_http/limit/struct.RequestBodyLimitLayer.html
pub fn is_length_limit_error(&self) -> bool {
matches!(self.0, FailedToBufferBodyInner::LengthLimitError(_))
}
Expand Down Expand Up @@ -72,12 +72,12 @@ impl crate::response::IntoResponse for FailedToBufferBody {
match self.0 {
FailedToBufferBodyInner::Unknown(err) => (
http::StatusCode::BAD_REQUEST,
format!(concat!("Failed to buffer the request body", ": {}"), err),
format!("Failed to buffer the request body: {}", err),
)
.into_response(),
FailedToBufferBodyInner::LengthLimitError(err) => (
StatusCode::PAYLOAD_TOO_LARGE,
format!(concat!("Failed to buffer the request body", ": {}"), err),
format!("Failed to buffer the request body: {}", err),
)
.into_response(),
}
Expand Down

0 comments on commit b6c6f08

Please sign in to comment.