mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-20 16:44:31 +01:00
Proxy all requests - even a repeated one (#1038)
* Adding proxyall * Adding proxyAll flag * Reverting extra spaces added * Make proxyall to true * Resolving review comments for proxyall * Resolving codefactor spaces in the code * Adding proxyall parser in wmserversettingsparser --------- Co-authored-by: Sameena Syed <sameena.syed@nexigroup.com>
This commit is contained in:
@@ -73,4 +73,9 @@ public class ProxyAndRecordSettingsModel
|
||||
/// Defines the Replace Settings.
|
||||
/// </summary>
|
||||
public ProxyUrlReplaceSettingsModel? ReplaceSettings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Proxy all Api calls, irrespective of any condition
|
||||
/// </summary>
|
||||
public bool ProxyAll { get; set; } = false;
|
||||
}
|
||||
@@ -77,4 +77,6 @@ internal interface IWireMockMiddlewareOptions
|
||||
bool? DoNotSaveDynamicResponseInLogEntry { get; set; }
|
||||
|
||||
QueryParameterMultipleValueSupport? QueryParameterMultipleValueSupport { get; set; }
|
||||
|
||||
public bool ProxyAll { get; set; }
|
||||
}
|
||||
@@ -95,4 +95,7 @@ internal class WireMockMiddlewareOptions : IWireMockMiddlewareOptions
|
||||
|
||||
/// <inheritdoc />
|
||||
public QueryParameterMultipleValueSupport? QueryParameterMultipleValueSupport { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool ProxyAll { get; set; }
|
||||
}
|
||||
@@ -31,6 +31,11 @@ public partial class WireMockServer
|
||||
proxyRespondProvider.AtPriority(WireMockConstants.ProxyPriority);
|
||||
}
|
||||
|
||||
if(settings.ProxyAndRecordSettings.ProxyAll)
|
||||
{
|
||||
proxyRespondProvider.AtPriority(int.MinValue);
|
||||
}
|
||||
|
||||
proxyRespondProvider.RespondWith(new ProxyAsyncResponseProvider(ProxyAndRecordAsync, settings));
|
||||
}
|
||||
|
||||
|
||||
@@ -94,4 +94,10 @@ public class ProxyAndRecordSettings : HttpClientSettings
|
||||
/// Append an unique GUID to the filename from the saved mapping file.
|
||||
/// </summary>
|
||||
public bool AppendGuidToSavedMappingFile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Proxy all Api calls, irrespective of any condition
|
||||
/// </summary>
|
||||
[PublicAPI]
|
||||
public bool ProxyAll { get; set; } = false;
|
||||
}
|
||||
@@ -125,7 +125,8 @@ public static class WireMockServerSettingsParser
|
||||
{
|
||||
StatusCodePattern = parser.GetStringValue("SaveMappingForStatusCodePattern", "*"),
|
||||
// HttpMethods = new ProxySaveMappingSetting<string[]>(parser.GetValues("DoNotSaveMappingForHttpMethods", new string[0]), MatchBehaviour.RejectOnMatch)
|
||||
}
|
||||
},
|
||||
ProxyAll = parser.GetBoolValue(nameof(ProxyAndRecordSettings.ProxyAll))
|
||||
};
|
||||
|
||||
ParseWebProxyAddressSettings(proxyAndRecordSettings, parser);
|
||||
|
||||
Reference in New Issue
Block a user