mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-22 09:30:18 +01:00
* ProxyUrlTransformer * tests * Update src/WireMock.Net.Shared/Settings/ProxyUrlReplaceSettings.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
21 lines
730 B
C#
21 lines
730 B
C#
// Copyright © WireMock.Net
|
|
|
|
using System;
|
|
using WireMock.Settings;
|
|
using WireMock.Transformers;
|
|
|
|
namespace WireMock.Proxy;
|
|
|
|
internal static class ProxyUrlTransformer
|
|
{
|
|
internal static string Transform(WireMockServerSettings settings, ProxyUrlReplaceSettings replaceSettings, string url)
|
|
{
|
|
if (!replaceSettings.UseTransformer)
|
|
{
|
|
return url.Replace(replaceSettings.OldValue, replaceSettings.NewValue, replaceSettings.IgnoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal);
|
|
}
|
|
|
|
var transformer = TransformerFactory.Create(replaceSettings.TransformerType, settings);
|
|
return transformer.Transform(replaceSettings.TransformTemplate, url);
|
|
}
|
|
} |