Class ClientYamlTestResponse

java.lang.Object
org.elasticsearch.test.rest.yaml.ClientYamlTestResponse

public class ClientYamlTestResponse extends Object
Response obtained from a REST call, eagerly reads the response body into a string for later optional parsing. Supports parsing the response body when needed and returning specific values extracted from it.
  • Constructor Details

  • Method Details

    • getStatusCode

      public int getStatusCode()
    • getReasonPhrase

      public String getReasonPhrase()
    • getWarningHeaders

      public List<String> getWarningHeaders()
      Get a list of all of the values of all warning headers returned in the response.
    • getHeaders

      public List<String> getHeaders(String name)
      Get a list of all the values of a given header returned in the response.
    • getBody

      public Object getBody() throws IOException
      Returns the body properly parsed depending on the content type. Might be a string or a json object parsed as a map.
      Throws:
      IOException
    • getBodyAsString

      public String getBodyAsString()
      Returns the body as a string
    • isError

      public boolean isError()
    • evaluate

      public Object evaluate(String path) throws IOException
      Parses the response body and extracts a specific value from it (identified by the provided path)
      Throws:
      IOException
    • evaluate

      public Object evaluate(String path, Stash stash) throws IOException
      Parses the response body and extracts a specific value from it (identified by the provided path)
      Throws:
      IOException