LimitRequestBodyMiddleware (pure ASGI, registered outermost) rejects request bodies larger than PIRATS_MAX_BODY_BYTES (default 1 MiB) before they're buffered into memory: it checks the declared Content-Length first, then counts the bytes actually streamed so a chunked/length-omitting client can't bypass the header check. Exposed as services.pirats.maxBodyBytes and documented in the README. Tested in isolation (Content-Length fast path + streamed path) and through the real app. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
7.6 KiB
7.6 KiB