Skip to content

Remove dead jsonLimitForPath abstraction - #273

Merged
willchen96 merged 3 commits into
Open-Legal-Products:mainfrom
b1rdmania:chore/remove-dead-json-limit
Aug 2, 2026
Merged

Remove dead jsonLimitForPath abstraction#273
willchen96 merged 3 commits into
Open-Legal-Products:mainfrom
b1rdmania:chore/remove-dead-json-limit

Conversation

@b1rdmania

Copy link
Copy Markdown
Contributor

jsonLimitForPath() ignores its path argument and always returns "50mb", and the per-request wrapper re-invokes express.json() on every request for no effect. This replaces both with a single static express.json({ limit: "50mb" }) mount.

  • Behaviour identical, one insertion, seven deletions
  • npm run build passes; full vitest suite passes (259 passed, 5 skipped)
  • If per-path body limits are wanted later (which the function's shape suggests was the original intent), happy to implement that properly against an explicit route list

Found while reading the codebase for our fork work (b1rdmania).

🤖 Generated with Claude Code

jsonLimitForPath() ignores its path argument and always returns "50mb",
and the per-request middleware wrapper re-invokes express.json() on every
request for no effect. Replace with a single static express.json() mount.
Behaviour is identical; if per-path body limits are wanted later, happy
to implement them properly against a list of routes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@amal66
amal66 self-requested a review July 31, 2026 18:45

@amal66 amal66 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Having descriptive variable names is better than unnamed strings. Could we please revise this to have a descriptive constant named in all caps at the top of the file, and reusing that?

Some rationale from a related article, under "Why Use constants": https://realpython.com/python-constants/

b1rdmania and others added 2 commits July 31, 2026 20:30
Per review: a named constant reads better than a bare string at the
mount site, and gives the value somewhere to be documented.
@willchen96

Copy link
Copy Markdown
Collaborator

Merging in as change request has been addressed. Made commit to clarify comment.

@willchen96
willchen96 merged commit 133ecb3 into Open-Legal-Products:main Aug 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants