pub async fn transform_response_body(
resp: Response<ProxyBody>,
compiled: &CompiledJsonTransform,
rid: &str,
) -> Response<ProxyBody>Expand description
The RESPONSE body transform (DW-028), the decoration tail’s first stage: gate, buffer (capped), parse, apply ops, serialize. Gates: informational/101/204/304 statuses (no body to shape), non-JSON content type, and an already-encoded body all pass through UNTOUCHED — SSE and streamed downloads on a transformed route keep streaming, the core guarantee of this feature. A declared length over the cap fails 502 without reading.
Two properties fall out of buffering before headers reach the client: an upstream stream death mid-body answers a CLEAN 502 envelope instead of a torn stream, and upstream trailers are dropped (they described the pre-transform body — forwarding a stale checksum trailer alongside replaced bytes would be a lie).