APIClient: Add some "post" overloads

This commit is contained in:
Calle Wilund 2016-08-17 08:53:09 +00:00
parent 45e2c982f7
commit 9a44228c71

View File

@ -106,8 +106,12 @@ public class APIClient {
} }
public Response post(String path, MultivaluedMap<String, String> queryParams) { public Response post(String path, MultivaluedMap<String, String> queryParams) {
return post(path, queryParams, null);
}
public Response post(String path, MultivaluedMap<String, String> queryParams, Object object, String type) {
try { try {
Response response = get(path, queryParams).post(Entity.entity(null, MediaType.TEXT_PLAIN)); Response response = get(path, queryParams).post(Entity.entity(object, type));
if (response.getStatus() != Response.Status.OK.getStatusCode() ) { if (response.getStatus() != Response.Status.OK.getStatusCode() ) {
throw getException("Scylla API server HTTP POST to URL '" + path + "' failed", response.readEntity(String.class)); throw getException("Scylla API server HTTP POST to URL '" + path + "' failed", response.readEntity(String.class));
} }
@ -117,6 +121,10 @@ public class APIClient {
} }
} }
public Response post(String path, MultivaluedMap<String, String> queryParams, Object object) {
return post(path, queryParams, object, MediaType.TEXT_PLAIN);
}
public void post(String path) { public void post(String path) {
post(path, null); post(path, null);
} }