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,17 @@ public async Task Ignored_paths_are_skipped()
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Empty(app.Store.GetAll());
}
[Fact]
public async Task Similar_paths_are_not_skipped()
{
await using var app = await DebugProbeTestApp.CreateAsync(
endpoints => endpoints.MapGet("/healthcare", () => Results.Ok()),
options => options.IgnorePaths = ["/health"]);

var response = await app.Client.GetAsync("/healthcare");
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Single(app.Store.GetAll());
}

[Theory]
[InlineData("/health")]
Expand Down
4 changes: 3 additions & 1 deletion DebugProbe.AspNetCore/Middleware/DebugProbeMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ private bool IsIgnoredPath(PathString requestPath)
return DefaultIgnorePaths
.Concat(_options.IgnorePaths)
.Distinct(StringComparer.OrdinalIgnoreCase)
.Any(ignorePath => path.StartsWith(ignorePath, StringComparison.OrdinalIgnoreCase));
.Any(ignorePath =>
path.Equals(ignorePath, StringComparison.OrdinalIgnoreCase) ||
path.StartsWith(ignorePath.TrimEnd('/') + "/", StringComparison.OrdinalIgnoreCase));
}

private static async Task<string> CaptureRequestBodyAsync(HttpContext context, int maxBodySize)
Expand Down
Loading