Package org.elasticsearch.test.rest.yaml
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(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 stringjava.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()
-
-
-
Constructor Detail
-
ClientYamlTestResponse
public ClientYamlTestResponse(Response response) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
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
-
-