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>
This commit is contained in:
Amnon Heiman 2019-06-18 16:53:12 +03:00 committed by Nadav Har'El
parent eda6f4e1a8
commit 2fac82434b

View File

@ -152,7 +152,11 @@ public class APIClient {
get(path, queryParams).delete(); get(path, queryParams).delete();
return; 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) { public void delete(String path) {