Package org.opensearch.test.rest.yaml
Class ClientYamlTestResponse
java.lang.Object
org.opensearch.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.opensearch.client.Response response) -
Method Summary
Modifier and Type Method Description java.lang.Objectevaluate(java.lang.String path)Parses the response body and extracts a specific value from it (identified by the provided path)java.lang.Objectevaluate(java.lang.String path, Stash stash)Parses the response body and extracts a specific value from it (identified by the provided path)java.lang.ObjectgetBody()Returns the body properly parsed depending on the content type.java.lang.StringgetBodyAsString()Returns the body as a stringjava.lang.StringgetReasonPhrase()intgetStatusCode()java.util.List<java.lang.String>getWarningHeaders()Get a list of all of the values of all warning headers returned in the response.booleanisError()
-
Constructor Details
-
ClientYamlTestResponse
public ClientYamlTestResponse(org.opensearch.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.IOExceptionReturns 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.IOExceptionParses the response body and extracts a specific value from it (identified by the provided path)- Throws:
java.io.IOException
-
evaluate
Parses the response body and extracts a specific value from it (identified by the provided path)- Throws:
java.io.IOException
-