Skip to content

Commit

Permalink
Final review clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
IEvangelist committed Jan 31, 2024
1 parent a9bd93e commit fcf9d68
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/RequestInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public Uri URI
/// </summary>
/// <param name="value">Object to be sanitized</param>
/// <returns>Sanitized object</returns>
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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit fcf9d68

Please sign in to comment.