From aa100e2492f7334f5bed373ea7bd6a4137d5e0d3 Mon Sep 17 00:00:00 2001 From: skwasjer <11424653+skwasjer@users.noreply.github.com> Date: Sat, 3 Feb 2024 04:09:19 +0100 Subject: [PATCH] fix(CA1307): 'string.Replace(string, string)' has a method overload that takes a 'StringComparison' parameter. --- src/MockHttp/Http/DataEscapingHelper.cs | 3 ++- src/MockHttp/Matchers/HttpHeadersMatcher.cs | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/MockHttp/Http/DataEscapingHelper.cs b/src/MockHttp/Http/DataEscapingHelper.cs index 4feeb518..3a11165b 100644 --- a/src/MockHttp/Http/DataEscapingHelper.cs +++ b/src/MockHttp/Http/DataEscapingHelper.cs @@ -50,8 +50,9 @@ internal static IEnumerable>> Parse(str private static string UnescapeData(string v) { + // ReSharper disable once ConditionalAccessQualifierIsNonNullableAccordingToAPIContract return Uri.UnescapeDataString(v?.Replace("+", "%20" -#if NET7_0_OR_GREATER || NETSTANDARD2_1 +#if NET6_0_OR_GREATER || NETSTANDARD2_1 , StringComparison.Ordinal #endif )!); diff --git a/src/MockHttp/Matchers/HttpHeadersMatcher.cs b/src/MockHttp/Matchers/HttpHeadersMatcher.cs index 058a227f..c4ddb85b 100644 --- a/src/MockHttp/Matchers/HttpHeadersMatcher.cs +++ b/src/MockHttp/Matchers/HttpHeadersMatcher.cs @@ -111,7 +111,13 @@ public override string ToString() { string value = Value.ToString(); #if !NET6_0_OR_GREATER - value = value.Replace("\r\n", Environment.NewLine); + value = value.Replace( + "\r\n", + Environment.NewLine +#if NETSTANDARD2_1 + , StringComparison.OrdinalIgnoreCase +#endif + ); #endif return $"Headers: {value.TrimEnd('\r', '\n')}";