Uses of Class
org.springframework.test.web.client.response.DefaultResponseCreator
-
Uses of DefaultResponseCreator in org.springframework.test.web.client.response
Modifier and TypeMethodDescriptionDefaultResponseCreator.body
(byte[] content) Set the body as a byte array.Set the body as a UTF-8 String.Set the body from a string using the given character set.Set the body from aResource
.DefaultResponseCreator.contentType
(MediaType mediaType) Set theContent-Type
header.DefaultResponseCreator.cookies
(ResponseCookie... cookies) Add one or more cookies.DefaultResponseCreator.cookies
(MultiValueMap<String, ResponseCookie> multiValueMap) Copy all cookies from the givenMultiValueMap
.Add a response header with one or more values.DefaultResponseCreator.headers
(HttpHeaders headers) Copy all given headers.Set theLocation
header.static DefaultResponseCreator
MockRestResponseCreators.withAccepted()
ResponseCreator
for a 202 response (ACCEPTED).static DefaultResponseCreator
MockRestResponseCreators.withBadGateway()
ResponseCreator
for a 502 response (BAD_GATEWAY).static DefaultResponseCreator
MockRestResponseCreators.withBadRequest()
ResponseCreator
for a 400 response (BAD_REQUEST).static DefaultResponseCreator
MockRestResponseCreators.withCreatedEntity
(URI location) ResponseCreator
for a 201 response (CREATED) with a 'Location' header.static DefaultResponseCreator
MockRestResponseCreators.withForbiddenRequest()
ResponseCreator
for a 403 response (FORBIDDEN).static DefaultResponseCreator
MockRestResponseCreators.withGatewayTimeout()
ResponseCreator
for a 504 response (GATEWAY_TIMEOUT).static DefaultResponseCreator
MockRestResponseCreators.withNoContent()
ResponseCreator
for a 204 response (NO_CONTENT).static DefaultResponseCreator
MockRestResponseCreators.withRawStatus
(int status) Variant ofMockRestResponseCreators.withStatus(HttpStatusCode)
with an integer.static DefaultResponseCreator
MockRestResponseCreators.withRequestConflict()
ResponseCreator
for a 409 response (CONFLICT).static DefaultResponseCreator
MockRestResponseCreators.withResourceNotFound()
ResponseCreator
for a 404 response (NOT_FOUND).static DefaultResponseCreator
MockRestResponseCreators.withServerError()
ResponseCreator
for a 500 response (SERVER_ERROR).static DefaultResponseCreator
MockRestResponseCreators.withServiceUnavailable()
ResponseCreator
for a 503 response (SERVICE_UNAVAILABLE).static DefaultResponseCreator
MockRestResponseCreators.withStatus
(HttpStatusCode status) ResponseCreator
with a specific HTTP status.static DefaultResponseCreator
MockRestResponseCreators.withSuccess()
ResponseCreator
for a 200 response (OK).static DefaultResponseCreator
MockRestResponseCreators.withSuccess
(byte[] body, MediaType contentType) ResponseCreator
for a 200 response (OK) with byte[] body.static DefaultResponseCreator
MockRestResponseCreators.withSuccess
(String body, MediaType contentType) ResponseCreator
for a 200 response (OK) with String body.static DefaultResponseCreator
MockRestResponseCreators.withSuccess
(Resource body, MediaType contentType) ResponseCreator
for a 200 response (OK) content withResource
-based body.static DefaultResponseCreator
MockRestResponseCreators.withTooManyRequests()
ResponseCreator
for a 429 ratelimited response (TOO_MANY_REQUESTS).static DefaultResponseCreator
MockRestResponseCreators.withTooManyRequests
(int retryAfter) ResponseCreator
for a 429 rate-limited response (TOO_MANY_REQUESTS) with aRetry-After
header in seconds.static DefaultResponseCreator
MockRestResponseCreators.withUnauthorizedRequest()
ResponseCreator
for a 401 response (UNAUTHORIZED).