Repository navigation
fix(web): accept empty chunked API POST requests - #725
Conversation
Handle untyped zero-byte POST streams at the shared API parser boundary. Keep request.body undefined and preserve existing typed parsers, 404 fallbacks, authentication and webview proxy stream handling. Reject nonempty untyped streams on the first byte, and cover parser boundaries, raw HTTP framing and real WebServer routing with regressions.
|
Thank you @kdxcxs, and welcome! This fixes bodyless POSTs that arrive through Cloudflare Tunnel as empty chunked requests with no Content-Type: they now reach their route with no body, exactly as a The scoping is right. Go's HTTP client (which cloudflared uses) frames an empty body of unknown length as chunked for POST, PUT and PATCH and drops it for DELETE, and every PUT/PATCH in the frontend carries a JSON body, so POST under One thing I will touch at merge time: |
Add the @fileoverview the repo carries on every module: why the parser exists, why it is POST + /api/ only, and that it owns the root '*' content-type slot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Merged in 1.47.0 (https://github.com/Ark0N/Codeman/releases/tag/codeman%401.47.0). Thank you for tracing this through a real Access + Tunnel hostname, and for the thorough tests. At merge I added the |
Bodyless POST requests sent through Cloudflare Tunnel can reach Codeman as HTTP/1.1 chunked requests with no
Content-Typeand zero payload bytes. Fastify rejects these with415 FST_ERR_CTP_INVALID_MEDIA_TYPEbefore the route handler runs, breaking actions such as opening saved web previews.Register a shared fallback parser that accepts an untyped API POST only after confirming its stream is empty. It preserves
request.body === undefinedand the original headers. Nonempty untyped streams are rejected on the first byte without buffering the remaining body.Existing JSON, text and multipart parsers retain precedence. Required-body validation, authentication, unknown-route handling and the webview proxy’s encapsulated stream parser remain in effect.
Validation: