java.lang.Object
org.springframework.cloud.contract.spec.internal.Common
org.springframework.cloud.contract.spec.internal.Request

public class Request extends Common
Represents the request side of the HTTP communication.
Since:
1.0.0
Author:
Marcin Grzejszczak, Tim Ysewyn
  • Constructor Details

    • Request

      public Request()
    • Request

      public Request(Request request)
  • Method Details

    • method

      public void method(String method)
      Name of the HTTP method.
      Parameters:
      method - HTTP method name
    • method

      public void method(DslProperty method)
      Name of the HTTP method.
      Parameters:
      method - HTTP method name
    • url

      public void url(Object url)
      Parameters:
      url - URL to which the request will be sent
    • url

      public void url(DslProperty url)
      Parameters:
      url - URL to which the request will be sent
    • urlPath

      public void urlPath(String path)
      Parameters:
      path - URL to which the request will be sent
    • urlPath

      public void urlPath(Object path)
      Parameters:
      path - URL to which the request will be sent
    • urlPath

      public void urlPath(DslProperty path)
      Parameters:
      path - URL to which the request will be sent
    • 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(MatchingStrategy matchingStrategy)
      Allows set an HTTP body.
      Parameters:
      matchingStrategy - body to set
    • body

      public void body(DslProperty dslProperty)
      Allows set an HTTP body.
      Parameters:
      dslProperty - body to set
    • body

      public void body(Object bodyAsValue)
      Allows set an HTTP body.
      Parameters:
      bodyAsValue - body to set
    • getBody

      public Body getBody()
    • setBody

      public void setBody(Body body)
    • multipart

      public void multipart(Map<String,Object> body)
      Allows to set multipart via the map notation.
      Parameters:
      body - multipart in a map notation
    • multipart

      public void multipart(List multipartAsList)
      Allows to set multipart via lists.
      Parameters:
      multipartAsList - multipart in a list notation
    • multipart

      public void multipart(DslProperty dslProperty)
      Allows to set multipart value.
      Parameters:
      dslProperty - multipart
    • multipart

      public void multipart(Object multipartAsValue)
      Allows to set multipart value.
      Parameters:
      multipartAsValue - multipart
    • equalTo

      public MatchingStrategy equalTo(Object value)
      Sets the equality check to the given query parameter.
      Parameters:
      value - value to check against
      Returns:
      matching strategy
    • containing

      public MatchingStrategy containing(Object value)
      Sets the containing check to the given query parameter.
      Parameters:
      value - value to check against
      Returns:
      matching strategy
    • matching

      public MatchingStrategy matching(Object value)
      Sets the matching check to the given query parameter.
      Parameters:
      value - value to check against
      Returns:
      matching strategy
    • notMatching

      public MatchingStrategy notMatching(Object value)
      Sets the not matching check to the given query parameter.
      Parameters:
      value - value to check against
      Returns:
      matching strategy
    • equalToXml

      public MatchingStrategy equalToXml(Object value)
      Sets the XML equality check to the body.
      Parameters:
      value - value to check against
      Returns:
      matching strategy
    • equalToJson

      public MatchingStrategy equalToJson(Object value)
      Sets the JSON equality check to the body.
      Parameters:
      value - value to check against
      Returns:
      matching strategy
    • absent

      public MatchingStrategy absent()
      Sets absence check to the given query parameter.
      Returns:
      matching strategy
    • assertThatSidesMatch

      public void assertThatSidesMatch(Object stubSide, Object testSide)
      Overrides:
      assertThatSidesMatch in class Common
    • value

      public DslProperty value(ClientDslProperty client)
      Allows to set a dynamic value for the given element.
      Parameters:
      client - client value
      Returns:
      dsl property
    • $

      public DslProperty $(RegexProperty property)
      Allows to set a dynamic value for the given regular expression element.
      Parameters:
      property - property to set
      Returns:
      dsl property
    • value

      public DslProperty value(RegexProperty property)
      Allows to set a dynamic value for the given regular expression element.
      Parameters:
      property - property to set
      Returns:
      dsl property
    • $

      public DslProperty $(ClientDslProperty client)
      Allows to set a dynamic value for the given element.
      Parameters:
      client - property to set
      Returns:
      dsl property
    • value

      public DslProperty value(Pattern client)
      Allows to set a dynamic value for the Pattern element.
      Parameters:
      client - property to set
      Returns:
      dsl property
    • $

      public DslProperty $(Pattern client)
      Allows to set a dynamic value for the given Pattern element.
      Parameters:
      client - property to set
      Returns:
      dsl property
    • regexProperty

      public RegexProperty regexProperty(Object object)
      Overrides:
      regexProperty in class Common
    • value

      public DslProperty value(ClientDslProperty client, ServerDslProperty server)
      Allows to set a dynamic value for client and server side.
      Overrides:
      value in class Common
      Parameters:
      client - client value
      server - server value
      Returns:
      dsl property
    • value

      public DslProperty value(ServerDslProperty server, ClientDslProperty client)
      Allows to set a dynamic value for client and server side.
      Overrides:
      value in class Common
      Parameters:
      client - client value
      server - server value
      Returns:
      dsl property
    • 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

      public DslProperty getMethod()
    • setMethod

      public void setMethod(DslProperty method)
    • getUrl

      public Url getUrl()
    • setUrl

      public void setUrl(Url url)
    • getUrlPath

      public UrlPath getUrlPath()
    • setUrlPath

      public void setUrlPath(UrlPath urlPath)
    • getHeaders

      public Headers getHeaders()
    • setHeaders

      public void setHeaders(Headers headers)
    • getCookies

      public Cookies getCookies()
    • setCookies

      public void setCookies(Cookies cookies)
    • getMultipart

      public Multipart getMultipart()
    • setMultipart

      public void setMultipart(Multipart multipart)
    • getBodyMatchers

      public BodyMatchers getBodyMatchers()
    • setBodyMatchers

      public void setBodyMatchers(BodyMatchers bodyMatchers)
    • anyAlphaUnicode

      public ClientDslProperty anyAlphaUnicode()
    • anyAlphaNumeric

      public ClientDslProperty anyAlphaNumeric()
    • anyNumber

      public ClientDslProperty anyNumber()
    • anyInteger

      public ClientDslProperty anyInteger()
    • anyPositiveInt

      public ClientDslProperty anyPositiveInt()
    • anyDouble

      public ClientDslProperty anyDouble()
    • anyHex

      public ClientDslProperty anyHex()
    • aBoolean

      public ClientDslProperty aBoolean()
    • anyIpAddress

      public ClientDslProperty anyIpAddress()
    • anyHostname

      public ClientDslProperty anyHostname()
    • anyEmail

      public ClientDslProperty anyEmail()
    • anyUrl

      public ClientDslProperty anyUrl()
    • anyHttpsUrl

      public ClientDslProperty anyHttpsUrl()
    • anyUuid

      public ClientDslProperty anyUuid()
    • anyDate

      public ClientDslProperty anyDate()
    • anyDateTime

      public ClientDslProperty anyDateTime()
    • anyTime

      public ClientDslProperty anyTime()
    • anyIso8601WithOffset

      public ClientDslProperty anyIso8601WithOffset()
    • anyNonBlankString

      public ClientDslProperty anyNonBlankString()
    • anyNonEmptyString

      public ClientDslProperty anyNonEmptyString()
    • anyOf

      public ClientDslProperty anyOf(String... values)
    • GET

      public String GET()
    • HEAD

      public String HEAD()
    • POST

      public String POST()
    • PUT

      public String PUT()
    • PATCH

      public String PATCH()
    • DELETE

      public String DELETE()
    • OPTIONS

      public String OPTIONS()
    • TRACE

      public String TRACE()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • url

      public void url(Object url, Consumer<Url> consumer)
      The URL of the contract.
      Parameters:
      url - url value
      consumer - function to manipulate the URL
    • url

      public void url(DslProperty url, Consumer<Url> consumer)
      URL to which the request will be sent. Allows to customize additional query parameters if needed
      Parameters:
      url - url value
      consumer - function to manipulate the URL
    • urlPath

      public void urlPath(String path, Consumer<UrlPath> consumer)
      URL to which the request will be sent. Allows to customize additional query. parameters if needed
      Parameters:
      path - url value
      consumer - function to manipulate the URL
    • urlPath

      public void urlPath(DslProperty path, Consumer<UrlPath> consumer)
      URL to which the request will be sent. Allows to customize additional query. parameters if needed
      Parameters:
      path - url value
      consumer - function to manipulate the URL
    • headers

      public void headers(Consumer<Headers> consumer)
      Allows to configure HTTP headers.
      Parameters:
      consumer - function to manipulate the headers
    • cookies

      public void cookies(Consumer<Cookies> consumer)
      Allows to configure HTTP cookies.
      Parameters:
      consumer - function to manipulate the cookies
    • bodyMatchers

      public void bodyMatchers(Consumer<BodyMatchers> consumer)
      Allows to set matchers for the body.
      Parameters:
      consumer - function to manipulate the URL
    • url

      public void url(Object url, @DelegatesTo(Url.class) groovy.lang.Closure consumer)
      The URL of the contract.
      Parameters:
      url - url value
      consumer - function to manipulate the URL
    • url

      public void url(DslProperty url, @DelegatesTo(Url.class) groovy.lang.Closure consumer)
      URL to which the request will be sent. Allows to customize additional query parameters if needed
      Parameters:
      url - url value
      consumer - function to manipulate the URL
    • urlPath

      public void urlPath(String path, @DelegatesTo(UrlPath.class) groovy.lang.Closure consumer)
      URL to which the request will be sent. Allows to customize additional query. parameters if needed
      Parameters:
      path - url value
      consumer - function to manipulate the URL
    • urlPath

      public void urlPath(DslProperty path, @DelegatesTo(UrlPath.class) groovy.lang.Closure consumer)
      URL to which the request will be sent. Allows to customize additional query. parameters if needed
      Parameters:
      path - url value
      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 headers
    • cookies

      public void cookies(@DelegatesTo(Cookies.class) groovy.lang.Closure consumer)
      Allows to configure HTTP cookies.
      Parameters:
      consumer - function to manipulate the cookies
    • bodyMatchers

      public void bodyMatchers(@DelegatesTo(BodyMatchers.class) groovy.lang.Closure consumer)
      Allows to set matchers for the body.
      Parameters:
      consumer - function to manipulate the URL