mirror of
https://github.com/oven-sh/bun
synced 2026-02-14 04:49:06 +00:00
Per Node.js documentation, `res.addTrailers()` should silently discard trailers when chunked encoding is not enabled, rather than throwing an error. This matches Node.js behavior where trailers set via addTrailers() are only emitted if chunked encoding is used. Previously, Bun threw ERR_HTTP_TRAILER_INVALID when trailers were set via addTrailers() and chunked encoding was not enabled. Now we only throw when the "Trailer" header is explicitly set (indicating intent to send trailers), while silently discarding trailers set via addTrailers() when chunked encoding is not in use. Fixes #26171 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>