Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DefaultBodyLimit::max to change the body size limit #1397

Merged
merged 4 commits into from Sep 19, 2022

Conversation

davidpdrsn
Copy link
Member

Fixes #1370

We now have a few ways to set body limits:

  • The new DefaultBodyLimit::max
  • ContentLengthLimit
  • tower_http::limit::RequestBodyLimit and http_body::Limited

I don't we should remove anything tower-http and http-body but I feel we should consider removing ContentLengthLimit. It can essentially be replaced with

Router::new().route(
    "/",
    post(handler.layer(DefaultBodyLimit::max(new_limit))),
);

Copy link
Member

@jplatte jplatte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, this seems strictly better than the extractor.

@davidpdrsn davidpdrsn merged commit de9909d into main Sep 19, 2022
@davidpdrsn davidpdrsn deleted the change-default-body-limit branch September 19, 2022 20:41
malexandru-rdx added a commit to radixdlt/babylon-node that referenced this pull request Mar 16, 2023
Update axum's version. Check breaking
[changelog](https://github.com/tokio-rs/axum/blob/main/axum/CHANGELOG.md#060-25-november-2022).

Remove Tower `RequestBodyLimitLayer` middleware and use
`DefaultBodyLimit::max` (see TODO and
tokio-rs/axum#1397).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tracking issue for allowing configurable request body size limit
2 participants