Skip to content

Commit 5e59e7b

Browse files
committed
docs: flag error-body truncation in ThrowOnHttpErrorStep
The buffered error body is capped at DEFAULT_SNAPSHOT_BYTES; an oversized body is hard-truncated with no marker. Document that downstream consumers deserializing the buffered body must tolerate a structurally incomplete payload, and that callers needing the full body must read it before this step runs.
1 parent 28a0261 commit 5e59e7b

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎sdk-core/src/main/kotlin/org/dexpace/sdk/core/pipeline/step/ThrowOnHttpErrorStep.kt‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ import org.dexpace.sdk.core.io.Io
5252
* `bodySnapshot` cap, so a multi-megabyte 5xx body cannot OOM the process. Mapping the buffered
5353
* body into a typed error value is still left to the generated layer (see [HttpException.value]).
5454
*
55+
* The cap is a hard truncation, not just an OOM guard: an error body larger than
56+
* [HttpException.DEFAULT_SNAPSHOT_BYTES] is preserved only up to that many bytes, and the excess
57+
* is discarded with no marker. This is harmless for a log-line snapshot, but a downstream
58+
* consumer that deserializes the buffered body (e.g. the generated layer parsing it into
59+
* [HttpException.value]) must tolerate a structurally incomplete payload — a JSON object cut
60+
* mid-token will not parse. Callers that need the full error body must read it from the live
61+
* response before this step runs rather than relying on the buffered copy.
62+
*
5563
* ## Thread-safety
5664
*
5765
* Stateless; safe to share across concurrent requests and reuse as a singleton.

0 commit comments

Comments
 (0)