Update ProxyUrlReplaceSettingsModel with TransformTemplate property (#1362)

* Update ProxyUrlReplaceSettingsModel with TransformTemplate property + parse settings correctly

* oldValue nullable

* <Version>1.14.0-preview-01</Version>
This commit is contained in:
Stef Heyenrath
2025-10-06 09:16:25 +02:00
committed by GitHub
parent b82dad2563
commit b9019a2f61
5 changed files with 111 additions and 8 deletions

View File

@@ -0,0 +1,29 @@
{
Guid: 90356dba-b36c-469a-a17e-669cd84f1f06,
UpdatedAt: DateTime_1,
Request: {
Path: {
Matchers: [
{
Name: WildcardMatcher,
Pattern: /1,
IgnoreCase: false
}
]
},
Body: {
Matcher: {
Name: RegexMatcher,
Pattern: hello,
IgnoreCase: true
}
}
},
Response: {
ProxyUrl: https://my-proxy.com,
ProxyUrlReplaceSettings: {
IgnoreCase: false,
TransformTemplate: x{{this}}y
}
}
}

View File

@@ -450,6 +450,55 @@ public partial class WireMockAdminApiTests
server.Stop();
}
[Fact]
public async Task IWireMockAdminApi_GetMappingAsync_WithProxy_And_ProxyUrlReplaceSettings_And_TransformTemplate()
{
// Arrange
var guid = Guid.Parse("90356dba-b36c-469a-a17e-669cd84f1f06");
var server = WireMockServer.StartWithAdminInterface();
var api = RestClient.For<IWireMockAdminApi>(server.Url);
// Act
var model = new MappingModel
{
Guid = guid,
Request = new RequestModel
{
Path = "/1",
Body = new BodyModel
{
Matcher = new MatcherModel
{
Name = "RegexMatcher",
Pattern = "hello",
IgnoreCase = true
}
}
},
Response = new ResponseModel
{
ProxyUrl = "https://my-proxy.com",
ProxyUrlReplaceSettings = new ProxyUrlReplaceSettingsModel
{
TransformTemplate = "x{{this}}y"
}
}
};
var postMappingResult = await api.PostMappingAsync(model).ConfigureAwait(false);
// Assert
postMappingResult.Should().NotBeNull();
var mapping = server.Mappings.FirstOrDefault(m => m.Guid == guid);
mapping.Should().NotBeNull();
var getMappingResult = await api.GetMappingAsync(guid).ConfigureAwait(false);
await Verifier.Verify(getMappingResult, VerifySettings).DontScrubGuids();
server.Stop();
}
[Fact]
public async Task IWireMockAdminApi_GetRequestsAsync_Json()
{