Skip to content

Make MaxRequestBodySizeMiddleware configurable per route #267

Description

@kilodesodiq-arch

Problem Statement. Today the limit is a single global max_bytes. Routes that handle
genomic files (/v1/ai/humanitarian/verify with attached evidence) and routes that
handle OCR images at low MB have different ceilings.

Technical Context. app/ai-service/main.py::MaxRequestBodySizeMiddleware.

Expected Outcome. A RouteBodySize(max_bytes=N) decorator enriches routes with their
own limit; middleware honours route-specific value when present.

Acceptance Criteria.

  • /v1/ai/upload-large declared with max_bytes=64*1024*1024 returns 413 only on 64
    MiB+.
  • Default unchanged.

Files or modules likely to be affected.
app/ai-service/main.py,
app/ai-service/api/routes.py.

Difficulty. Easy
Estimated effort. S



Backlog item #59 from `docs/maintainer-issue-backlog.md.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions