Mark BlacklistedHeaders and BlacklistedCookies as obsolete (#492)

* #489

* .

* FluentMockServerSettings
This commit is contained in:
Stef Heyenrath
2020-07-27 17:24:24 +02:00
committed by GitHub
parent 9491280fd2
commit 9a532108b8
9 changed files with 39 additions and 29 deletions

View File

@@ -13,9 +13,9 @@ namespace WireMock.Net.StandAlone
public static class StandAloneApp
{
/// <summary>
/// Start WireMock.Net standalone Server based on the FluentMockServerSettings.
/// Start WireMock.Net standalone Server based on the IWireMockServerSettings.
/// </summary>
/// <param name="settings">The FluentMockServerSettings</param>
/// <param name="settings">The IWireMockServerSettings</param>
[PublicAPI]
public static WireMockServer Start([NotNull] IWireMockServerSettings settings)
{

View File

@@ -1,7 +1,9 @@
using WireMock.Settings;
using System;
using WireMock.Settings;
namespace WireMock.Server
{
[Obsolete("Use WireMockServer. This will removed in next version (1.3.x)")]
public class FluentMockServer : WireMockServer
{
public FluentMockServer(IFluentMockServerSettings settings) : base((IWireMockServerSettings) settings)

View File

@@ -290,7 +290,7 @@ namespace WireMock.Server
return responseMessage;
}
private IMapping ToMapping(RequestMessage requestMessage, ResponseMessage responseMessage, string[] blacklistedHeaders, string[] blacklistedCookies)
private IMapping ToMapping(RequestMessage requestMessage, ResponseMessage responseMessage, string[] excludedHeaders, string[] excludedCookies)
{
var request = Request.Create();
request.WithPath(requestMessage.Path);
@@ -299,16 +299,16 @@ namespace WireMock.Server
requestMessage.Query.Loop((key, value) => request.WithParam(key, false, value.ToArray()));
requestMessage.Cookies.Loop((key, value) =>
{
if (!blacklistedCookies.Contains(key, StringComparer.OrdinalIgnoreCase))
if (!excludedCookies.Contains(key, StringComparer.OrdinalIgnoreCase))
{
request.WithCookie(key, value);
}
});
var allBlackListedHeaders = new List<string>(blacklistedHeaders) { "Cookie" };
var allExcludedHeaders = new List<string>(excludedHeaders) { "Cookie" };
requestMessage.Headers.Loop((key, value) =>
{
if (!allBlackListedHeaders.Contains(key, StringComparer.OrdinalIgnoreCase))
if (!allExcludedHeaders.Contains(key, StringComparer.OrdinalIgnoreCase))
{
request.WithHeader(key, value.ToArray());
}

View File

@@ -1,8 +1,11 @@
namespace WireMock.Settings
using System;
namespace WireMock.Settings
{
/// <summary>
/// FluentMockServerSettings
/// </summary>
[Obsolete("Use WireMockServerSettings. This will removed in next version (1.3.x)")]
public class FluentMockServerSettings : WireMockServerSettings
{
}

View File

@@ -1,8 +1,11 @@
namespace WireMock.Settings
using System;
namespace WireMock.Settings
{
/// <summary>
/// IFluentMockServerSettings
/// </summary>
[Obsolete("Use IWireMockServerSettings. This will removed in next version (1.3.x)")]
public interface IFluentMockServerSettings : IWireMockServerSettings
{
}

View File

@@ -1,4 +1,5 @@
using JetBrains.Annotations;
using System;
using JetBrains.Annotations;
namespace WireMock.Settings
{
@@ -38,11 +39,13 @@ namespace WireMock.Settings
/// <summary>
/// Defines a list from headers which will excluded from the saved mappings.
/// </summary>
[Obsolete("Will be renamed to ExcludedHeaders in next version (1.3.x)")]
string[] BlackListedHeaders { get; set; }
/// <summary>
/// Defines a list of cookies which will excluded from the saved mappings.
/// </summary>
[Obsolete("Will be renamed to ExcludedCookies in next version (1.3.x)")]
string[] BlackListedCookies { get; set; }
/// <summary>

View File

@@ -1,4 +1,5 @@
using JetBrains.Annotations;
using System;
using JetBrains.Annotations;
namespace WireMock.Settings
{
@@ -39,16 +40,14 @@ namespace WireMock.Settings
[PublicAPI]
public string ClientX509Certificate2ThumbprintOrSubjectName { get; set; }
/// <summary>
/// Defines a list from headers which will excluded from the saved mappings.
/// </summary>
/// <inheritdoc cref="IProxyAndRecordSettings.BlackListedHeaders"/>
[PublicAPI]
[Obsolete("Will be renamed to ExcludedHeaders in next version (1.3.x)")]
public string[] BlackListedHeaders { get; set; }
/// <summary>
/// Defines a list of cookies which will excluded from the saved mappings.
/// </summary>
/// <inheritdoc cref="IProxyAndRecordSettings.BlackListedCookies"/>
[PublicAPI]
[Obsolete("Will be renamed to ExcludedCookies in next version (1.3.x)")]
public string[] BlackListedCookies { get; set; }
/// <inheritdoc cref="IProxyAndRecordSettings.WebProxySettings"/>