Class ClientYamlTestResponse

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

public class ClientYamlTestResponse
extends java.lang.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 Summary

    Constructors 
    Constructor Description
    ClientYamlTestResponse​(org.elasticsearch.client.Response response)  
  • Method Summary

    Modifier and Type Method Description
    java.lang.Object evaluate​(java.lang.String path)
    Parses the response body and extracts a specific value from it (identified by the provided path)
    java.lang.Object evaluate​(java.lang.String path, Stash stash)
    Parses the response body and extracts a specific value from it (identified by the provided path)
    java.lang.Object getBody()
    Returns the body properly parsed depending on the content type.
    java.lang.String getBodyAsString()
    Returns the body as a string
    java.lang.String getReasonPhrase()  
    int getStatusCode()  
    java.util.List<java.lang.String> getWarningHeaders()
    Get a list of all of the values of all warning headers returned in the response.
    boolean isError()  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ClientYamlTestResponse

      public ClientYamlTestResponse​(org.elasticsearch.client.Response response) throws java.io.IOException
      Throws:
      java.io.IOException
  • Method Details

    • getStatusCode

      public int getStatusCode()
    • getReasonPhrase

      public java.lang.String getReasonPhrase()
    • getWarningHeaders

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

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

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

      public boolean isError()
    • evaluate

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

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