@Test
  public void testThatErrorTraceWorksByDefault() throws Exception {
    // Make the HTTP request
    HttpResponse response =
        new HttpRequestBuilder(HttpClients.createDefault())
            .httpTransport(internalCluster().getDataNodeInstance(HttpServerTransport.class))
            .path("/")
            .addParam("error_trace", "true")
            .method(HttpDeleteWithEntity.METHOD_NAME)
            .execute();

    assertThat(response.getHeaders().get("Content-Type"), containsString("application/json"));
    assertThat(
        response.getBody(), containsString("\"error_trace\":{\"message\":\"Validation Failed"));
  }
Example #2
0
 Map<String, Object> validateAndParse(HttpResponse rsp) throws Exception {
   assertNotNull(rsp);
   assertEquals(200, rsp.getStatusCode());
   assertTrue(rsp.hasBody());
   return (Map<String, Object>) new JsonPath(rsp.getBody()).evaluate("");
 }