public class Request extends Common
Modifier and Type | Method and Description |
---|---|
DslProperty |
$(ClientDslProperty client)
Allows to set a dynamic value for the given element.
|
DslProperty |
$(Pattern client)
Allows to set a dynamic value for the given Pattern element.
|
DslProperty |
$(RegexProperty property)
Allows to set a dynamic value for the given regular expression element.
|
ClientDslProperty |
aBoolean() |
MatchingStrategy |
absent()
Sets absence check to the given query parameter.
|
ClientDslProperty |
anyAlphaNumeric() |
ClientDslProperty |
anyAlphaUnicode() |
ClientDslProperty |
anyDate() |
ClientDslProperty |
anyDateTime() |
ClientDslProperty |
anyDouble() |
ClientDslProperty |
anyEmail() |
ClientDslProperty |
anyHex() |
ClientDslProperty |
anyHostname() |
ClientDslProperty |
anyHttpsUrl() |
ClientDslProperty |
anyInteger() |
ClientDslProperty |
anyIpAddress() |
ClientDslProperty |
anyIso8601WithOffset() |
ClientDslProperty |
anyNonBlankString() |
ClientDslProperty |
anyNonEmptyString() |
ClientDslProperty |
anyNumber() |
ClientDslProperty |
anyOf(String... values) |
ClientDslProperty |
anyPositiveInt() |
ClientDslProperty |
anyTime() |
ClientDslProperty |
anyUrl() |
ClientDslProperty |
anyUuid() |
void |
assertThatSidesMatch(Object stubSide,
Object testSide) |
void |
body(DslProperty dslProperty)
Allows set an HTTP body.
|
void |
body(List body)
Allows set an HTTP body.
|
void |
body(Map<String,Object> body)
Allows set an HTTP body.
|
void |
body(MatchingStrategy matchingStrategy)
Allows set an HTTP body.
|
void |
body(Object bodyAsValue)
Allows set an HTTP body.
|
void |
bodyMatchers(groovy.lang.Closure consumer)
Allows to set matchers for the body.
|
void |
bodyMatchers(Consumer<BodyMatchers> consumer)
Allows to set matchers for the body.
|
MatchingStrategy |
containing(Object value)
Sets the containing check to the given query parameter.
|
void |
cookies(groovy.lang.Closure consumer)
Allows to configure HTTP cookies.
|
void |
cookies(Consumer<Cookies> consumer)
Allows to configure HTTP cookies.
|
String |
DELETE() |
boolean |
equals(Object o) |
MatchingStrategy |
equalTo(Object value)
Sets the equality check to the given query parameter.
|
MatchingStrategy |
equalToJson(Object value)
Sets the JSON equality check to the body.
|
MatchingStrategy |
equalToXml(Object value)
Sets the XML equality check to the body.
|
String |
GET() |
Body |
getBody() |
BodyMatchers |
getBodyMatchers() |
Cookies |
getCookies() |
Headers |
getHeaders() |
DslProperty |
getMethod() |
Multipart |
getMultipart() |
org.springframework.cloud.contract.spec.internal.Request.ClientPatternValueDslProperty |
getProperty() |
Url |
getUrl() |
UrlPath |
getUrlPath() |
int |
hashCode() |
String |
HEAD() |
void |
headers(groovy.lang.Closure consumer)
Allows to configure HTTP headers.
|
void |
headers(Consumer<Headers> consumer)
Allows to configure HTTP headers.
|
MatchingStrategy |
matching(Object value)
Sets the matching check to the given query parameter.
|
void |
method(DslProperty method)
Name of the HTTP method.
|
void |
method(HttpMethods.HttpMethod httpMethod)
Deprecated.
In favor of
method(String method) |
void |
method(String method)
Name of the HTTP method.
|
void |
multipart(DslProperty dslProperty)
Allows to set multipart value.
|
void |
multipart(List multipartAsList)
Allows to set multipart via lists.
|
void |
multipart(Map<String,Object> body)
Allows to set multipart via the map notation.
|
void |
multipart(Object multipartAsValue)
Allows to set multipart value.
|
MatchingStrategy |
notMatching(Object value)
Sets the not matching check to the given query parameter.
|
String |
OPTIONS() |
String |
PATCH() |
String |
POST() |
String |
PUT() |
RegexProperty |
regexProperty(Object object) |
void |
setBody(Body body) |
void |
setBodyMatchers(BodyMatchers bodyMatchers) |
void |
setCookies(Cookies cookies) |
void |
setHeaders(Headers headers) |
void |
setMethod(DslProperty method) |
void |
setMultipart(Multipart multipart) |
void |
setProperty(org.springframework.cloud.contract.spec.internal.Request.ClientPatternValueDslProperty property) |
void |
setUrl(Url url) |
void |
setUrlPath(UrlPath urlPath) |
void |
stubMatchers(groovy.lang.Closure consumer)
Deprecated.
Deprecated in favor of bodyMatchers to support other future
bodyMatchers too
|
void |
stubMatchers(Consumer<BodyMatchers> consumer)
Deprecated.
Deprecated in favor of bodyMatchers to support other future
bodyMatchers too
|
String |
toString() |
String |
TRACE() |
void |
url(DslProperty url) |
void |
url(DslProperty url,
groovy.lang.Closure consumer)
URL to which the request will be sent.
|
void |
url(DslProperty url,
Consumer<Url> consumer)
URL to which the request will be sent.
|
void |
url(Object url) |
void |
url(Object url,
groovy.lang.Closure consumer)
The URL of the contract.
|
void |
url(Object url,
Consumer<Url> consumer)
The URL of the contract.
|
void |
urlPath(DslProperty path) |
void |
urlPath(DslProperty path,
groovy.lang.Closure consumer)
URL to which the request will be sent.
|
void |
urlPath(DslProperty path,
Consumer<UrlPath> consumer)
URL to which the request will be sent.
|
void |
urlPath(Object path) |
void |
urlPath(String path) |
void |
urlPath(String path,
groovy.lang.Closure consumer)
URL to which the request will be sent.
|
void |
urlPath(String path,
Consumer<UrlPath> consumer)
URL to which the request will be sent.
|
DslProperty |
value(ClientDslProperty client)
Allows to set a dynamic value for the given element.
|
DslProperty |
value(ClientDslProperty client,
ServerDslProperty server)
Allows to set a dynamic value for client and server side.
|
DslProperty |
value(Pattern client)
Allows to set a dynamic value for the Pattern element.
|
DslProperty |
value(RegexProperty property)
Allows to set a dynamic value for the given regular expression element.
|
DslProperty |
value(ServerDslProperty server,
ClientDslProperty client)
Allows to set a dynamic value for client and server side.
|
$, $, $, $, 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
public Request()
public Request(Request request)
public void method(String method)
method
- HTTP method name@Deprecated public void method(HttpMethods.HttpMethod httpMethod)
method(String method)
httpMethod
- HTTP method namepublic void method(DslProperty method)
method
- HTTP method namepublic void url(Object url)
url
- URL to which the request will be sentpublic void url(DslProperty url)
url
- URL to which the request will be sentpublic void urlPath(String path)
path
- URL to which the request will be sentpublic void urlPath(Object path)
path
- URL to which the request will be sentpublic void urlPath(DslProperty path)
path
- URL to which the request will be sentpublic void body(Map<String,Object> body)
body
- body to setpublic void body(List body)
body
- body to setpublic void body(MatchingStrategy matchingStrategy)
matchingStrategy
- body to setpublic void body(DslProperty dslProperty)
dslProperty
- body to setpublic void body(Object bodyAsValue)
bodyAsValue
- body to setpublic Body getBody()
public void setBody(Body body)
public void multipart(Map<String,Object> body)
body
- multipart in a map notationpublic void multipart(List multipartAsList)
multipartAsList
- multipart in a list notationpublic void multipart(DslProperty dslProperty)
dslProperty
- multipartpublic void multipart(Object multipartAsValue)
multipartAsValue
- multipartpublic MatchingStrategy equalTo(Object value)
value
- value to check againstpublic MatchingStrategy containing(Object value)
value
- value to check againstpublic MatchingStrategy matching(Object value)
value
- value to check againstpublic MatchingStrategy notMatching(Object value)
value
- value to check againstpublic MatchingStrategy equalToXml(Object value)
value
- value to check againstpublic MatchingStrategy equalToJson(Object value)
value
- value to check againstpublic MatchingStrategy absent()
public void assertThatSidesMatch(Object stubSide, Object testSide)
assertThatSidesMatch
in class Common
public DslProperty value(ClientDslProperty client)
client
- client valuepublic DslProperty $(RegexProperty property)
property
- property to setpublic DslProperty value(RegexProperty property)
property
- property to setpublic DslProperty $(ClientDslProperty client)
client
- property to setpublic DslProperty value(Pattern client)
client
- property to setpublic DslProperty $(Pattern client)
client
- property to setpublic RegexProperty regexProperty(Object object)
regexProperty
in class Common
public DslProperty value(ClientDslProperty client, ServerDslProperty server)
public DslProperty value(ServerDslProperty server, ClientDslProperty client)
public org.springframework.cloud.contract.spec.internal.Request.ClientPatternValueDslProperty getProperty()
public void setProperty(org.springframework.cloud.contract.spec.internal.Request.ClientPatternValueDslProperty property)
public DslProperty getMethod()
public void setMethod(DslProperty method)
public Url getUrl()
public void setUrl(Url url)
public UrlPath getUrlPath()
public void setUrlPath(UrlPath urlPath)
public Headers getHeaders()
public void setHeaders(Headers headers)
public Cookies getCookies()
public void setCookies(Cookies cookies)
public Multipart getMultipart()
public void setMultipart(Multipart multipart)
public BodyMatchers getBodyMatchers()
public void setBodyMatchers(BodyMatchers bodyMatchers)
public ClientDslProperty anyAlphaUnicode()
public ClientDslProperty anyAlphaNumeric()
public ClientDslProperty anyNumber()
public ClientDslProperty anyInteger()
public ClientDslProperty anyPositiveInt()
public ClientDslProperty anyDouble()
public ClientDslProperty anyHex()
public ClientDslProperty aBoolean()
public ClientDslProperty anyIpAddress()
public ClientDslProperty anyHostname()
public ClientDslProperty anyEmail()
public ClientDslProperty anyUrl()
public ClientDslProperty anyHttpsUrl()
public ClientDslProperty anyUuid()
public ClientDslProperty anyDate()
public ClientDslProperty anyDateTime()
public ClientDslProperty anyTime()
public ClientDslProperty anyIso8601WithOffset()
public ClientDslProperty anyNonBlankString()
public ClientDslProperty anyNonEmptyString()
public ClientDslProperty anyOf(String... values)
public String GET()
public String HEAD()
public String POST()
public String PUT()
public String PATCH()
public String DELETE()
public String OPTIONS()
public String TRACE()
public void url(Object url, Consumer<Url> consumer)
url
- url valueconsumer
- function to manipulate the URLpublic void url(DslProperty url, Consumer<Url> consumer)
url
- url valueconsumer
- function to manipulate the URLpublic void urlPath(String path, Consumer<UrlPath> consumer)
path
- url valueconsumer
- function to manipulate the URLpublic void urlPath(DslProperty path, Consumer<UrlPath> consumer)
path
- url valueconsumer
- function to manipulate the URLpublic void headers(Consumer<Headers> consumer)
consumer
- function to manipulate the headerspublic void cookies(Consumer<Cookies> consumer)
consumer
- function to manipulate the cookies@Deprecated public void stubMatchers(Consumer<BodyMatchers> consumer)
consumer
- function to manipulate the body matcherspublic void bodyMatchers(Consumer<BodyMatchers> consumer)
consumer
- function to manipulate the URLpublic void url(Object url, @DelegatesTo(value=Url.class) groovy.lang.Closure consumer)
url
- url valueconsumer
- function to manipulate the URLpublic void url(DslProperty url, @DelegatesTo(value=Url.class) groovy.lang.Closure consumer)
url
- url valueconsumer
- function to manipulate the URLpublic void urlPath(String path, @DelegatesTo(value=UrlPath.class) groovy.lang.Closure consumer)
path
- url valueconsumer
- function to manipulate the URLpublic void urlPath(DslProperty path, @DelegatesTo(value=UrlPath.class) groovy.lang.Closure consumer)
path
- url valueconsumer
- function to manipulate the URLpublic void headers(@DelegatesTo(value=Headers.class) groovy.lang.Closure consumer)
consumer
- function to manipulate the headerspublic void cookies(@DelegatesTo(value=Cookies.class) groovy.lang.Closure consumer)
consumer
- function to manipulate the cookies@Deprecated public void stubMatchers(@DelegatesTo(value=BodyMatchers.class) groovy.lang.Closure consumer)
consumer
- function to manipulate the body matcherspublic void bodyMatchers(@DelegatesTo(value=BodyMatchers.class) groovy.lang.Closure consumer)
consumer
- function to manipulate the URLCopyright © 2016–2019 Spring. All rights reserved.