From ecbc97464d9bbe9b5f134dadeff8d5f3480e9dfd Mon Sep 17 00:00:00 2001 From: Shubham Tiwari Date: Tue, 4 Jun 2024 16:57:53 +0530 Subject: [PATCH] chore: correcting dateTime format to add timezone --- src/main/java/com/twilio/http/Request.java | 2 +- src/test/java/com/twilio/http/RequestTest.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/twilio/http/Request.java b/src/main/java/com/twilio/http/Request.java index 36aa7a5e03..b9f2fdd567 100644 --- a/src/main/java/com/twilio/http/Request.java +++ b/src/main/java/com/twilio/http/Request.java @@ -22,7 +22,7 @@ public class Request { private static final String DEFAULT_REGION = "us1"; - public static final String QUERY_STRING_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss"; + public static final String QUERY_STRING_DATE_TIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ssXXX"; public static final String QUERY_STRING_DATE_FORMAT = "yyyy-MM-dd"; private final HttpMethod method; diff --git a/src/test/java/com/twilio/http/RequestTest.java b/src/test/java/com/twilio/http/RequestTest.java index cb9aa8b9c8..2338e1e9f2 100644 --- a/src/test/java/com/twilio/http/RequestTest.java +++ b/src/test/java/com/twilio/http/RequestTest.java @@ -176,7 +176,7 @@ public void testAddQueryDateTimeRangeLowerBound() throws MalformedURLException { Request r = new Request(HttpMethod.GET, Domains.API.toString(), "/2010-04-01/foobar"); r.addQueryDateTimeRange("baz", ZonedDateTime.of(2014, 1, 1, 0, 0, 0, 0, ZoneOffset.UTC), null); URL url = r.constructURL(); - URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz>=2014-01-01T00:00:00"); + URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz>=2014-01-01T00:00:00Z"); assertUrlsEqual(expected, url); } @@ -185,7 +185,7 @@ public void testAddQueryDateTimeRangeUpperBound() throws MalformedURLException { Request r = new Request(HttpMethod.GET, Domains.API.toString(), "/2010-04-01/foobar"); r.addQueryDateTimeRange("baz", null, ZonedDateTime.of(2014, 1, 1, 22, 0, 0, 0, ZoneOffset.UTC)); URL url = r.constructURL(); - URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz<=2014-01-01T22:00:00"); + URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz<=2014-01-01T22:00:00Z"); assertUrlsEqual(expected, url); } @@ -195,7 +195,7 @@ public void testAddQueryDateTimeRangeClosed() throws MalformedURLException { r.addQueryDateTimeRange("baz", ZonedDateTime.of(2014, 1, 10, 14, 0, 0, 0, ZoneOffset.UTC), ZonedDateTime.of(2014, 6, 1, 16, 0, 0, 0, ZoneOffset.UTC)); URL url = r.constructURL(); - URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz>=2014-01-10T14:00:00&baz<=2014-06-01T16:00:00"); + URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz>=2014-01-10T14:00:00Z&baz<=2014-06-01T16:00:00Z"); assertUrlsEqual(expected, url); } @@ -207,7 +207,7 @@ public void testAddQueryDateTimeRangeClosedNotUTC() throws MalformedURLException ZonedDateTime end = ZonedDateTime.of(2014, 6, 1, 16, 0, 0, 0, z); r.addQueryDateTimeRange("baz", begin, end); URL url = r.constructURL(); - URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz>=2014-01-10T20:00:00&baz<=2014-06-01T21:00:00"); + URL expected = new URL("https://api.twilio.com/2010-04-01/foobar?baz>=2014-01-10T20:00:00Z&baz<=2014-06-01T21:00:00Z"); assertUrlsEqual(expected, url); }