Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
19c0b76
Add new HttpStatusCodeRangeExtensions and tests.
ericsampson Nov 11, 2025
8b3ea27
Improve tests.
ericsampson Nov 11, 2025
56e3bf8
Add test that currently fails to prove the fix works.
ericsampson Nov 11, 2025
b97a6bd
Enhance the HttpFailedRequestHandler so that it captures a full excep…
ericsampson Nov 11, 2025
fd65e67
Merge branch 'main' into SentryHttpMessageHandler-issue-grouping
ericsampson Nov 17, 2025
02e69b1
Delete tests for deleted functionality.
ericsampson Nov 17, 2025
c9da3c7
Update test/Sentry.Tests/HttpStatusCodeRangeExtensionsTests.cs
ericsampson Nov 17, 2025
a07ed5d
Switch to using ExceptionDispatchInfo.SetCurrentStackTrace
ericsampson Nov 17, 2025
c4b981d
Update re PR feedback
ericsampson Nov 17, 2025
ced8585
Update with PR feedback
ericsampson Nov 17, 2025
7a1573a
PR feedback
ericsampson Nov 17, 2025
02a16b4
PR feedback
ericsampson Nov 17, 2025
77132f5
Add note to changelog
ericsampson Nov 17, 2025
46bcc41
Update src/Sentry/SentryHttpFailedRequestHandler.cs
ericsampson Nov 17, 2025
70232c3
Update src/Sentry/SentryHttpFailedRequestHandler.cs re method availab…
ericsampson Nov 18, 2025
7a90dac
format test/Sentry.Tests/SentryHttpFailedRequestHandlerTests.cs
ericsampson Nov 18, 2025
f8edf37
Update test for running on .NET5+
ericsampson Nov 18, 2025
e3fc2bc
Merge branch 'main' into SentryHttpMessageHandler-issue-grouping
ericsampson Nov 18, 2025
c76afd1
update Changelog re PR feedback
ericsampson Nov 18, 2025
885d728
Update CHANGELOG.md
ericsampson Nov 19, 2025
3901dd0
Merge branch 'main' into SentryHttpMessageHandler-issue-grouping
ericsampson Nov 19, 2025
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
Prev Previous commit
Next Next commit
PR feedback
  • Loading branch information
ericsampson committed Nov 17, 2025
commit 02a16b4fe237ff3c0f601d3c1df7f5c1f2bbcf30
25 changes: 14 additions & 11 deletions test/Sentry.Tests/SentryHttpFailedRequestHandlerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void HandleResponse_Disabled_DontCapture()
[InlineData(404)] // Not Found
[InlineData(499)] // Edge of client error range
[InlineData(600)] // Beyond default range
public void HandleResponse_EnabledButNotInRange_DontCapture(int statusCode)
public void HandleResponse_EnabledButNotInDefaultRange_DontCapture(int statusCode)
{
// Arrange
var sut = GetSut(new SentryOptions
Expand Down Expand Up @@ -192,8 +192,11 @@ public void HandleResponse_NoMatchingFailedRequestTarget_DontCapture()
_hub.DidNotReceiveWithAnyArgs().CaptureEvent(null!);
}

[Fact]
public void HandleResponse_FailedRequest_DoCapture()
[Theory]
[InlineData(500)] // Internal Server Error - in range
[InlineData(503)] // Service Unavailable - in range
[InlineData(599)] // Edge of range
public void HandleResponse_FailedRequestInDefaultRange_DoCapture(int statusCode)
{
// Arrange
var options = new SentryOptions
Expand All @@ -202,7 +205,7 @@ public void HandleResponse_FailedRequest_DoCapture()
};
var sut = GetSut(options);

var response = InternalServerErrorResponse();
var response = new HttpResponseMessage((HttpStatusCode)statusCode);
response.RequestMessage = new HttpRequestMessage();

// Act
Expand All @@ -213,7 +216,7 @@ public void HandleResponse_FailedRequest_DoCapture()
}

[Fact]
public void HandleResponse_FailedRequestNoPii_DoCaptureWithoutPii()
public void HandleResponse_FailedRequest_HasSanitizedUrl()
{
// Arrange
var options = new SentryOptions
Expand All @@ -236,7 +239,7 @@ public void HandleResponse_FailedRequestNoPii_DoCaptureWithoutPii()
}

[Fact]
public void HandleResponse_Capture_RequestAndResponse()
public void HandleResponse_FailedRequest_HasRequestAndResponse()
{
// Arrange
var options = new SentryOptions
Expand Down Expand Up @@ -287,7 +290,7 @@ public void HandleResponse_Capture_RequestAndResponse()
}

[Fact]
public void HandleResponse_Capture_Default_SkipCookiesAndHeaders()
public void HandleResponse_FailedRequestNoPii_SkipsCookiesAndHeaders()
{
// Arrange
var options = new SentryOptions
Expand Down Expand Up @@ -320,7 +323,7 @@ public void HandleResponse_Capture_Default_SkipCookiesAndHeaders()
}

[Fact]
public void HandleResponse_Hint_DoCaptureHint()
public void HandleResponse_FailedRequestWithHint_HasHint()
{
// Arrange
var options = new SentryOptions
Expand Down Expand Up @@ -348,7 +351,7 @@ public void HandleResponse_Hint_DoCaptureHint()
}

[Fact]
public void HandleResponse_ExceptionHasStackTrace()
public void HandleResponse_FailedRequest_HasExceptionWithStackTrace()
{
// Arrange
var options = new SentryOptions
Expand Down Expand Up @@ -376,7 +379,7 @@ public void HandleResponse_ExceptionHasStackTrace()

#if NET6_0_OR_GREATER // This test is only valid on .NET 6+ where we can use SetRemoteStackTrace
[Fact]
public void HandleResponse_StackTraceIncludesCallerContext()
public void HandleResponse_FailedRequest_ExceptionStackTraceHasCallerContext()
{
// Arrange
var options = new SentryOptions
Expand All @@ -400,7 +403,7 @@ public void HandleResponse_StackTraceIncludesCallerContext()
@event.Exception.Should().NotBeNull();

// Stack trace should include this test method name, proving we captured caller context on .NET 6+
@event.Exception!.StackTrace.Should().Contain(nameof(HandleResponse_StackTraceIncludesCallerContext));
@event.Exception!.StackTrace.Should().Contain(nameof(HandleResponse_FailedRequest_ExceptionStackTraceHasCallerContext));
}
}
#endif
Expand Down