|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jayway.restassured.internal.RestAssuredResponseImpl
public class RestAssuredResponseImpl
Constructor Summary | |
---|---|
RestAssuredResponseImpl()
|
Method Summary | ||
---|---|---|
Response |
andReturn()
Syntactic sugar, simply returns the same response instance. |
|
|
as(Class<T> cls)
Get the body and map it to a Java object. |
|
|
as(Class<T> cls,
ObjectMapper mapper)
Get the body and map it to a Java object using a specific object mapper. |
|
byte[] |
asByteArray()
Get the body as a byte array. |
|
InputStream |
asInputStream()
Get the body as an input stream. |
|
String |
asString()
Get the body as a string. |
|
ResponseBody |
body()
Returns the response body |
|
String |
contentType()
Get the content type of the response |
|
String |
cookie(String name)
Get a single cookie value associated with the given name. |
|
Map<String,String> |
cookies()
The response cookies as simple name/value pair. |
|
Cookie |
detailedCookie(String name)
Get a single cookie including all attributes associated with the given name. |
|
Cookies |
detailedCookies()
The response cookies with all the attributes. |
|
ResponseBody |
getBody()
Returns the response body |
|
Object |
getContent()
|
|
String |
getContentType()
Get the content type of the response |
|
String |
getCookie(String name)
Get a single cookie value associated with the given name. |
|
Map<String,String> |
getCookies()
The response cookies as simple name/value pair. |
|
String |
getDefaultContentType()
|
|
Cookie |
getDetailedCookie(String name)
Get a single cookie including all attributes associated with the given name. |
|
Cookies |
getDetailedCookies()
The response cookies with all the attributes. |
|
boolean |
getHasExpectations()
|
|
String |
getHeader(String name)
Get a single header value associated with the given name. |
|
Headers |
getHeaders()
The response headers. |
|
groovy.lang.MetaClass |
getMetaClass()
|
|
Object |
getProperty(String property)
|
|
Object |
getResponseHeaders()
|
|
ResponseParserRegistrar |
getRpr()
|
|
int |
getStatusCode()
Get the status code of the response. |
|
String |
getStatusLine()
Get the status line of the response. |
|
String |
header(String name)
Get a single header value associated with the given name. |
|
Headers |
headers()
The response headers. |
|
Object |
invokeMethod(String method,
Object arguments)
|
|
boolean |
isHasExpectations()
|
|
JsonPath |
jsonPath()
Get a JsonPath view of the response body. |
|
Object |
parseContentType(Object httpResponse)
|
|
Object |
parseCookies()
|
|
Object |
parseHeaders(Object httpResponse)
|
|
void |
parseResponse(Object httpResponse,
Object content,
Object hasBodyAssertions,
ResponseParserRegistrar responseParserRegistrar)
|
|
Object |
parseStatus(Object httpResponse)
|
|
|
path(String path)
Get a value from the response body using the JsonPath or XmlPath syntax. |
|
String |
print()
Print the response body and return it as string. |
|
void |
setContent(Object value)
|
|
void |
setContentType(Object value)
|
|
void |
setCookies(Cookies value)
|
|
void |
setDefaultContentType(String value)
|
|
void |
setHasExpectations(boolean value)
|
|
void |
setMetaClass(groovy.lang.MetaClass mc)
|
|
void |
setProperty(String property,
Object value)
|
|
void |
setResponseHeaders(Object value)
|
|
void |
setRpr(ResponseParserRegistrar value)
|
|
void |
setStatusCode(Object value)
|
|
void |
setStatusLine(Object value)
|
|
int |
statusCode()
Get the status code of the response. |
|
String |
statusLine()
Get the status line of the response. |
|
Response |
thenReturn()
Syntactic sugar, simply returns the same response instance. |
|
Object |
toString(groovy.lang.Writable node)
|
|
XmlPath |
xmlPath()
Get an XmlPath view of the response body. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RestAssuredResponseImpl()
Method Detail |
---|
public groovy.lang.MetaClass getMetaClass()
getMetaClass
in interface groovy.lang.GroovyObject
public void setMetaClass(groovy.lang.MetaClass mc)
setMetaClass
in interface groovy.lang.GroovyObject
public Object invokeMethod(String method, Object arguments)
invokeMethod
in interface groovy.lang.GroovyObject
public Object getProperty(String property)
getProperty
in interface groovy.lang.GroovyObject
public void setProperty(String property, Object value)
setProperty
in interface groovy.lang.GroovyObject
public Object getResponseHeaders()
public void setResponseHeaders(Object value)
public void setCookies(Cookies value)
public Object getContent()
public void setContent(Object value)
public void setContentType(Object value)
public void setStatusLine(Object value)
public void setStatusCode(Object value)
public String getDefaultContentType()
public void setDefaultContentType(String value)
public ResponseParserRegistrar getRpr()
public void setRpr(ResponseParserRegistrar value)
public boolean getHasExpectations()
public boolean isHasExpectations()
public void setHasExpectations(boolean value)
public void parseResponse(Object httpResponse, Object content, Object hasBodyAssertions, ResponseParserRegistrar responseParserRegistrar)
public Object parseStatus(Object httpResponse)
public Object parseContentType(Object httpResponse)
public Object parseCookies()
public Object parseHeaders(Object httpResponse)
public Object toString(groovy.lang.Writable node)
public String print()
ResponseBody
print
in interface ResponseBody
public String asString()
ResponseBody
asString
in interface ResponseBody
public InputStream asInputStream()
ResponseBody
asInputStream
in interface ResponseBody
public byte[] asByteArray()
ResponseBody
asByteArray
in interface ResponseBody
public <T> T as(Class<T> cls)
ResponseBody
ResponseBody.as(Class, com.jayway.restassured.mapper.ObjectMapper)
.
as
in interface ResponseBody
public <T> T as(Class<T> cls, ObjectMapper mapper)
ResponseBody
as
in interface ResponseBody
public Cookies detailedCookies()
Response
detailedCookies
in interface Response
public Cookies getDetailedCookies()
Response
getDetailedCookies
in interface Response
public Cookie detailedCookie(String name)
Response
detailedCookie
in interface Response
null
if value was not found.public Cookie getDetailedCookie(String name)
Response
getDetailedCookie
in interface Response
null
if value was not found.public Response andReturn()
Response
andReturn
in interface Response
public ResponseBody body()
Response
body
in interface Response
public Response thenReturn()
Response
thenReturn
in interface Response
public ResponseBody getBody()
Response
getBody
in interface Response
public Headers headers()
Response
headers
in interface Response
public Headers getHeaders()
Response
getHeaders
in interface Response
public String header(String name)
Response
Headers.getList(String)
in order to get all values.
header
in interface Response
null
if value was not found.public String getHeader(String name)
Response
Headers.getList(String)
in order to get all values..
getHeader
in interface Response
null
if value was not found.public Map<String,String> cookies()
Response
Response.detailedCookies()
.
cookies
in interface Response
public Map<String,String> getCookies()
Response
Response.getDetailedCookies()
.
getCookies
in interface Response
public String cookie(String name)
Response
Response.detailedCookie(String)
.
cookie
in interface Response
null
if value was not found.public String getCookie(String name)
Response
Response.getDetailedCookie(String)
.
getCookie
in interface Response
null
if value was not found.public String contentType()
Response
contentType
in interface Response
null
if not found.public String getContentType()
Response
getContentType
in interface Response
null
if not found.public String statusLine()
Response
statusLine
in interface Response
public int statusCode()
Response
statusCode
in interface Response
public String getStatusLine()
Response
getStatusLine
in interface Response
public int getStatusCode()
Response
getStatusCode
in interface Response
public JsonPath jsonPath()
ResponseBody
Assume that the GET request (to http://localhost:8080/lotto) returns JSON as:
{ "lotto":{ "lottoId":5, "winning-numbers":[2,45,34,23,7,5,3], "winners":[{ "winnerId":23, "numbers":[2,45,34,23,3,5] },{ "winnerId":54, "numbers":[52,3,12,11,18,22] }] } }You can the make the request and get the winner id's by using JsonPath:
ListwinnerIds = get("/lotto").jsonPath().getList("lotto.winnders.winnerId");
jsonPath
in interface ResponseBody
public XmlPath xmlPath()
ResponseBody
Imagine that a POST request to http://localhost:8080/greetXML returns:
<greeting>
<firstName>John</firstName>
<lastName>Doe</lastName>
</greeting>
String firstName = get("/greetXML").xmlPath().getString("greeting.firstName");
xmlPath
in interface ResponseBody
public <T> T path(String path)
ResponseBody
path
in interface ResponseBody
T
- The return typepath
- The json- or xml path
ResponseBody.jsonPath()
,
ResponseBody.xmlPath()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |