You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`response.body.size`|`loggableBody.snapshot(bodyPreviewMaxBytes)`| Size of the **captured preview** — bounded by `bodyPreviewMaxBytes`|
264
+
|`response.body.preview`| the same captured bytes, decoded as UTF-8 | The preview text (a prefix for an over-cap body) |
265
+
|`response.content.length`|`response.body.contentLength()`| The body's **true** length when the origin declared one (`Content-Length`); `-1` for unknown-length / streaming bodies |
266
+
267
+
So `response.body.size` is the *captured/preview* size, **not** necessarily the full body size.
268
+
When a body exceeds the cap, `response.body.size` saturates near `bodyPreviewMaxBytes` while
269
+
`response.content.length` still shows the real length. Read `content.length` (not
270
+
`body.size`) when you need the full size, and treat `body.preview` as a prefix that may be
271
+
truncated. The two agree only when the whole body fit within the cap — exactly the case where
272
+
`contentLength()` itself returns the captured size (see **`contentLength()`** above).
273
+
274
+
**Streaming / unknown-length bodies (async path).**`DefaultAsyncInstrumentationStep` skips the
275
+
capture entirely when `contentLength() < 0`, because the bounded drain would run on the
276
+
future-completion thread and a slow producer could stall it. Such bodies stream to the consumer
277
+
unwrapped, so they carry **no**`response.body.size` / `response.body.preview` fields at all —
278
+
absence of those fields is expected for chunked or streaming responses, not a logging bug. The
279
+
synchronous `DefaultInstrumentationStep` drains known-length and unknown-length bodies alike (it
280
+
runs on the caller's thread), but the size-vs-preview distinction above applies to it just the
0 commit comments