|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
public interface HttpResponse
The result of an HTTP request make by HttpClient. This object contains the actual data that will be stored
in the transaction (see getInfo()) as well as the result for any content verification (if one was provided
when the request was made).
| Method Summary | |
|---|---|
void |
errorString(java.lang.String text)
Verify that the given text is not present in the response body. |
void |
errorStringRegex(java.lang.String regex)
Verify that the given regex does not match the response body. |
HttpHeader[] |
getAllHeaders()
Returns an array of all headers included in the response. |
java.lang.String |
getBody()
Returns an array of all headers included in the response. |
java.lang.String |
getBodyAsBinary()
Returns the response body, as a String. |
java.lang.String |
getCharSet()
Returns the response character set if and only if the corresponding request asked for text validation to occur. |
java.lang.String |
getContentType()
Returns the response content type if and only if the corresponding request asked for text validation to occur. |
java.lang.String |
getErrorMessage()
Returns descriptive text of any error that occurred while making the HTTP request. |
java.lang.String |
getHeader(java.lang.String name)
Returns the value of the specific response header, or null if no header exists in the response. |
java.lang.String[] |
getHeaders(java.lang.String name)
Returns the values for the specific response header, or null if no headers exist in the response. |
TransactionStepObject |
getInfo()
Returns the actual information that will be stored in to the core data collected as part of the overall transaction. |
int |
getStatusCode()
Returns the HTTP status code |
java.lang.String |
getStatusText()
Returns the HTTP status text |
java.lang.String |
getUrl()
Returns the URL that the response was generated from. |
boolean |
isContentMatched()
Returns true if the content was verified to be in the resulting HTTP response. |
void |
searchString(java.lang.String text)
Verify that the given string is present in the response body. |
void |
searchStringRegex(java.lang.String regex)
Verify that the given regex matches the response body. |
| Method Detail |
|---|
boolean isContentMatched()
TransactionStepObject getInfo()
java.lang.String getBody()
java.lang.String getBodyAsBinary()
java.lang.String getCharSet()
java.lang.String getContentType()
java.lang.String getErrorMessage()
java.lang.String getHeader(java.lang.String name)
name - the header name
java.lang.String[] getHeaders(java.lang.String name)
This is useful if the same header is included multiple times. For example:
var r = c.get("http://www.google.com");
var cookies = r.getHeaders('Set-Cookie');
test.log("Cookies:");
for (var i = 0; i < cookies.length; i++) {
test.log(" " + cookies[i]);
}
name - the header name
HttpHeader[] getAllHeaders()
test.log("All Headers:");
var headers = r.getAllHeaders();
for (var i = 0; i < headers.length; i++) {
var header = headers[i];
test.log(" " + header.name + " : " + header.value);
}
java.lang.String getUrl()
Note that with redirects this can be different that the url given in the request.
int getStatusCode()
java.lang.String getStatusText()
void searchString(java.lang.String text)
text - the text to verify is presentvoid errorString(java.lang.String text)
text - the text to verify is not presentvoid searchStringRegex(java.lang.String regex)
Only a partial match is required. E.g. the following will succeed if the response has the text 'search' anywhere in the body:
r.searchStringRegex("search");
regex - the regex to check forvoid errorStringRegex(java.lang.String regex)
Only a partial match is required. E.g. the following will succeed if the response does not have the text 'error' in the body:
r.errorStringRegex("error");
regex - the regex to check for
|
© 2023 Vercara, LLC. All Rights Reserved. | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||