From 68ba94218a6e12ab8d88850bf3d5e39e558bfc6f Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Tue, 18 Jul 2017 09:08:49 -0700 Subject: [PATCH] IsNullOrWhiteSpace => IsNullOrEmpty --- .../Internal/ParsingHelpers.cs | 8 ++++---- src/Microsoft.AspNetCore.Http/HeaderDictionary.cs | 2 +- .../DictionaryStringValuesWrapper.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.AspNetCore.Http.Abstractions/Internal/ParsingHelpers.cs b/src/Microsoft.AspNetCore.Http.Abstractions/Internal/ParsingHelpers.cs index 173ea4438d..59ffd2bf19 100644 --- a/src/Microsoft.AspNetCore.Http.Abstractions/Internal/ParsingHelpers.cs +++ b/src/Microsoft.AspNetCore.Http.Abstractions/Internal/ParsingHelpers.cs @@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Http.Internal throw new ArgumentNullException(nameof(headers)); } - if (string.IsNullOrWhiteSpace(key)) + if (string.IsNullOrEmpty(key)) { throw new ArgumentNullException(nameof(key)); } @@ -72,7 +72,7 @@ namespace Microsoft.AspNetCore.Http.Internal // Quote items that contain comas and are not already quoted. private static string QuoteIfNeeded(string value) { - if (!string.IsNullOrWhiteSpace(value) && + if (!string.IsNullOrEmpty(value) && value.Contains(',') && (value[0] != '"' || value[value.Length - 1] != '"')) { @@ -83,7 +83,7 @@ namespace Microsoft.AspNetCore.Http.Internal private static string DeQuote(string value) { - if (!string.IsNullOrWhiteSpace(value) && + if (!string.IsNullOrEmpty(value) && (value.Length > 1 && value[0] == '"' && value[value.Length - 1] == '"')) { value = value.Substring(1, value.Length - 2); @@ -99,7 +99,7 @@ namespace Microsoft.AspNetCore.Http.Internal throw new ArgumentNullException(nameof(headers)); } - if (string.IsNullOrWhiteSpace(key)) + if (string.IsNullOrEmpty(key)) { throw new ArgumentNullException(nameof(key)); } diff --git a/src/Microsoft.AspNetCore.Http/HeaderDictionary.cs b/src/Microsoft.AspNetCore.Http/HeaderDictionary.cs index 30d338a20b..b0224d25ee 100644 --- a/src/Microsoft.AspNetCore.Http/HeaderDictionary.cs +++ b/src/Microsoft.AspNetCore.Http/HeaderDictionary.cs @@ -100,7 +100,7 @@ namespace Microsoft.AspNetCore.Http long value; var rawValue = this[HeaderNames.ContentLength]; if (rawValue.Count == 1 && - !string.IsNullOrWhiteSpace(rawValue[0]) && + !string.IsNullOrEmpty(rawValue[0]) && HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value)) { return value; diff --git a/src/Microsoft.AspNetCore.Owin/DictionaryStringValuesWrapper.cs b/src/Microsoft.AspNetCore.Owin/DictionaryStringValuesWrapper.cs index bef2a0e27c..b31c7e9790 100644 --- a/src/Microsoft.AspNetCore.Owin/DictionaryStringValuesWrapper.cs +++ b/src/Microsoft.AspNetCore.Owin/DictionaryStringValuesWrapper.cs @@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.Owin } if (rawValue.Length == 1 && - !string.IsNullOrWhiteSpace(rawValue[0]) && + !string.IsNullOrEmpty(rawValue[0]) && HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value)) { return value;