Skip to content

Commit

Permalink
fix(CA1307): 'string.Replace(string, string)' has a method overload t…
Browse files Browse the repository at this point in the history
…hat takes a 'StringComparison' parameter.
  • Loading branch information
skwasjer committed Feb 3, 2024
1 parent df62edf commit 569dce9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/MockHttp/Http/DataEscapingHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ internal static IEnumerable<KeyValuePair<string, IEnumerable<string>>> 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
)!);
Expand Down
8 changes: 7 additions & 1 deletion src/MockHttp/Matchers/HttpHeadersMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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')}";
Expand Down

0 comments on commit 569dce9

Please sign in to comment.