public interface MockMvcResponse extends io.restassured.response.ResponseBody<MockMvcResponse>, io.restassured.response.ResponseOptions<MockMvcResponse>, io.restassured.response.Validatable<ValidatableMockMvcResponse,MockMvcResponse>
Usage example:
Response response = get("/lotto");
String body = response.getBody().asString();
String headerValue = response.getHeader("headerName");
String cookieValue = response.getCookie("cookieName");
You can also map the response body to a Java object automatically. REST Assured will use Jackson, Gson and JAXB to accommodate this:
Message message = get("/message").as(Message.class);
| Modifier and Type | Method and Description |
|---|---|
org.springframework.mock.web.MockHttpServletResponse |
getMockHttpServletResponse()
Return the
MockHttpServletResponse as returned by Spring MockMvc. |
org.springframework.test.web.servlet.MvcResult |
getMvcResult()
Return the
MvcResult as returned by Spring MockMvc. |
org.springframework.mock.web.MockHttpServletResponse |
mockHttpServletResponse()
Return the
MockHttpServletResponse as returned by Spring MockMvc. |
org.springframework.test.web.servlet.MvcResult |
mvcResult()
Return the
MvcResult as returned by Spring MockMvc. |
peek, prettyPeek, prettyPrint, printas, as, as, as, as, as, as, htmlPath, jsonPath, jsonPath, path, xmlPath, xmlPath, xmlPathasByteArray, asInputStream, asPrettyString, asStringandReturn, body, contentType, cookie, cookies, detailedCookie, detailedCookies, getBody, getContentType, getCookie, getCookies, getDetailedCookie, getDetailedCookies, getHeader, getHeaders, getSessionId, getStatusCode, getStatusLine, getTime, getTimeIn, header, headers, sessionId, statusCode, statusLine, thenReturn, time, timeInorg.springframework.test.web.servlet.MvcResult mvcResult()
MvcResult as returned by Spring MockMvc.
This method is the same as getMvcResult() except for syntactic differences.
MvcResult as returned by Spring MockMvc.org.springframework.test.web.servlet.MvcResult getMvcResult()
MvcResult as returned by Spring MockMvc.
This method is the same as mvcResult() except for syntactic differences.
MvcResult as returned by Spring MockMvc.org.springframework.mock.web.MockHttpServletResponse mockHttpServletResponse()
MockHttpServletResponse as returned by Spring MockMvc.
This method is the same as getMockHttpServletResponse() except for syntactic differences.
MockHttpServletResponse as returned by Spring MockMvc.org.springframework.mock.web.MockHttpServletResponse getMockHttpServletResponse()
MockHttpServletResponse as returned by Spring MockMvc.
This method is the same as mockHttpServletResponse() except for syntactic differences.
MockHttpServletResponse as returned by Spring MockMvc.Copyright © 2010–2025. All rights reserved.