diff --git a/Recurly.Tests/BaseClientTest.cs b/Recurly.Tests/BaseClientTest.cs index a2f0315f..6b80ff0b 100644 --- a/Recurly.Tests/BaseClientTest.cs +++ b/Recurly.Tests/BaseClientTest.cs @@ -78,10 +78,10 @@ public void WillAddQueryStringParameters() { var options = new RequestOptions(); options.AddHeader("Accept-Language", "en-US"); - var date = new DateTime(2020, 01, 01); + var date = DateTime.Parse("2020-01-01T08:00:00Z"); var paramsMatcher = MockClient.QueryParameterMatcher(new Dictionary { { "param_1", "param1" }, - { "param_2", Recurly.Utils.ISO8601(date) }, + { "param_2", "2020-01-01T08%3A00%3A00.000Z" }, }); var client = MockClient.Build(paramsMatcher, SuccessResponse(System.Net.HttpStatusCode.OK)); diff --git a/Recurly.Tests/UtilsTest.cs b/Recurly.Tests/UtilsTest.cs index 14ee6d6c..b71bce39 100644 --- a/Recurly.Tests/UtilsTest.cs +++ b/Recurly.Tests/UtilsTest.cs @@ -29,8 +29,10 @@ public void QueryString() d.Add("decimal", 123.456m); d.Add("date", new DateTime(2020, 1, 1, 0, 0, 0, DateTimeKind.Utc)); d.Add("enum", Recurly.Tests.Constants.EnumValue.AllowedEnum); + d.Add("email", "testEmail@example.org"); + var result = Utils.QueryString(d); - Assert.Equal("?trueBool=true&falseBool=false&int=123&decimal=123.456&date=2020-01-01T00:00:00.000Z&enum=allowed_enum", result); + Assert.Equal("?trueBool=true&falseBool=false&int=123&decimal=123.456&date=2020-01-01T00%3A00%3A00.000Z&enum=allowed_enum&email=testEmail%40example.org", result); } } } diff --git a/Recurly/Utils.cs b/Recurly/Utils.cs index 3170586d..dda939f8 100644 --- a/Recurly/Utils.cs +++ b/Recurly/Utils.cs @@ -88,7 +88,8 @@ public static string QueryString(Dictionary queryParams) { stringRepr = param.Value.ToString(); } - qString.Add($"{param.Key}={Uri.EscapeUriString(stringRepr)}"); + + qString.Add($"{param.Key}={Uri.EscapeDataString(stringRepr)}"); } }