From 22a1026250e0812e9d9c029f86a36b8537233dcb Mon Sep 17 00:00:00 2001 From: DhyMik Date: Tue, 2 Jan 2024 14:42:10 +0100 Subject: [PATCH] Added Float type branch when encoding url parameters Added culture invariant ToString --- Deepgram/Utilities/QueryParameterUtil.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Deepgram/Utilities/QueryParameterUtil.cs b/Deepgram/Utilities/QueryParameterUtil.cs index 997e74aa..89616c65 100644 --- a/Deepgram/Utilities/QueryParameterUtil.cs +++ b/Deepgram/Utilities/QueryParameterUtil.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Web; using Newtonsoft.Json; @@ -35,6 +36,10 @@ public static string GetParameters(object parameters = null) { paramList.Add(new KeyValuePair(prop.Name, HttpUtility.UrlEncode(((DateTime)prop.Value).ToString("yyyy-MM-dd")))); } + else if (prop.Value.Type == JTokenType.Float) + { + paramList.Add(new KeyValuePair(prop.Name, ((JValue)prop.Value).ToString(CultureInfo.InvariantCulture))); + } else { paramList.Add(new KeyValuePair(prop.Name, HttpUtility.UrlEncode(prop.Value.ToString())));