Added feature to enable and disable mappings#1437
Open
jayaraman-venkatesan wants to merge 3 commits intowiremock:masterfrom
Open
Added feature to enable and disable mappings#1437jayaraman-venkatesan wants to merge 3 commits intowiremock:masterfrom
jayaraman-venkatesan wants to merge 3 commits intowiremock:masterfrom
Conversation
…tion that is causing upstream connection from proxy to teardown prematurely before test ends
StefH
requested changes
Apr 3, 2026
| await Task.Delay(500, _ct); | ||
|
|
||
| // Assert | ||
| // Assert immediately — receivedData is already in memory, no delay needed. |
Collaborator
There was a problem hiding this comment.
This change looks good, however can you remove this change in this PR?
I'll make a new PR which I use to fix these failing tests.
| /// <summary> | ||
| /// Value to determing if the mapping is active | ||
| /// </summary> | ||
| public bool? IsEnabled { get; set; } |
Collaborator
There was a problem hiding this comment.
It's better to make the functionality the other way around.
So
public bool IsDisabled { get; set; }
In this way,it's backwards compatible.
| var possibleMappings = new List<MappingMatcherResult>(); | ||
|
|
||
| var mappings = _options.Mappings.Values | ||
| .Where(m=>m.IsEnabled) |
Collaborator
There was a problem hiding this comment.
Do a format-file, so that the code is alligned (extra spaces)
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.
feat: add soft-disable support for mappings (#1421)
Summary
IsEnabledflag on mappings (defaults totrue) that prevents a mapping from being matched without deleting it, preserving it for post-test inspectionPUT /__admin/mappings/{guid}/enableandPUT /__admin/mappings/{guid}/disableadmin endpointsEnableMappingAsync/DisableMappingAsynctoIWireMockAdminApityped clientIsEnabled: falsecan be set in POST/PUT mapping body and round-trips throughGET /mappingsand static mapping filesGET /mappingsandserver.Mappings— only request matching skips themChanges
IRespondWithAProvider— newWithIsEnabled(bool)builder method (fluent, consistent withWithProbability/WithTitle)RespondWithAProvider— stores_isEnabled, applies it duringRespondWith()WireMockServer.ConvertMapping— callsWithIsEnabled(false)whenmappingModel.IsEnabled == falseMappingConverter.ToMappingModel— serializesIsEnabledasfalseonly when disabled (null = enabled, sparse/backward-compatible)WireMockServer.Admin— two new regex path matchers, two route registrations,MappingEnable/MappingDisablehandlers,TryParseGuidFromSecondToLastSegmenthelperMappingMatcherTests— fixedInitMappingshelper and exception test mock to setIsEnabled = true(required after.Where(m => m.IsEnabled)was added); addedWhenMappingIsDisabled_ShouldReturnNulltestWireMockAdminApiTests.IsEnabled— 4 integration tests covering create-disabled, disable endpoint, enable endpoint, GET serializationBackward compatibility
IsEnableddefaults totrueeverywhere — existing mappings, JSON files, and API clients are unaffectedIsEnabledfield is omitted from JSON whentrue(null) and only written whenfalseSubmitter checklist
#help-contributingor a project-specific channel like#wiremock-java