Fix: Fully respect configured custom admin path (merge PR #1483)#1490
Merged
Conversation
…olve WireMockMiddlewareLogger conflict
Copilot created this pull request from a session on behalf of
StefH
July 17, 2026 17:05
View session
StefH
marked this pull request as ready for review
July 17, 2026 17:06
Contributor
There was a problem hiding this comment.
Pull request overview
This PR makes WireMock.Net.Minimal fully respect a custom AdminPath (from WireMockServerSettings) by introducing an injectable IAdminPaths abstraction and routing all admin-path checks through it, eliminating hardcoded "/__admin/" assumptions across middleware, logging, and admin request filtering.
Changes:
- Added
IAdminPaths/AdminPathsand flowed it throughIWireMockMiddlewareOptionsand ASP.NET Core DI so middleware/logger can correctly detect admin requests for any configured prefix. - Updated admin-request filtering and tracing exclusion logic to use
adminPaths.Includes(path)instead ofStartsWith("/__admin/"). - Added/updated tests to cover custom-admin-path behavior (ensuring admin requests don’t appear in request log entries).
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/WireMock.Net.Tests/WireMockServer.Admin.cs | Adds a test asserting admin requests under a custom admin path are not recorded in LogEntries. |
| test/WireMock.Net.Tests/Owin/WireMockMiddlewareTests.cs | Updates middleware construction to provide IAdminPaths for the new DI/constructor shape. |
| src/WireMock.Net.Minimal/Server/WireMockServer.Admin.cs | Switches admin log filtering to use the configured IAdminPaths instead of hardcoded "/__admin/". |
| src/WireMock.Net.Minimal/Server/AdminPaths.cs | Introduces the AdminPaths implementation providing configured admin endpoints and matchers. |
| src/WireMock.Net.Minimal/Owin/WireMockMiddlewareOptionsHelper.cs | Populates options.AdminPaths from WireMockServerSettings.AdminPath. |
| src/WireMock.Net.Minimal/Owin/WireMockMiddlewareOptions.cs | Adds the AdminPaths option with a default instance. |
| src/WireMock.Net.Minimal/Owin/WireMockMiddlewareLogger.cs | Uses adminPaths.Includes(...) to classify admin requests and keeps UtcNow via IDateTimeUtils. |
| src/WireMock.Net.Minimal/Owin/WireMockMiddleware.cs | Uses adminPaths.Includes(...) for tracing exclusion of admin requests. |
| src/WireMock.Net.Minimal/Owin/IWireMockMiddlewareOptions.cs | Exposes IAdminPaths on middleware options. |
| src/WireMock.Net.Minimal/Owin/IAdminPaths.cs | Defines the injectable admin-path abstraction and Includes(path) helper. |
| src/WireMock.Net.Minimal/Owin/AspNetCoreSelfHost.cs | Registers AdminPaths into DI so middleware/logger can resolve it. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1490 +/- ##
==========================================
+ Coverage 30.62% 31.14% +0.52%
==========================================
Files 162 166 +4
Lines 42168 43436 +1268
==========================================
+ Hits 12912 13529 +617
- Misses 28918 29571 +653
+ Partials 338 336 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
StefH
approved these changes
Jul 18, 2026
This was referenced Jul 20, 2026
Open
This was referenced Jul 20, 2026
Open
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WireMock.Net.Minimalhardcoded/__admin/in several places, ignoring any customAdminPathset viaWireMockServerSettings. This merges PR #1483 (bugfix/1482) onto currentmaster, resolving the conflict inWireMockMiddlewareLogger.Changes
AdminPaths/IAdminPaths— new injectable abstraction wrapping the configured admin path, with anIncludes(path)helper that respects whatever prefix was configuredIWireMockMiddlewareOptions— exposesAdminPathsso it flows into middlewareWireMockMiddleware— injectsIAdminPathsinto the DI pipeline viaAspNetCoreSelfHostWireMockMiddlewareLogger— conflict resolution: takes bothIAdminPaths(PR) andIDateTimeUtils(master); usesadminPaths.Includes(path)instead of the hardcodedStartsWith("/__admin/"), and usesdateTimeUtils.UtcNowfor log expirationWireMockServer.Admin— builds and cachesAdminPathsfrom the settings at startupWireMockMiddlewareTestsandWireMockServer.Admintests cover the custom-path behaviour