Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions APIMatic.Core.Test/Utilities/CoreHelperTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ public void AppendQueryParameter_CustomParameter()
"serverResponse"
};

string expected = $"{SERVER_URL}?serverResponse%5Bpassed%5D=True";
string expected = $"{SERVER_URL}?serverResponse%5Bpassed%5D=true";
CoreHelper.AppendUrlWithQueryParameters(queryBuilder, GetParameters(parametersKeys, serverResponse));
string actual = queryBuilder.ToString();
Assert.AreEqual(expected, actual);
Expand Down Expand Up @@ -626,7 +626,7 @@ public void AppendQueryParameter_CustomCollectionParameter()
"serverResponse"
};

string expected = $"{SERVER_URL}?serverResponse%5B0%5D%5Bpassed%5D=True";
string expected = $"{SERVER_URL}?serverResponse%5B0%5D%5Bpassed%5D=true";
CoreHelper.AppendUrlWithQueryParameters(queryBuilder, GetParameters(parametersKeys, stringCollection));
string actual = queryBuilder.ToString();
Assert.AreEqual(expected, actual);
Expand Down
17 changes: 9 additions & 8 deletions APIMatic.Core/Utilities/CoreHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -519,20 +519,21 @@ private static string GetFormatString(ArraySerialization fmt, string key, String

private static string GetElementValue(object element, bool urlEncode)
{
string elemValue;
if (element is DateTime time)
{
elemValue = time.ToString(DateTimeFormat);
return elemValue;
return time.ToString(DateTimeFormat);
}
else if (element is DateTimeOffset offset)

if (element is DateTimeOffset offset)
{
elemValue = offset.ToString(DateTimeFormat);
return elemValue;
return offset.ToString(DateTimeFormat);
}
else

string elemValue = element.ToString();

if (element is bool)
{
elemValue = element.ToString();
elemValue = elemValue.ToLower();
}

if (urlEncode)
Expand Down