diff --git a/modules/common/src/main/java/com/ibm/cloud/cloudant/internal/ErrorTransformInterceptor.java b/modules/common/src/main/java/com/ibm/cloud/cloudant/internal/ErrorTransformInterceptor.java index 2ec87a3bf..49ebe2dce 100644 --- a/modules/common/src/main/java/com/ibm/cloud/cloudant/internal/ErrorTransformInterceptor.java +++ b/modules/common/src/main/java/com/ibm/cloud/cloudant/internal/ErrorTransformInterceptor.java @@ -32,7 +32,7 @@ public Response intercept(Chain chain) throws IOException { // Don't modify the request, but get the response Response response = chain.proceed(chain.request()); if (!response.isSuccessful() // skip successful responses - && response.body() != null // skip cases with no body + && response.body() != null && !ResponseBody.EMPTY.equals(response.body()) // skip cases with no body && response.body().contentType() != null // skip cases with no content type && "application".equals(response.body().contentType().type()) && "json".equals(response.body().contentType().subtype()) // we only want to work with application/json diff --git a/modules/common/src/test/java/com/ibm/cloud/cloudant/internal/ErrorTransformInterceptorTest.java b/modules/common/src/test/java/com/ibm/cloud/cloudant/internal/ErrorTransformInterceptorTest.java index 0bfbd1ad8..f20023570 100644 --- a/modules/common/src/test/java/com/ibm/cloud/cloudant/internal/ErrorTransformInterceptorTest.java +++ b/modules/common/src/test/java/com/ibm/cloud/cloudant/internal/ErrorTransformInterceptorTest.java @@ -37,7 +37,6 @@ import com.google.gson.JsonObject; import com.ibm.cloud.sdk.core.security.NoAuthAuthenticator; import com.ibm.cloud.sdk.core.util.GsonSingleton; -import static org.junit.Assert.assertNull; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; @@ -340,7 +339,7 @@ void runTest(Interceptor interceptor) throws IOException { } else { // If we aren't asserting a specific part of augment check the body is unchanged if ("HEAD" == r.request().method()) { - assertNull(r.body()); + assertEquals(r.body(), ResponseBody.EMPTY); } else { assertEquals(r.body().string(), responseBody); } diff --git a/pom.xml b/pom.xml index a927812a8..edf8307fd 100644 --- a/pom.xml +++ b/pom.xml @@ -15,12 +15,12 @@ pom - 9.24.3 + 9.25.0 cloudant-java-sdk 7.7.1 - 4.12.0 + 5.3.2 3.5.4 0.8.14 3.1.4