cloudflare / vinext

fix: bound fetch cache key body serialization (#176)
* fix: bound fetch cache key body serialization * Safeguard cache key serialization from large bodies Bump cache key version to v2 and add safeguards to serializeBody to avoid OOM when processing large request bodies. Track cumulative raw byte size of streamed chunks and throw BodyTooLargeForCacheKeyError when exceeding the 1 MiB limit, call reader.cancel on errors, and add a cheap string-length pre-check. Adds tests covering oversized Uint8Array, string, multi-chunk ReadableStream, and FormData/File cases to verify such requests bypass the cache and still perform fetches. --------- Co-authored-by: Sunil Pai <spai@cloudflare.com>
Dane Dane committed on Feb 27, 2026, 10:30 PM
Showing 2 changed files +241 additions -57 deletions
Browse files at this commit โ†’