protected String getBaseUriRest() { return getBaseUriRest(server); } /** returns REST endpoint, with trailing slash */
protected HttpToolResponse httpPost(String user, String path, byte[] body, Map<String, String> headers) throws Exception { final URI uri = URI.create(getBaseUriRest()).resolve(path); return HttpTool.httpPost(newClient(user), uri, headers, body); }
protected String httpGet(String user, String path) throws Exception { HttpToolResponse response = HttpTool.httpGet(newClient(user), URI.create(getBaseUriRest()).resolve(path), ImmutableMap.<String, String>of()); assertHealthyStatusCode(response); return response.getContentAsString(); }
protected HttpClient newClient(String user) throws Exception { HttpTool.HttpClientBuilder builder = httpClientBuilder() .uri(getBaseUriRest()); if (user != null) { builder.credentials(new UsernamePasswordCredentials(user, "ignoredPassword")); } return builder.build(); }