Skip to content

RequestBodyLimit custom response #417

Description

@yokomizor

Feature Request

Make it possible to define the response RequestBodyLimit gives when limits are exceed.

Motivation

User facing endpoints that accept large bodies should return a response that users can understand, possibly with some tips to solve request issues. The most basic tip being "what is the limit?".

Proposal

I think it could be done either via:

  • accepting a Fn() -> Response<B> in, or
  • returning a BoxError

Alternatives

The only alternative I can think of for now is to have another layer that checks if the response status is 413, and change the response body there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-middlewareTopic: middleware

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions