Skip to content

Commit

Permalink
Added Float type branch when encoding url parameters
Browse files Browse the repository at this point in the history
Added culture invariant ToString
  • Loading branch information
dhymik committed Jan 2, 2024
1 parent 12c5acb commit 22a1026
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Deepgram/Utilities/QueryParameterUtil.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using Newtonsoft.Json;
Expand Down Expand Up @@ -35,6 +36,10 @@ public static string GetParameters(object parameters = null)
{
paramList.Add(new KeyValuePair<string, string>(prop.Name, HttpUtility.UrlEncode(((DateTime)prop.Value).ToString("yyyy-MM-dd"))));
}
else if (prop.Value.Type == JTokenType.Float)
{
paramList.Add(new KeyValuePair<string, string>(prop.Name, ((JValue)prop.Value).ToString(CultureInfo.InvariantCulture)));
}
else
{
paramList.Add(new KeyValuePair<string, string>(prop.Name, HttpUtility.UrlEncode(prop.Value.ToString())));
Expand Down

0 comments on commit 22a1026

Please sign in to comment.