From 64abe3d96e5664680c6bca535bdd78fe44b7d3ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20K=C3=B6rber?= Date: Sun, 30 Jul 2017 15:59:07 +0200 Subject: [PATCH] Do not expect a response body on existing accounts --- .../src/main/java/org/shredzone/acme4j/AccountBuilder.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/acme4j-client/src/main/java/org/shredzone/acme4j/AccountBuilder.java b/acme4j-client/src/main/java/org/shredzone/acme4j/AccountBuilder.java index 4a3d630e..05dec0d1 100644 --- a/acme4j-client/src/main/java/org/shredzone/acme4j/AccountBuilder.java +++ b/acme4j-client/src/main/java/org/shredzone/acme4j/AccountBuilder.java @@ -143,7 +143,7 @@ public class AccountBuilder { } conn.sendSignedRequest(resourceUrl, claims, session, true); - conn.accept(HttpURLConnection.HTTP_OK, HttpURLConnection.HTTP_CREATED); + int resp = conn.accept(HttpURLConnection.HTTP_OK, HttpURLConnection.HTTP_CREATED); URL location = conn.getLocation(); @@ -151,7 +151,10 @@ public class AccountBuilder { if (keyIdentifier != null) { session.setKeyIdentifier(keyIdentifier); } - account.unmarshal(conn.readJsonResponse()); + + if (resp == HttpURLConnection.HTTP_CREATED) { + account.unmarshal(conn.readJsonResponse()); + } return account; } }