From 7fdc4ae631ddacd1bea52f2eac6429f5b982a847 Mon Sep 17 00:00:00 2001 From: binh-dam-ibigroup <56846598+binh-dam-ibigroup@users.noreply.github.com> Date: Tue, 10 Oct 2023 12:45:53 -0400 Subject: [PATCH] refactor(HttpUtils): Apply PR feedback --- .../java/org/opentripplanner/middleware/utils/HttpUtils.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/opentripplanner/middleware/utils/HttpUtils.java b/src/main/java/org/opentripplanner/middleware/utils/HttpUtils.java index 1188f33e9..37b43f332 100644 --- a/src/main/java/org/opentripplanner/middleware/utils/HttpUtils.java +++ b/src/main/java/org/opentripplanner/middleware/utils/HttpUtils.java @@ -21,6 +21,7 @@ import java.io.IOException; import java.net.URI; import java.net.http.HttpTimeoutException; +import java.nio.charset.StandardCharsets; import java.time.LocalDate; import java.time.LocalTime; import java.time.format.DateTimeParseException; @@ -102,13 +103,13 @@ public static HttpResponseValues httpRequestRawResponse(URI uri, int timeoutInSe break; case PUT: HttpPut putRequest = new HttpPut(uri); - putRequest.setEntity(new StringEntity(bodyContent, "UTF-8")); + putRequest.setEntity(new StringEntity(bodyContent, StandardCharsets.UTF_8)); putRequest.setConfig(timeoutConfig); httpUriRequest = putRequest; break; case POST: HttpPost postRequest = new HttpPost(uri); - postRequest.setEntity(new StringEntity(bodyContent, "UTF-8")); + postRequest.setEntity(new StringEntity(bodyContent, StandardCharsets.UTF_8)); postRequest.setConfig(timeoutConfig); httpUriRequest = postRequest; break;