Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public async Task Handles_large_response_within_limit()
await app.Client.GetAsync("/large");

Assert.Equal(body, app.SingleEntry.ResponseBody);
Assert.Equal(body.Length, app.SingleEntry.ResponseSize);
}

[Fact]
Expand All @@ -54,6 +55,7 @@ public async Task Handles_binary_response_safely()
await app.Client.GetAsync("/binary");

Assert.Equal("[Body not captured: non-text content]", app.SingleEntry.ResponseBody);
Assert.Equal(4, app.SingleEntry.ResponseSize);
}

[Fact]
Expand All @@ -69,5 +71,6 @@ public async Task Validates_bounded_response_capture_behavior()
var entry = app.SingleEntry;
Assert.Equal(body, await response.Content.ReadAsStringAsync());
Assert.Equal("[Body too large]", entry.ResponseBody);
Assert.Equal(body.Length, entry.ResponseSize);
}
}
2 changes: 1 addition & 1 deletion DebugProbe.AspNetCore/Middleware/DebugProbeMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public async Task Invoke(HttpContext context, DebugEntryStore store)

entry.RequestSize = context.Request.ContentLength ?? Encoding.UTF8.GetByteCount(requestBody);

entry.ResponseSize = Encoding.UTF8.GetByteCount(responseBody);
entry.ResponseSize = responseCapture.TotalBytesWritten;

entry.RequestHeaders =
context.Request.Headers.ToDictionary(
Expand Down
Loading