343fde250c
patchedWrite checks isStreamingContentType() before buffering; patchedEnd only had the headersSent half. A 5xx response that sets a streaming content-type and delivers its body via single-call res.end(chunk) would get buffered, UTF-8 decoded, and run through the leak regex — wrong shape for binary/SSE payloads. Mirrors the patchedWrite guard so the same bypass applies regardless of write/end call shape. Test pins the contract: a 5xx octet-stream body whose bytes contain "P1001" passes through unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>