Class Request
java.lang.Object
org.springframework.cloud.contract.spec.internal.Common
org.springframework.cloud.contract.spec.internal.Request
Represents the request 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 Pattern element.$(ClientDslProperty client) Allows to set a dynamic value for the given element.$(RegexProperty property) Allows to set a dynamic value for the given regular expression element.aBoolean()absent()Sets absence check to the given query parameter.anyDate()anyEmail()anyHex()anyTime()anyUrl()anyUuid()voidassertThatSidesMatch(Object stubSide, Object testSide) voidAllows set an HTTP body.voidAllows set an HTTP body.voidAllows set an HTTP body.voidbody(DslProperty dslProperty) Allows set an HTTP body.voidbody(MatchingStrategy matchingStrategy) Allows set an HTTP body.voidbodyMatchers(groovy.lang.Closure consumer) Allows to set matchers for the body.voidbodyMatchers(Consumer<BodyMatchers> consumer) Allows to set matchers for the body.containing(Object value) Sets the containing check to the given query parameter.voidcookies(groovy.lang.Closure consumer) Allows to configure HTTP cookies.voidAllows to configure HTTP cookies.DELETE()booleanSets the equality check to the given query parameter.equalToJson(Object value) Sets the JSON equality check to the body.equalToXml(Object value) Sets the XML equality check to the body.GET()getBody()org.springframework.cloud.contract.spec.internal.Request.ClientPatternValueDslPropertygetUrl()inthashCode()HEAD()voidheaders(groovy.lang.Closure consumer) Allows to configure HTTP headers.voidAllows to configure HTTP headers.Sets the matching check to the given query parameter.voidName of the HTTP method.voidmethod(DslProperty method) Name of the HTTP method.voidAllows to set multipart value.voidAllows to set multipart via lists.voidAllows to set multipart via the map notation.voidmultipart(DslProperty dslProperty) Allows to set multipart value.notMatching(Object value) Sets the not matching check to the given query parameter.OPTIONS()PATCH()POST()PUT()regexProperty(Object object) voidvoidsetBodyMatchers(BodyMatchers bodyMatchers) voidsetCookies(Cookies cookies) voidsetHeaders(Headers headers) voidsetMethod(DslProperty method) voidsetMultipart(Multipart multipart) voidsetProperty(org.springframework.cloud.contract.spec.internal.Request.ClientPatternValueDslProperty property) voidvoidsetUrlPath(UrlPath urlPath) toString()TRACE()voidvoidThe URL of the contract.voidThe URL of the contract.voidurl(DslProperty url) voidurl(DslProperty url, groovy.lang.Closure consumer) URL to which the request will be sent.voidurl(DslProperty url, Consumer<Url> consumer) URL to which the request will be sent.voidvoidvoidURL to which the request will be sent.voidURL to which the request will be sent.voidurlPath(DslProperty path) voidurlPath(DslProperty path, groovy.lang.Closure consumer) URL to which the request will be sent.voidurlPath(DslProperty path, Consumer<UrlPath> consumer) URL to which the request will be sent.Allows to set a dynamic value for the Pattern element.value(ClientDslProperty client) Allows to set a dynamic value for the given element.value(ClientDslProperty client, ServerDslProperty server) Allows to set a dynamic value for client and server side.value(RegexProperty property) Allows to set a dynamic value for the given regular expression element.value(ServerDslProperty server, ClientDslProperty client) Allows to set a dynamic value for client and server side.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 Details
-
Request
public Request() -
Request
-
-
Method Details
-
method
Name of the HTTP method.- Parameters:
method- HTTP method name
-
method
Name of the HTTP method.- Parameters:
method- HTTP method name
-
url
- Parameters:
url- URL to which the request will be sent
-
url
- Parameters:
url- URL to which the request will be sent
-
urlPath
- Parameters:
path- URL to which the request will be sent
-
urlPath
- Parameters:
path- URL to which the request will be sent
-
urlPath
- Parameters:
path- URL to which the request will be sent
-
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:
matchingStrategy- body to set
-
body
Allows set an HTTP body.- Parameters:
dslProperty- body to set
-
body
Allows set an HTTP body.- Parameters:
bodyAsValue- body to set
-
getBody
-
setBody
-
multipart
Allows to set multipart via the map notation.- Parameters:
body- multipart in a map notation
-
multipart
Allows to set multipart via lists.- Parameters:
multipartAsList- multipart in a list notation
-
multipart
Allows to set multipart value.- Parameters:
dslProperty- multipart
-
multipart
Allows to set multipart value.- Parameters:
multipartAsValue- multipart
-
equalTo
Sets the equality check to the given query parameter.- Parameters:
value- value to check against- Returns:
- matching strategy
-
containing
Sets the containing check to the given query parameter.- Parameters:
value- value to check against- Returns:
- matching strategy
-
matching
Sets the matching check to the given query parameter.- Parameters:
value- value to check against- Returns:
- matching strategy
-
notMatching
Sets the not matching check to the given query parameter.- Parameters:
value- value to check against- Returns:
- matching strategy
-
equalToXml
Sets the XML equality check to the body.- Parameters:
value- value to check against- Returns:
- matching strategy
-
equalToJson
Sets the JSON equality check to the body.- Parameters:
value- value to check against- Returns:
- matching strategy
-
absent
Sets absence check to the given query parameter.- Returns:
- matching strategy
-
assertThatSidesMatch
- Overrides:
assertThatSidesMatchin classCommon
-
value
Allows to set a dynamic value for the given element.- Parameters:
client- client value- Returns:
- dsl property
-
$
Allows to set a dynamic value for the given regular expression element.- Parameters:
property- property to set- Returns:
- dsl property
-
value
Allows to set a dynamic value for the given regular expression element.- Parameters:
property- property to set- Returns:
- dsl property
-
$
Allows to set a dynamic value for the given element.- Parameters:
client- property to set- Returns:
- dsl property
-
value
Allows to set a dynamic value for the Pattern element.- Parameters:
client- property to set- Returns:
- dsl property
-
$
Allows to set a dynamic value for the given Pattern element.- Parameters:
client- property to set- Returns:
- dsl property
-
regexProperty
- Overrides:
regexPropertyin classCommon
-
value
Allows to set a dynamic value for client and server side. -
value
Allows to set a dynamic value for client and server side. -
getProperty
public org.springframework.cloud.contract.spec.internal.Request.ClientPatternValueDslProperty getProperty() -
setProperty
public void setProperty(org.springframework.cloud.contract.spec.internal.Request.ClientPatternValueDslProperty property) -
getMethod
-
setMethod
-
getUrl
-
setUrl
-
getUrlPath
-
setUrlPath
-
getHeaders
-
setHeaders
-
getCookies
-
setCookies
-
getMultipart
-
setMultipart
-
getBodyMatchers
-
setBodyMatchers
-
anyAlphaUnicode
-
anyAlphaNumeric
-
anyNumber
-
anyInteger
-
anyPositiveInt
-
anyDouble
-
anyHex
-
aBoolean
-
anyIpAddress
-
anyHostname
-
anyEmail
-
anyUrl
-
anyHttpsUrl
-
anyUuid
-
anyDate
-
anyDateTime
-
anyTime
-
anyIso8601WithOffset
-
anyNonBlankString
-
anyNonEmptyString
-
anyOf
-
GET
-
HEAD
-
POST
-
PUT
-
PATCH
-
DELETE
-
OPTIONS
-
TRACE
-
equals
-
hashCode
public int hashCode() -
toString
-
url
The URL of the contract.- Parameters:
url- url valueconsumer- function to manipulate the URL
-
url
URL to which the request will be sent. Allows to customize additional query parameters if needed- Parameters:
url- url valueconsumer- function to manipulate the URL
-
urlPath
URL to which the request will be sent. Allows to customize additional query. parameters if needed- Parameters:
path- url valueconsumer- function to manipulate the URL
-
urlPath
URL to which the request will be sent. Allows to customize additional query. parameters if needed- Parameters:
path- url valueconsumer- function to manipulate the URL
-
headers
Allows to configure HTTP headers.- Parameters:
consumer- function to manipulate the headers
-
cookies
Allows to configure HTTP cookies.- Parameters:
consumer- function to manipulate the cookies
-
bodyMatchers
Allows to set matchers for the body.- Parameters:
consumer- function to manipulate the URL
-
url
The URL of the contract.- Parameters:
url- url valueconsumer- function to manipulate the URL
-
url
URL to which the request will be sent. Allows to customize additional query parameters if needed- Parameters:
url- url valueconsumer- function to manipulate the URL
-
urlPath
URL to which the request will be sent. Allows to customize additional query. parameters if needed- Parameters:
path- url valueconsumer- function to manipulate the URL
-
urlPath
URL to which the request will be sent. Allows to customize additional query. parameters if needed- Parameters:
path- url valueconsumer- function to manipulate the URL
-
headers
Allows to configure HTTP headers.- Parameters:
consumer- function to manipulate the headers
-
cookies
Allows to configure HTTP cookies.- Parameters:
consumer- function to manipulate the cookies
-
bodyMatchers
Allows to set matchers for the body.- Parameters:
consumer- function to manipulate the URL
-