public class PactDslRequestWithPath
extends PactDslRequestBase
public PactDslRequestWithPath method(java.lang.String method)
The HTTP method for the request
method
- Valid HTTP methodpublic PactDslRequestWithPath headers(java.lang.String firstHeaderName, java.lang.String firstHeaderValue, java.lang.String... headerNameValuePairs)
Headers to be included in the request
firstHeaderName
- The name of the first headerfirstHeaderValue
- The value of the first headerheaderNameValuePairs
- Additional headers in name-value pairs.public PactDslRequestWithPath headers(java.util.Map<java.lang.String,java.lang.String> headers)
Headers to be included in the request
headers
- Key-value pairspublic PactDslRequestWithPath query(java.lang.String query)
The query string for the request
query
- query stringpublic PactDslRequestWithPath encodedQuery(java.lang.String query)
The encoded query string for the request
query
- query stringpublic PactDslRequestWithPath body(java.lang.String body)
The body of the request
body
- Request body in string formpublic PactDslRequestWithPath body(java.lang.String body, java.lang.String contentType)
The body of the request
body
- Request body in string formpublic PactDslRequestWithPath body(java.lang.String body, org.apache.http.entity.ContentType contentType)
The body of the request
body
- Request body in string formpublic PactDslRequestWithPath body(java.util.function.Supplier<java.lang.String> body)
The body of the request
body
- Request body in Java Functional Interface Supplier that must return a stringpublic PactDslRequestWithPath body(java.util.function.Supplier<java.lang.String> body, java.lang.String contentType)
The body of the request
body
- Request body in Java Functional Interface Supplier that must return a stringpublic PactDslRequestWithPath body(java.util.function.Supplier<java.lang.String> body, org.apache.http.entity.ContentType contentType)
The body of the request
body
- Request body in Java Functional Interface Supplier that must return a stringpublic PactDslRequestWithPath bodyWithSingleQuotes(java.lang.String body)
The body of the request with possible single quotes as delimiters and using
to convert single quotes to double quotes if required.class QuoteUtil
body
- Request body in string formclass QuoteUtil
public PactDslRequestWithPath bodyWithSingleQuotes(java.lang.String body, java.lang.String contentType)
The body of the request with possible single quotes as delimiters and using
to convert single quotes to double quotes if required.class QuoteUtil
body
- Request body in string formclass QuoteUtil
public PactDslRequestWithPath bodyWithSingleQuotes(java.lang.String body, org.apache.http.entity.ContentType contentType)
The body of the request with possible single quotes as delimiters and using
to convert single quotes to double quotes if required.class QuoteUtil
body
- Request body in string formclass QuoteUtil
public PactDslRequestWithPath body(org.json.JSONObject body)
The body of the request
body
- Request body in JSON formpublic PactDslRequestWithPath body(DslPart body)
The body of the request
body
- Built using the Pact body DSLpublic PactDslRequestWithPath body(org.w3c.dom.Document body)
The body of the request
body
- XML Documentpublic PactDslRequestWithPath body(PactXmlBuilder xmlBuilder)
XML body to return
xmlBuilder
- XML Builder used to construct the XML documentpublic PactDslRequestWithPath path(java.lang.String path)
The path of the request
path
- string pathpublic PactDslRequestWithPath matchPath(java.lang.String pathRegex)
The path of the request. This will generate a random path to use when generating requests
pathRegex
- string path regular expression to match withpublic PactDslRequestWithPath matchPath(java.lang.String pathRegex, java.lang.String path)
The path of the request
path
- string path to use when generating requestspathRegex
- regular expression to use to match pathspublic PactDslRequestWithPath matchHeader(java.lang.String header, java.lang.String regex)
Match a request header. A random example header value will be generated from the provided regular expression.
header
- Header to matchregex
- Regular expression to matchpublic PactDslRequestWithPath matchHeader(java.lang.String header, java.lang.String regex, java.lang.String headerExample)
Match a request header.
header
- Header to matchregex
- Regular expression to matchheaderExample
- Example value to usepublic PactDslResponse willRespondWith()
Define the response to return
public PactDslRequestWithPath matchQuery(java.lang.String parameter, java.lang.String regex)
Match a query parameter with a regex. A random query parameter value will be generated from the regex.
parameter
- Query parameterregex
- Regular expression to match withpublic PactDslRequestWithPath matchQuery(java.lang.String parameter, java.lang.String regex, java.lang.String example)
Match a query parameter with a regex.
parameter
- Query parameterregex
- Regular expression to match withexample
- Example value to use for the query parameter (unencoded)public PactDslRequestWithPath matchQuery(java.lang.String parameter, java.lang.String regex, java.util.List<java.lang.String> example)
Match a repeating query parameter with a regex.
parameter
- Query parameterregex
- Regular expression to match with each elementexample
- Example value list to use for the query parameter (unencoded)public PactDslRequestWithPath withFileUpload(java.lang.String partName, java.lang.String fileName, java.lang.String fileContentType, kotlin.Array[] data)
Sets up a file upload request. This will add the correct content type header to the request
partName
- This is the name of the part in the multipart body.fileName
- This is the name of the file that was uploadedfileContentType
- This is the content type of the uploaded filedata
- This is the actual file contentspublic PactDslRequestWithPath headerFromProviderState(java.lang.String name, java.lang.String expression, java.lang.String example)
Adds a header that will have it's value injected from the provider state
name
- Header Nameexpression
- Expression to be evaluated from the provider stateexample
- Example value to use in the consumer testpublic PactDslRequestWithPath queryParameterFromProviderState(java.lang.String name, java.lang.String expression, java.lang.String example)
Adds a query parameter that will have it's value injected from the provider state
name
- Nameexpression
- Expression to be evaluated from the provider stateexample
- Example value to use in the consumer testpublic PactDslRequestWithPath pathFromProviderState(java.lang.String expression, java.lang.String example)
Sets the path to have it's value injected from the provider state
expression
- Expression to be evaluated from the provider stateexample
- Example value to use in the consumer testpublic PactDslRequestWithPath queryMatchingDate(java.lang.String field, java.lang.String pattern, java.lang.String example)
Matches a date field using the provided date pattern
field
- field namepattern
- pattern to matchexample
- Example valuepublic PactDslRequestWithPath queryMatchingDate(java.lang.String field, java.lang.String pattern)
Matches a date field using the provided date pattern. The current system date will be used for the example value.
field
- field namepattern
- pattern to matchpublic PactDslRequestWithPath queryMatchingTime(java.lang.String field, java.lang.String pattern, java.lang.String example)
Matches a time field using the provided time pattern
field
- field namepattern
- pattern to matchexample
- Example valuepublic PactDslRequestWithPath queryMatchingTime(java.lang.String field, java.lang.String pattern)
Matches a time field using the provided time pattern. The current system time will be used for the example value.
field
- field namepattern
- pattern to matchpublic PactDslRequestWithPath queryMatchingDatetime(java.lang.String field, java.lang.String pattern, java.lang.String example)
Matches a datetime field using the provided pattern
field
- field namepattern
- pattern to matchexample
- Example valuepublic PactDslRequestWithPath queryMatchingDatetime(java.lang.String field, java.lang.String pattern)
Matches a datetime field using the provided pattern. The current system date and time will be used for the example value.
field
- field namepattern
- pattern to matchpublic PactDslRequestWithPath queryMatchingISODate(java.lang.String field, java.lang.String example)
Matches a date field using the ISO date pattern
field
- field nameexample
- Example valuepublic PactDslRequestWithPath queryMatchingISODate(java.lang.String field)
Matches a date field using the ISO date pattern. The current system date will be used for the example value.
field
- field namepublic PactDslRequestWithPath queryMatchingISOTime(java.lang.String field, java.lang.String example)
Matches a time field using the ISO time pattern
field
- field nameexample
- Example valuepublic PactDslRequestWithPath queryMatchingTime(java.lang.String field)
Matches a time field using the ISO time pattern. The current system time will be used for the example value.
field
- field namepublic PactDslRequestWithPath queryMatchingISODatetime(java.lang.String field, java.lang.String example)
Matches a datetime field using the ISO pattern
field
- field nameexample
- Example valuepublic PactDslRequestWithPath queryMatchingISODatetime(java.lang.String field)
Matches a datetime field using the ISO pattern. The current system date and time will be used for the example value.
field
- field name