Package 

Class PactDslResponse

    • Method Detail

      • headers

         PactDslResponse headers(Map<String, String> headers)

        Response headers to return Provide the headers you want to validate, other headers will be ignored.

        Parameters:
        headers - key-value pairs of headers
      • body

         PactDslResponse body(String body, String contentType)

        Response body to return

        Parameters:
        body - body in string form
        contentType - the Content-Type response header value
      • body

         PactDslResponse body(String body, ContentType contentType)

        Response body to return

        Parameters:
        body - body in string form
        contentType - the Content-Type response header value
      • body

         PactDslResponse body(Supplier<String> body)

        The body of the request

        Parameters:
        body - Response body in Java Functional Interface Supplier that must return a string
      • body

         PactDslResponse body(Supplier<String> body, String contentType)

        The body of the request

        Parameters:
        body - Response body in Java Functional Interface Supplier that must return a string
        contentType - the Content-Type response header value
      • body

         PactDslResponse body(Supplier<String> body, ContentType contentType)

        The body of the request

        Parameters:
        body - Response body in Java Functional Interface Supplier that must return a string
        contentType - the Content-Type response header value
      • bodyWithSingleQuotes

         PactDslResponse bodyWithSingleQuotes(String body)

        The body of the request with possible single quotes as delimiters and using QuoteUtil to convert single quotes to double quotes if required.

        Parameters:
        body - Request body in string form
      • bodyWithSingleQuotes

         PactDslResponse bodyWithSingleQuotes(String body, String contentType)

        The body of the request with possible single quotes as delimiters and using QuoteUtil to convert single quotes to double quotes if required.

        Parameters:
        body - Request body in string form
        contentType - the Content-Type response header value
      • bodyWithSingleQuotes

         PactDslResponse bodyWithSingleQuotes(String body, ContentType contentType)

        The body of the request with possible single quotes as delimiters and using QuoteUtil to convert single quotes to double quotes if required.

        Parameters:
        body - Request body in string form
        contentType - the Content-Type response header value
      • body

         PactDslResponse body(JSONObject body)

        Response body to return

        Parameters:
        body - Response body in JSON form
      • withBinaryData

         PactDslResponse withBinaryData(Array<byte> example, String contentType)

        Response body as a binary data. It will match any expected bodies against the content type.

        Parameters:
        example - Example contents to use in the consumer test
        contentType - Content type of the data
      • matchHeader

         PactDslResponse matchHeader(String header, String regexp)

        Match a response header. A random example header value will be generated from the provided regular expression.

        Parameters:
        header - Header to match
        regexp - Regular expression to match
      • matchHeader

         PactDslResponse matchHeader(String header, String regexp, String headerExample)

        Match a response header.

        Parameters:
        header - Header to match
        regexp - Regular expression to match
        headerExample - Example value to use
      • toPact

         <P extends BasePact> P toPact(Class<P> pactClass)

        Terminates the DSL and builds a pact to represent the interactions

      • toPact

         RequestResponsePact toPact()

        Terminates the DSL and builds a pact to represent the interactions

      • headerFromProviderState

         PactDslResponse headerFromProviderState(String name, String expression, String example)

        Adds a header that will have it's value injected from the provider state

        Parameters:
        name - Header Name
        expression - Expression to be evaluated from the provider state
        example - Example value to use in the consumer test