Class Response
java.lang.Object
org.springframework.cloud.contract.spec.internal.Common
org.springframework.cloud.contract.spec.internal.Response
Represents the response side of the HTTP communication.
- Since:
- 1.0.0
- Author:
- Marcin Grzejszczak, Tim Ysewyn
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAllows to set a dynamic value for the given element.$(RegexProperty server) Allows to set a dynamic value for the given element.$(ServerDslProperty server) Allows to set a dynamic value for the given element.aBoolean()intACCEPTED()intanyDate()anyEmail()anyHex()anyTime()anyUrl()anyUuid()voidassertThatSidesMatch(Object stubSide, Object testSide) voidasync()Turns on the asynchronous mode for this contract.intintintvoidAllows set an HTTP body.voidAllows set an HTTP body.voidAllows set an HTTP body.voidbodyMatchers(groovy.lang.Closure consumer) Allows to set matchers for the body.voidbodyMatchers(Consumer<ResponseBodyMatchers> consumer) Allows to set matchers for the body.intintCONFLICT()intCONTINUE()voidcookies(groovy.lang.Closure consumer) Allows to configure HTTP cookies.voidAllows to configure HTTP cookies.intCREATED()booleanintintvoidfixedDelayMilliseconds(int timeInMilliseconds) Allows to set a fixed delay of the response in milliseconds.intintFOUND()Allows to reference entries from the request.intbooleangetAsync()getBody()getDelay()org.springframework.cloud.contract.spec.internal.Response.ServerPatternValueDslPropertyintGONE()inthashCode()voidheaders(groovy.lang.Closure consumer) Allows to configure HTTP headers.voidAllows to configure HTTP headers.intintintIM_USED()intintbooleanisAsync()intintLOCKED()intintintintintintintintintintintintintintOK()intintintintintintintintregexProperty(Object object) intintintintintintvoidsetAsync(boolean async) voidvoidsetBodyMatchers(ResponseBodyMatchers bodyMatchers) voidsetCookies(Cookies cookies) voidsetDelay(DslProperty delay) voidsetHeaders(Headers headers) voidsetProperty(org.springframework.cloud.contract.spec.internal.Response.ServerPatternValueDslProperty property) voidsetStatus(DslProperty status) voidstatus(int status) Allows to set the HTTP status.voidstatus(DslProperty status) Allows to set the HTTP status.intintinttoString()intintintintintintAllows to set a dynamic value for the given element.value(ClientDslProperty client, ServerDslProperty server) Allows to set a dynamic value for the given element.value(RegexProperty server) Allows to set a dynamic value for the given element.value(ServerDslProperty server) Allows to set a dynamic value for the given element.value(ServerDslProperty server, ClientDslProperty client) Allows to set a dynamic value for the given element.intMethods 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 Details
-
Response
public Response() -
Response
-
-
Method Details
-
status
public void status(int status) Allows to set the HTTP status.- Parameters:
status- HTTP status
-
status
Allows to set the HTTP status.- Parameters:
status- HTTP status
-
body
Allows set an HTTP body.- Parameters:
body- body to set
-
body
Allows set an HTTP body.- Parameters:
body- body to set
-
body
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
- Overrides:
assertThatSidesMatchin classCommon
-
value
Allows to set a dynamic value for the given element.- Parameters:
server- server value- Returns:
- dsl property
-
$
Allows to set a dynamic value for the given element.- Parameters:
server- server value- Returns:
- dsl property
-
value
Allows to set a dynamic value for the given element.- Parameters:
server- server value- Returns:
- dsl property
-
value
Allows to set a dynamic value for the given element.- Parameters:
server- server value- Returns:
- dsl property
-
$
Allows to set a dynamic value for the given element.- Parameters:
server- server value- Returns:
- dsl property
-
$
Allows to set a dynamic value for the given element.- Parameters:
server- server value- Returns:
- dsl property
-
regexProperty
- Overrides:
regexPropertyin classCommon
-
fromRequest
Allows to reference entries from the request.- Returns:
- from request object
-
value
Allows to set a dynamic value for the given element. -
value
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
-
setStatus
-
getDelay
-
setDelay
-
getHeaders
-
setHeaders
-
getCookies
-
setCookies
-
getBody
-
setBody
-
getAsync
public boolean getAsync() -
isAsync
public boolean isAsync() -
setAsync
public void setAsync(boolean async) -
getBodyMatchers
-
setBodyMatchers
-
anyAlphaUnicode
-
anyAlphaNumeric
-
anyNumber
-
anyInteger
-
anyPositiveInt
-
anyDouble
-
anyHex
-
aBoolean
-
anyIpAddress
-
anyHostname
-
anyEmail
-
anyUrl
-
anyHttpsUrl
-
anyUuid
-
anyDate
-
anyDateTime
-
anyTime
-
anyIso8601WithOffset
-
anyNonBlankString
-
anyNonEmptyString
-
anyOf
-
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() -
equals
-
hashCode
public int hashCode() -
toString
-
headers
Allows to configure HTTP headers.- Parameters:
consumer- function to manipulate the URL
-
cookies
Allows to configure HTTP cookies.- Parameters:
consumer- function to manipulate the URL
-
bodyMatchers
Allows to set matchers for the body.- Parameters:
consumer- function to manipulate the URL
-
headers
Allows to configure HTTP headers.- Parameters:
consumer- function to manipulate the URL
-
cookies
Allows to configure HTTP cookies.- Parameters:
consumer- function to manipulate the URL
-
bodyMatchers
Allows to set matchers for the body.- Parameters:
consumer- function to manipulate the URL
-