Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ protected <T> T makeHttpCall(String path, String method, Map<String, List<String
encodedBody = (byte[]) body;
} else if (body != null) {
encodedBody = objectMapper.writeValueAsString(body).getBytes(StandardCharsets.UTF_8);
} else if (method.equals("POST")) {
} else if (method.equals("POST") || method.equals("PUT")) {
encodedBody = new byte[] {};
} else {
encodedBody = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -790,6 +790,24 @@ public void testConfigureRealtimeURL() throws IOException, APIException {
client.configureRealtimeURL(realtimeUrlRequest);
}

@Test
public void testConfigureRealtimeURLWithNullBody() throws IOException, APIException {
AppStoreServerAPIClient client = getAppStoreServerAPIClient("", request -> {
Assertions.assertEquals("PUT", request.method());
Assertions.assertEquals("/inApps/v1/messaging/realtime/url", request.url().encodedPath());
RequestBody body = request.body();
Assertions.assertNotNull(body);
Assertions.assertEquals(expectedMediaType, body.contentType());
try {
Assertions.assertEquals(0, body.contentLength());
} catch (IOException e) {
throw new RuntimeException(e);
}
});

client.configureRealtimeURL(null);
}

@Test
public void testDeleteRealtimeURL() throws IOException, APIException {
AppStoreServerAPIClient client = getAppStoreServerAPIClient("", request -> {
Expand Down