Do not expect a response body on existing accounts

pull/55/head
Richard Körber 2017-07-30 15:59:07 +02:00
parent e53cdee657
commit 64abe3d96e
1 changed files with 5 additions and 2 deletions

View File

@ -143,7 +143,7 @@ public class AccountBuilder {
} }
conn.sendSignedRequest(resourceUrl, claims, session, true); 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(); URL location = conn.getLocation();
@ -151,7 +151,10 @@ public class AccountBuilder {
if (keyIdentifier != null) { if (keyIdentifier != null) {
session.setKeyIdentifier(keyIdentifier); session.setKeyIdentifier(keyIdentifier);
} }
account.unmarshal(conn.readJsonResponse());
if (resp == HttpURLConnection.HTTP_CREATED) {
account.unmarshal(conn.readJsonResponse());
}
return account; return account;
} }
} }