diff --git a/pom.xml b/pom.xml index 034c241..869e2e9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.clevertap.apns apns-http2 - 4.0.3 + 4.0.4 apns-http2 A library for communicating with the Apple Push Gateway in HTTP/2. diff --git a/src/main/java/com/clevertap/apns/clients/SyncOkHttpApnsClient.java b/src/main/java/com/clevertap/apns/clients/SyncOkHttpApnsClient.java index 0377829..e450f5b 100644 --- a/src/main/java/com/clevertap/apns/clients/SyncOkHttpApnsClient.java +++ b/src/main/java/com/clevertap/apns/clients/SyncOkHttpApnsClient.java @@ -515,6 +515,13 @@ protected NotificationResponse parseResponse(Response response) throws IOExcepti if (response.code() != 200) { error = NotificationRequestError.get(statusCode); contentBody = response.body() != null ? response.body().string() : null; + } else { + try (ResponseBody responseBody = response.body()) { + if (responseBody != null) { + // Read the response into memory but don't use the content + responseBody.source().skip(responseBody.contentLength()); + } + } } return new NotificationResponse(error, statusCode, contentBody, null);