IsNullOrWhiteSpace => IsNullOrEmpty

This commit is contained in:
Justin Kotalik 2017-07-18 09:08:49 -07:00
parent ab0185a0b8
commit 68ba94218a
3 changed files with 6 additions and 6 deletions

View File

@ -55,7 +55,7 @@ namespace Microsoft.AspNetCore.Http.Internal
throw new ArgumentNullException(nameof(headers)); throw new ArgumentNullException(nameof(headers));
} }
if (string.IsNullOrWhiteSpace(key)) if (string.IsNullOrEmpty(key))
{ {
throw new ArgumentNullException(nameof(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. // Quote items that contain comas and are not already quoted.
private static string QuoteIfNeeded(string value) private static string QuoteIfNeeded(string value)
{ {
if (!string.IsNullOrWhiteSpace(value) && if (!string.IsNullOrEmpty(value) &&
value.Contains(',') && value.Contains(',') &&
(value[0] != '"' || value[value.Length - 1] != '"')) (value[0] != '"' || value[value.Length - 1] != '"'))
{ {
@ -83,7 +83,7 @@ namespace Microsoft.AspNetCore.Http.Internal
private static string DeQuote(string value) private static string DeQuote(string value)
{ {
if (!string.IsNullOrWhiteSpace(value) && if (!string.IsNullOrEmpty(value) &&
(value.Length > 1 && value[0] == '"' && value[value.Length - 1] == '"')) (value.Length > 1 && value[0] == '"' && value[value.Length - 1] == '"'))
{ {
value = value.Substring(1, value.Length - 2); value = value.Substring(1, value.Length - 2);
@ -99,7 +99,7 @@ namespace Microsoft.AspNetCore.Http.Internal
throw new ArgumentNullException(nameof(headers)); throw new ArgumentNullException(nameof(headers));
} }
if (string.IsNullOrWhiteSpace(key)) if (string.IsNullOrEmpty(key))
{ {
throw new ArgumentNullException(nameof(key)); throw new ArgumentNullException(nameof(key));
} }

View File

@ -100,7 +100,7 @@ namespace Microsoft.AspNetCore.Http
long value; long value;
var rawValue = this[HeaderNames.ContentLength]; var rawValue = this[HeaderNames.ContentLength];
if (rawValue.Count == 1 && if (rawValue.Count == 1 &&
!string.IsNullOrWhiteSpace(rawValue[0]) && !string.IsNullOrEmpty(rawValue[0]) &&
HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value)) HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value))
{ {
return value; return value;

View File

@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.Owin
} }
if (rawValue.Length == 1 && if (rawValue.Length == 1 &&
!string.IsNullOrWhiteSpace(rawValue[0]) && !string.IsNullOrEmpty(rawValue[0]) &&
HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value)) HeaderUtilities.TryParseNonNegativeInt64(new StringSegment(rawValue[0]).Trim(), out value))
{ {
return value; return value;