APIClient: delete command should check for errors

delete commands do not return a value, still, it is possible that the
command will return a value different than OK.

In such a case, the error should be propagate to the caller via an
exception.

Fixes #65

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <20190618135312.2776-1-amnon@scylladb.com>
(cherry picked from commit 2fac82434b)
This commit is contained in:
Amnon Heiman 2019-06-18 16:53:12 +03:00 committed by Pekka Enberg
parent b5ed0af1b3
commit 2b9effb1ae

View File

@ -152,7 +152,11 @@ public class APIClient {
get(path, queryParams).delete();
return;
}
get(path).delete();
Response response = get(path).delete();
if (response.getStatus() != Response.Status.OK.getStatusCode()) {
throw getException("Scylla API server HTTP delete to URL '" + path + "' failed",
response.readEntity(String.class));
}
}
public void delete(String path) {