Skip to content

Fix ResponseSize to Represent Actual Response Bytes #115

@georgidhristov

Description

@georgidhristov

Description

DebugProbe currently records ResponseSize based on the captured or marker response body size.

When response body capture is limited or skipped, this value may not represent the actual number of bytes sent to the client.

Current Behavior

DebugProbeMiddleware records ResponseSize from the captured response body content.

This means ResponseSize can show:

  • the truncated captured body size
  • the marker text size
  • or another internal capture value

instead of the real response payload size.

Expected Behavior

ResponseSize should represent the actual response size sent by the application whenever possible.

Captured body size and actual response size should not be confused.

Suggested Fix

Track the actual number of response bytes written to the response stream.

Recommended behavior:

  • ResponseSize should store actual bytes sent to the client.
  • Captured body content should remain limited by MaxBodyCaptureSizeKb.
  • If actual size cannot be determined, use null or a clear fallback value.
  • Avoid using marker text length as the response size.

Result

After this change:

  • Response size reporting becomes accurate.
  • Truncated captures no longer produce misleading size values.
  • Dashboard data better reflects real HTTP behavior.
  • Debugging large responses becomes more reliable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions