Class Response
- java.lang.Object
-
- org.springframework.cloud.contract.spec.internal.Common
-
- org.springframework.cloud.contract.spec.internal.Response
-
public class Response extends Common
Represents the response side of the HTTP communication.- Since:
- 1.0.0
- Author:
- Marcin Grzejszczak, Tim Ysewyn
-
-
Method Summary
-
Methods inherited from class org.springframework.cloud.contract.spec.internal.Common
$, $, $, $, aDouble, alphaNumeric, anInteger, anyBoolean, c, client, consumer, convertObjectsToDslProperties, convertObjectsToDslProperties, email, execute, file, file, fileAsBytes, hostname, httpsUrl, ipAddress, iso8601WithOffset, isoDate, isoDateTime, isoTime, named, named, named, nonBlank, nonEmpty, number, onlyAlphaUnicode, optional, p, positiveInt, producer, regex, regex, regex, server, stub, test, toDslProperty, toDslProperty, toDslProperty, toDslProperty, url, uuid, value, value
-
-
-
-
Constructor Detail
-
Response
public Response()
-
Response
public Response(Response response)
-
-
Method Detail
-
status
public void status(int status)
Allows to set the HTTP status.- Parameters:
status- HTTP status
-
status
public void status(DslProperty status)
Allows to set the HTTP status.- Parameters:
status- HTTP status
-
body
public void body(Map<String,Object> body)
Allows set an HTTP body.- Parameters:
body- body to set
-
body
public void body(List body)
Allows set an HTTP body.- Parameters:
body- body to set
-
body
public void body(Object bodyAsValue)
Allows set an HTTP body.- Parameters:
bodyAsValue- body to set
-
fixedDelayMilliseconds
public void fixedDelayMilliseconds(int timeInMilliseconds)
Allows to set a fixed delay of the response in milliseconds.- Parameters:
timeInMilliseconds- delay in millis
-
async
public void async()
Turns on the asynchronous mode for this contract. Used with MockMvc and the Servlet 3.0 features.
-
assertThatSidesMatch
public void assertThatSidesMatch(Object stubSide, Object testSide)
- Overrides:
assertThatSidesMatchin classCommon
-
value
public DslProperty value(ServerDslProperty server)
Allows to set a dynamic value for the given element.- Parameters:
server- server value- Returns:
- dsl property
-
$
public DslProperty $(ServerDslProperty server)
Allows to set a dynamic value for the given element.- Parameters:
server- server value- Returns:
- dsl property
-
value
public DslProperty value(Pattern server)
Allows to set a dynamic value for the given element.- Parameters:
server- server value- Returns:
- dsl property
-
value
public DslProperty value(RegexProperty server)
Allows to set a dynamic value for the given element.- Parameters:
server- server value- Returns:
- dsl property
-
$
public DslProperty $(RegexProperty server)
Allows to set a dynamic value for the given element.- Parameters:
server- server value- Returns:
- dsl property
-
$
public DslProperty $(Pattern server)
Allows to set a dynamic value for the given element.- Parameters:
server- server value- Returns:
- dsl property
-
regexProperty
public RegexProperty regexProperty(Object object)
- Overrides:
regexPropertyin classCommon
-
fromRequest
public FromRequest fromRequest()
Allows to reference entries from the request.- Returns:
- from request object
-
value
public DslProperty value(ClientDslProperty client, ServerDslProperty server)
Allows to set a dynamic value for the given element.
-
value
public DslProperty value(ServerDslProperty server, ClientDslProperty client)
Allows to set a dynamic value for the given element.
-
getProperty
public org.springframework.cloud.contract.spec.internal.Response.ServerPatternValueDslProperty getProperty()
-
setProperty
public void setProperty(org.springframework.cloud.contract.spec.internal.Response.ServerPatternValueDslProperty property)
-
getStatus
public DslProperty getStatus()
-
setStatus
public void setStatus(DslProperty status)
-
getDelay
public DslProperty getDelay()
-
setDelay
public void setDelay(DslProperty delay)
-
getHeaders
public Headers getHeaders()
-
setHeaders
public void setHeaders(Headers headers)
-
getCookies
public Cookies getCookies()
-
setCookies
public void setCookies(Cookies cookies)
-
getBody
public Body getBody()
-
setBody
public void setBody(Body body)
-
getAsync
public boolean getAsync()
-
isAsync
public boolean isAsync()
-
setAsync
public void setAsync(boolean async)
-
getBodyMatchers
public ResponseBodyMatchers getBodyMatchers()
-
setBodyMatchers
public void setBodyMatchers(ResponseBodyMatchers bodyMatchers)
-
anyAlphaUnicode
public ServerDslProperty anyAlphaUnicode()
-
anyAlphaNumeric
public ServerDslProperty anyAlphaNumeric()
-
anyNumber
public ServerDslProperty anyNumber()
-
anyInteger
public ServerDslProperty anyInteger()
-
anyPositiveInt
public ServerDslProperty anyPositiveInt()
-
anyDouble
public ServerDslProperty anyDouble()
-
anyHex
public ServerDslProperty anyHex()
-
aBoolean
public ServerDslProperty aBoolean()
-
anyIpAddress
public ServerDslProperty anyIpAddress()
-
anyHostname
public ServerDslProperty anyHostname()
-
anyEmail
public ServerDslProperty anyEmail()
-
anyUrl
public ServerDslProperty anyUrl()
-
anyHttpsUrl
public ServerDslProperty anyHttpsUrl()
-
anyUuid
public ServerDslProperty anyUuid()
-
anyDate
public ServerDslProperty anyDate()
-
anyDateTime
public ServerDslProperty anyDateTime()
-
anyTime
public ServerDslProperty anyTime()
-
anyIso8601WithOffset
public ServerDslProperty anyIso8601WithOffset()
-
anyNonBlankString
public ServerDslProperty anyNonBlankString()
-
anyNonEmptyString
public ServerDslProperty anyNonEmptyString()
-
anyOf
public ServerDslProperty anyOf(String... values)
-
CONTINUE
public int CONTINUE()
-
SWITCHING_PROTOCOLS
public int SWITCHING_PROTOCOLS()
-
PROCESSING
public int PROCESSING()
-
CHECKPOINT
public int CHECKPOINT()
-
OK
public int OK()
-
CREATED
public int CREATED()
-
ACCEPTED
public int ACCEPTED()
-
NON_AUTHORITATIVE_INFORMATION
public int NON_AUTHORITATIVE_INFORMATION()
-
NO_CONTENT
public int NO_CONTENT()
-
RESET_CONTENT
public int RESET_CONTENT()
-
PARTIAL_CONTENT
public int PARTIAL_CONTENT()
-
MULTI_STATUS
public int MULTI_STATUS()
-
ALREADY_REPORTED
public int ALREADY_REPORTED()
-
IM_USED
public int IM_USED()
-
MULTIPLE_CHOICES
public int MULTIPLE_CHOICES()
-
MOVED_PERMANENTLY
public int MOVED_PERMANENTLY()
-
FOUND
public int FOUND()
-
SEE_OTHER
public int SEE_OTHER()
-
NOT_MODIFIED
public int NOT_MODIFIED()
-
TEMPORARY_REDIRECT
public int TEMPORARY_REDIRECT()
-
PERMANENT_REDIRECT
public int PERMANENT_REDIRECT()
-
BAD_REQUEST
public int BAD_REQUEST()
-
UNAUTHORIZED
public int UNAUTHORIZED()
-
PAYMENT_REQUIRED
public int PAYMENT_REQUIRED()
-
FORBIDDEN
public int FORBIDDEN()
-
NOT_FOUND
public int NOT_FOUND()
-
METHOD_NOT_ALLOWED
public int METHOD_NOT_ALLOWED()
-
NOT_ACCEPTABLE
public int NOT_ACCEPTABLE()
-
PROXY_AUTHENTICATION_REQUIRED
public int PROXY_AUTHENTICATION_REQUIRED()
-
REQUEST_TIMEOUT
public int REQUEST_TIMEOUT()
-
CONFLICT
public int CONFLICT()
-
GONE
public int GONE()
-
LENGTH_REQUIRED
public int LENGTH_REQUIRED()
-
PRECONDITION_FAILED
public int PRECONDITION_FAILED()
-
PAYLOAD_TOO_LARGE
public int PAYLOAD_TOO_LARGE()
-
URI_TOO_LONG
public int URI_TOO_LONG()
-
UNSUPPORTED_MEDIA_TYPE
public int UNSUPPORTED_MEDIA_TYPE()
-
REQUESTED_RANGE_NOT_SATISFIABLE
public int REQUESTED_RANGE_NOT_SATISFIABLE()
-
EXPECTATION_FAILED
public int EXPECTATION_FAILED()
-
I_AM_A_TEAPOT
public int I_AM_A_TEAPOT()
-
UNPROCESSABLE_ENTITY
public int UNPROCESSABLE_ENTITY()
-
LOCKED
public int LOCKED()
-
FAILED_DEPENDENCY
public int FAILED_DEPENDENCY()
-
UPGRADE_REQUIRED
public int UPGRADE_REQUIRED()
-
PRECONDITION_REQUIRED
public int PRECONDITION_REQUIRED()
-
TOO_MANY_REQUESTS
public int TOO_MANY_REQUESTS()
-
REQUEST_HEADER_FIELDS_TOO_LARGE
public int REQUEST_HEADER_FIELDS_TOO_LARGE()
-
UNAVAILABLE_FOR_LEGAL_REASONS
public int UNAVAILABLE_FOR_LEGAL_REASONS()
-
INTERNAL_SERVER_ERROR
public int INTERNAL_SERVER_ERROR()
-
NOT_IMPLEMENTED
public int NOT_IMPLEMENTED()
-
BAD_GATEWAY
public int BAD_GATEWAY()
-
SERVICE_UNAVAILABLE
public int SERVICE_UNAVAILABLE()
-
GATEWAY_TIMEOUT
public int GATEWAY_TIMEOUT()
-
HTTP_VERSION_NOT_SUPPORTED
public int HTTP_VERSION_NOT_SUPPORTED()
-
VARIANT_ALSO_NEGOTIATES
public int VARIANT_ALSO_NEGOTIATES()
-
INSUFFICIENT_STORAGE
public int INSUFFICIENT_STORAGE()
-
LOOP_DETECTED
public int LOOP_DETECTED()
-
BANDWIDTH_LIMIT_EXCEEDED
public int BANDWIDTH_LIMIT_EXCEEDED()
-
NOT_EXTENDED
public int NOT_EXTENDED()
-
NETWORK_AUTHENTICATION_REQUIRED
public int NETWORK_AUTHENTICATION_REQUIRED()
-
headers
public void headers(Consumer<Headers> consumer)
Allows to configure HTTP headers.- Parameters:
consumer- function to manipulate the URL
-
cookies
public void cookies(Consumer<Cookies> consumer)
Allows to configure HTTP cookies.- Parameters:
consumer- function to manipulate the URL
-
bodyMatchers
public void bodyMatchers(Consumer<ResponseBodyMatchers> consumer)
Allows to set matchers for the body.- Parameters:
consumer- function to manipulate the URL
-
headers
public void headers(@DelegatesTo(Headers.class) groovy.lang.Closure consumer)
Allows to configure HTTP headers.- Parameters:
consumer- function to manipulate the URL
-
cookies
public void cookies(@DelegatesTo(Cookies.class) groovy.lang.Closure consumer)
Allows to configure HTTP cookies.- Parameters:
consumer- function to manipulate the URL
-
bodyMatchers
public void bodyMatchers(@DelegatesTo(ResponseBodyMatchers.class) groovy.lang.Closure consumer)
Allows to set matchers for the body.- Parameters:
consumer- function to manipulate the URL
-
-