Skip to content

Commit 0933a12

Browse files
committed
Add tests for custom admin path behaviour
1 parent 1ab6ca5 commit 0933a12

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

src/WireMock.Net.Minimal/Server/AdminPaths.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace WireMock.Owin;
88
internal sealed class AdminPaths(string? adminPath) : IAdminPaths
99
{
1010
private const string DefaultAdminPathPrefix = "/__admin";
11-
11+
1212
private readonly string _prefix = adminPath ?? DefaultAdminPathPrefix;
1313

1414
public string Files => $"{_prefix}/files";

test/WireMock.Net.Tests/WireMockServer.Admin.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,4 +648,24 @@ public async Task WireMockServer_CreateClient_And_CallAdminSettingsEndpoint()
648648
// Assert
649649
settings.Should().NotBeNull();
650650
}
651+
652+
[Fact]
653+
public async Task WireMockServer_WithCustomAdminPath_AdminRequestsNotInLogEntries()
654+
{
655+
// Arrange
656+
var cancellationToken = TestContext.Current.CancellationToken;
657+
using var server = WireMockServer.Start(w =>
658+
{
659+
w.Logger = new TestOutputHelperWireMockLogger(output);
660+
w.StartAdminInterface = true;
661+
w.AdminPath = "/custom/__admin";
662+
});
663+
var client = server.CreateClient();
664+
665+
// Act
666+
await client.GetAsync($"{server.Url}/custom/__admin/settings", cancellationToken);
667+
668+
// Assert
669+
server.LogEntries.Should().BeEmpty();
670+
}
651671
}

0 commit comments

Comments
 (0)