From fcf9d686da67b661d1eb94a0beb4b98d1e8fff1c Mon Sep 17 00:00:00 2001 From: David Pine Date: Wed, 31 Jan 2024 12:55:17 -0600 Subject: [PATCH] Final review clean up --- src/RequestInformation.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/RequestInformation.cs b/src/RequestInformation.cs index ae74d025..1fbd25a7 100644 --- a/src/RequestInformation.cs +++ b/src/RequestInformation.cs @@ -116,7 +116,7 @@ public Uri URI /// /// Object to be sanitized /// Sanitized object - private static string GetSanitizedValue(object value) => value switch + private static object GetSanitizedValue(object value) => value switch { bool boolean => boolean.ToString().ToLower(),// pass in a lowercase string as the final url will be uppercase due to the way ToString() works for booleans DateTimeOffset dateTimeOffset => dateTimeOffset.ToString("o"),// Default to ISO 8601 for datetimeoffsets in the url. @@ -177,19 +177,19 @@ private static string[] ExpandArray(Array collection) var passedArray = new string[collection.Length]; for(var i = 0; i < collection.Length; i++) { - passedArray[i] = GetSanitizedValue(collection.GetValue(i)!)!; + passedArray[i] = GetSanitizedValue(collection.GetValue(i)!).ToString()!; } return passedArray; } - private static string ReplaceEnumValueByStringRepresentation(object source) + private static object ReplaceEnumValueByStringRepresentation(object source) { if(source is Enum enumValue && GetEnumName(enumValue) is string enumValueName) { return enumValueName; } - return source.ToString()!; + return source; } #if NET5_0_OR_GREATER private static string? GetEnumName<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields)] T>(T value) where T : Enum