Description
DebugProbe currently reads the full outgoing HTTP request or response body as text before applying the configured capture size limit.
This means very large outgoing bodies can be fully loaded into memory even when only a small part of the body will be stored.
Current Behavior
Outgoing HTTP capture reads the complete body first, then trims it based on MaxBodyCaptureSizeKb.
This can create unnecessary memory pressure for large request or response bodies.
Expected Behavior
DebugProbe should limit how much outgoing body content is read from the stream.
The configured MaxBodyCaptureSizeKb limit should be applied before or during body reading, not only after the full body has already been loaded.
Suggested Fix
Update DebugProbeHttpClientHandler to read only up to the configured maximum capture size.
Recommended behavior:
- Read at most
MaxBodyCaptureSizeKb from outgoing request/response bodies.
- Mark the captured body as truncated when the original body exceeds the limit.
- Preserve the original HTTP behavior.
- Avoid consuming or modifying the body in a way that affects the actual outgoing request/response.
Result
After this change:
- Large outgoing HTTP bodies no longer create unnecessary memory pressure.
- Capture limits are enforced correctly.
- Outgoing request/response inspection remains safe for larger payloads.
- Existing behavior stays the same for small bodies.
Description
DebugProbe currently reads the full outgoing HTTP request or response body as text before applying the configured capture size limit.
This means very large outgoing bodies can be fully loaded into memory even when only a small part of the body will be stored.
Current Behavior
Outgoing HTTP capture reads the complete body first, then trims it based on
MaxBodyCaptureSizeKb.This can create unnecessary memory pressure for large request or response bodies.
Expected Behavior
DebugProbe should limit how much outgoing body content is read from the stream.
The configured
MaxBodyCaptureSizeKblimit should be applied before or during body reading, not only after the full body has already been loaded.Suggested Fix
Update
DebugProbeHttpClientHandlerto read only up to the configured maximum capture size.Recommended behavior:
MaxBodyCaptureSizeKbfrom outgoing request/response bodies.Result
After this change: