|
27 | 27 | import java.text.DateFormat; |
28 | 28 | import java.text.ParseException; |
29 | 29 | import java.text.SimpleDateFormat; |
30 | | -import java.util.ArrayList; |
31 | | -import java.util.Collection; |
32 | | -import java.util.Collections; |
33 | | -import java.util.Date; |
34 | | -import java.util.HashMap; |
35 | | -import java.util.List; |
36 | | -import java.util.Map; |
| 30 | +import java.util.*; |
37 | 31 | import java.util.Map.Entry; |
38 | | -import java.util.Properties; |
39 | | -import java.util.TimeZone; |
40 | 32 | import java.util.concurrent.TimeUnit; |
41 | 33 | import java.util.regex.Matcher; |
42 | 34 | import java.util.regex.Pattern; |
@@ -1393,7 +1385,15 @@ public void callAuthenticationHeader(String method, String path, Object body, Li |
1393 | 1385 |
|
1394 | 1386 | Authorization authorization = new Authorization(); |
1395 | 1387 |
|
1396 | | - String requestBody = json.serialize(body); |
| 1388 | + String requestBody = null; |
| 1389 | + if ((method.equalsIgnoreCase("POST") || method.equalsIgnoreCase("PUT") || |
| 1390 | + method.equalsIgnoreCase("PATCH")) |
| 1391 | + && body.equals("{}")) { |
| 1392 | + requestBody = "{}"; |
| 1393 | + } else { |
| 1394 | + requestBody = json.serialize(body); |
| 1395 | + } |
| 1396 | + |
1397 | 1397 | logger.debug("HTTP Request Body:\n" + requestBody); |
1398 | 1398 | merchantConfig.setRequestData(requestBody); |
1399 | 1399 | authorization.setJWTRequestBody(requestBody); |
@@ -1489,7 +1489,11 @@ public Request buildRequest(String path, String method, List<Pair> queryParams, |
1489 | 1489 | reqBody = RequestBody.create(MediaType.parse(contentType), ""); |
1490 | 1490 | } |
1491 | 1491 | } else { |
1492 | | - reqBody = serialize(body, contentType); |
| 1492 | + if (body.equals("{}")) { |
| 1493 | + reqBody = RequestBody.create("{}", MediaType.parse(contentType)); |
| 1494 | + } else { |
| 1495 | + reqBody = serialize(body, contentType); |
| 1496 | + } |
1493 | 1497 | } |
1494 | 1498 |
|
1495 | 1499 | Request request = null; |
|
0 commit comments