-
public class PactDslRequestWithPath extends PactDslRequestBase
-
-
Constructor Summary
Constructors Constructor Description PactDslRequestWithPath(ConsumerPactBuilder consumerPactBuilder, String consumerName, String providerName, List<ProviderState> state, String description, String path, String requestMethod, Map<String, List<String>> requestHeaders, Map<String, List<String>> query, OptionalBody requestBody, MatchingRules requestMatchers, Generators requestGenerators, PactDslRequestWithoutPath defaultRequestValues, PactDslResponse defaultResponseValues)PactDslRequestWithPath(ConsumerPactBuilder consumerPactBuilder, PactDslRequestWithPath existing, String description, PactDslRequestWithoutPath defaultRequestValues, PactDslResponse defaultResponseValues)
-
Method Summary
Modifier and Type Method Description PactDslRequestWithPathmethod(String method)The HTTP method for the request PactDslRequestWithPathheaders(String firstHeaderName, String firstHeaderValue, Array<String> headerNameValuePairs)Headers to be included in the request PactDslRequestWithPathheaders(Map<String, String> headers)Headers to be included in the request PactDslRequestWithPathquery(String query)The query string for the request PactDslRequestWithPathencodedQuery(String query)The encoded query string for the request PactDslRequestWithPathbody(String body)The body of the request PactDslRequestWithPathbody(String body, String contentType)The body of the request PactDslRequestWithPathbody(String body, ContentType contentType)The body of the request PactDslRequestWithPathbody(Supplier<String> body)The body of the request PactDslRequestWithPathbody(Supplier<String> body, String contentType)The body of the request PactDslRequestWithPathbody(Supplier<String> body, ContentType contentType)The body of the request PactDslRequestWithPathbodyWithSingleQuotes(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. PactDslRequestWithPathbodyWithSingleQuotes(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. PactDslRequestWithPathbodyWithSingleQuotes(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. PactDslRequestWithPathbody(JSONObject body)The body of the request PactDslRequestWithPathbody(DslPart body)The body of the request PactDslRequestWithPathbody(Document body)The body of the request PactDslRequestWithPathbody(PactXmlBuilder xmlBuilder)XML body to return PactDslRequestWithPathpath(String path)The path of the request PactDslRequestWithPathmatchPath(String pathRegex)The path of the request. PactDslRequestWithPathmatchPath(String pathRegex, String path)The path of the request PactDslRequestWithPathmatchHeader(String header, String regex)Match a request header. PactDslRequestWithPathmatchHeader(String header, String regex, String headerExample)Match a request header. PactDslResponsewillRespondWith()Define the response to return PactDslRequestWithPathmatchQuery(String parameter, String regex)Match a query parameter with a regex. PactDslRequestWithPathmatchQuery(String parameter, String regex, String example)Match a query parameter with a regex. PactDslRequestWithPathmatchQuery(String parameter, String regex, List<String> example)Match a repeating query parameter with a regex. PactDslRequestWithPathwithFileUpload(String partName, String fileName, String fileContentType, Array<byte> data)Sets up a file upload request. PactDslRequestWithPathheaderFromProviderState(String name, String expression, String example)Adds a header that will have it's value injected from the provider state PactDslRequestWithPathqueryParameterFromProviderState(String name, String expression, String example)Adds a query parameter that will have it's value injected from the provider state PactDslRequestWithPathpathFromProviderState(String expression, String example)Sets the path to have it's value injected from the provider state PactDslRequestWithPathqueryMatchingDate(String field, String pattern, String example)Matches a date field using the provided date pattern PactDslRequestWithPathqueryMatchingDate(String field, String pattern)Matches a date field using the provided date pattern. PactDslRequestWithPathqueryMatchingTime(String field, String pattern, String example)Matches a time field using the provided time pattern PactDslRequestWithPathqueryMatchingTime(String field, String pattern)Matches a time field using the provided time pattern. PactDslRequestWithPathqueryMatchingDatetime(String field, String pattern, String example)Matches a datetime field using the provided pattern PactDslRequestWithPathqueryMatchingDatetime(String field, String pattern)Matches a datetime field using the provided pattern. PactDslRequestWithPathqueryMatchingISODate(String field, String example)Matches a date field using the ISO date pattern PactDslRequestWithPathqueryMatchingISODate(String field)Matches a date field using the ISO date pattern. PactDslRequestWithPathqueryMatchingISOTime(String field, String example)Matches a time field using the ISO time pattern PactDslRequestWithPathqueryMatchingTime(String field)Matches a time field using the ISO time pattern. PactDslRequestWithPathqueryMatchingISODatetime(String field, String example)Matches a datetime field using the ISO pattern PactDslRequestWithPathqueryMatchingISODatetime(String field)Matches a datetime field using the ISO pattern. PactDslRequestWithPathbody(BodyBuilder builder)Sets the body using the buidler -
-
Constructor Detail
-
PactDslRequestWithPath
PactDslRequestWithPath(ConsumerPactBuilder consumerPactBuilder, String consumerName, String providerName, List<ProviderState> state, String description, String path, String requestMethod, Map<String, List<String>> requestHeaders, Map<String, List<String>> query, OptionalBody requestBody, MatchingRules requestMatchers, Generators requestGenerators, PactDslRequestWithoutPath defaultRequestValues, PactDslResponse defaultResponseValues)
-
PactDslRequestWithPath
PactDslRequestWithPath(ConsumerPactBuilder consumerPactBuilder, PactDslRequestWithPath existing, String description, PactDslRequestWithoutPath defaultRequestValues, PactDslResponse defaultResponseValues)
-
-
Method Detail
-
method
PactDslRequestWithPath method(String method)
The HTTP method for the request
- Parameters:
method- Valid HTTP method
-
headers
PactDslRequestWithPath headers(String firstHeaderName, String firstHeaderValue, Array<String> headerNameValuePairs)
Headers to be included in the request
- Parameters:
firstHeaderName- The name of the first headerfirstHeaderValue- The value of the first headerheaderNameValuePairs- Additional headers in name-value pairs.
-
headers
PactDslRequestWithPath headers(Map<String, String> headers)
Headers to be included in the request
- Parameters:
headers- Key-value pairs
-
query
PactDslRequestWithPath query(String query)
The query string for the request
- Parameters:
query- query string
-
encodedQuery
PactDslRequestWithPath encodedQuery(String query)
The encoded query string for the request
- Parameters:
query- query string
-
body
PactDslRequestWithPath body(String body)
The body of the request
- Parameters:
body- Request body in string form
-
body
PactDslRequestWithPath body(String body, String contentType)
The body of the request
- Parameters:
body- Request body in string form
-
body
PactDslRequestWithPath body(String body, ContentType contentType)
The body of the request
- Parameters:
body- Request body in string form
-
body
PactDslRequestWithPath body(Supplier<String> body)
The body of the request
- Parameters:
body- Request body in Java Functional Interface Supplier that must return a string
-
body
PactDslRequestWithPath body(Supplier<String> body, String contentType)
The body of the request
- Parameters:
body- Request body in Java Functional Interface Supplier that must return a string
-
body
PactDslRequestWithPath body(Supplier<String> body, ContentType contentType)
The body of the request
- Parameters:
body- Request body in Java Functional Interface Supplier that must return a string
-
bodyWithSingleQuotes
PactDslRequestWithPath 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
PactDslRequestWithPath 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
-
bodyWithSingleQuotes
PactDslRequestWithPath 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
-
body
PactDslRequestWithPath body(JSONObject body)
The body of the request
- Parameters:
body- Request body in JSON form
-
body
PactDslRequestWithPath body(DslPart body)
The body of the request
- Parameters:
body- Built using the Pact body DSL
-
body
PactDslRequestWithPath body(Document body)
The body of the request
- Parameters:
body- XML Document
-
body
PactDslRequestWithPath body(PactXmlBuilder xmlBuilder)
XML body to return
- Parameters:
xmlBuilder- XML Builder used to construct the XML document
-
path
PactDslRequestWithPath path(String path)
The path of the request
- Parameters:
path- string path
-
matchPath
PactDslRequestWithPath matchPath(String pathRegex)
The path of the request. This will generate a random path to use when generating requests
- Parameters:
pathRegex- string path regular expression to match with
-
matchPath
PactDslRequestWithPath matchPath(String pathRegex, String path)
The path of the request
- Parameters:
pathRegex- regular expression to use to match pathspath- string path to use when generating requests
-
matchHeader
PactDslRequestWithPath matchHeader(String header, String regex)
Match a request header. A random example header value will be generated from the provided regular expression.
- Parameters:
header- Header to matchregex- Regular expression to match
-
matchHeader
PactDslRequestWithPath matchHeader(String header, String regex, String headerExample)
Match a request header.
- Parameters:
header- Header to matchregex- Regular expression to matchheaderExample- Example value to use
-
willRespondWith
PactDslResponse willRespondWith()
Define the response to return
-
matchQuery
PactDslRequestWithPath matchQuery(String parameter, String regex)
Match a query parameter with a regex. A random query parameter value will be generated from the regex.
- Parameters:
parameter- Query parameterregex- Regular expression to match with
-
matchQuery
PactDslRequestWithPath matchQuery(String parameter, String regex, String example)
Match a query parameter with a regex.
- Parameters:
parameter- Query parameterregex- Regular expression to match withexample- Example value to use for the query parameter (unencoded)
-
matchQuery
PactDslRequestWithPath matchQuery(String parameter, String regex, List<String> example)
Match a repeating query parameter with a regex.
- Parameters:
parameter- Query parameterregex- Regular expression to match with each elementexample- Example value list to use for the query parameter (unencoded)
-
withFileUpload
PactDslRequestWithPath withFileUpload(String partName, String fileName, String fileContentType, Array<byte> data)
Sets up a file upload request. This will add the correct content type header to the request
- Parameters:
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 contents
-
headerFromProviderState
PactDslRequestWithPath headerFromProviderState(String name, String expression, String example)
Adds a header that will have it's value injected from the provider state
- Parameters:
name- Header Nameexpression- Expression to be evaluated from the provider stateexample- Example value to use in the consumer test
-
queryParameterFromProviderState
PactDslRequestWithPath queryParameterFromProviderState(String name, String expression, String example)
Adds a query parameter that will have it's value injected from the provider state
- Parameters:
name- Nameexpression- Expression to be evaluated from the provider stateexample- Example value to use in the consumer test
-
pathFromProviderState
PactDslRequestWithPath pathFromProviderState(String expression, String example)
Sets the path to have it's value injected from the provider state
- Parameters:
expression- Expression to be evaluated from the provider stateexample- Example value to use in the consumer test
-
queryMatchingDate
PactDslRequestWithPath queryMatchingDate(String field, String pattern, String example)
Matches a date field using the provided date pattern
- Parameters:
field- field namepattern- pattern to matchexample- Example value
-
queryMatchingDate
PactDslRequestWithPath queryMatchingDate(String field, String pattern)
Matches a date field using the provided date pattern. The current system date will be used for the example value.
- Parameters:
field- field namepattern- pattern to match
-
queryMatchingTime
PactDslRequestWithPath queryMatchingTime(String field, String pattern, String example)
Matches a time field using the provided time pattern
- Parameters:
field- field namepattern- pattern to matchexample- Example value
-
queryMatchingTime
PactDslRequestWithPath queryMatchingTime(String field, String pattern)
Matches a time field using the provided time pattern. The current system time will be used for the example value.
- Parameters:
field- field namepattern- pattern to match
-
queryMatchingDatetime
PactDslRequestWithPath queryMatchingDatetime(String field, String pattern, String example)
Matches a datetime field using the provided pattern
- Parameters:
field- field namepattern- pattern to matchexample- Example value
-
queryMatchingDatetime
PactDslRequestWithPath queryMatchingDatetime(String field, String pattern)
Matches a datetime field using the provided pattern. The current system date and time will be used for the example value.
- Parameters:
field- field namepattern- pattern to match
-
queryMatchingISODate
PactDslRequestWithPath queryMatchingISODate(String field, String example)
Matches a date field using the ISO date pattern
- Parameters:
field- field nameexample- Example value
-
queryMatchingISODate
PactDslRequestWithPath queryMatchingISODate(String field)
Matches a date field using the ISO date pattern. The current system date will be used for the example value.
- Parameters:
field- field name
-
queryMatchingISOTime
PactDslRequestWithPath queryMatchingISOTime(String field, String example)
Matches a time field using the ISO time pattern
- Parameters:
field- field nameexample- Example value
-
queryMatchingTime
PactDslRequestWithPath queryMatchingTime(String field)
Matches a time field using the ISO time pattern. The current system time will be used for the example value.
- Parameters:
field- field name
-
queryMatchingISODatetime
PactDslRequestWithPath queryMatchingISODatetime(String field, String example)
Matches a datetime field using the ISO pattern
- Parameters:
field- field nameexample- Example value
-
queryMatchingISODatetime
PactDslRequestWithPath queryMatchingISODatetime(String field)
Matches a datetime field using the ISO pattern. The current system date and time will be used for the example value.
- Parameters:
field- field name
-
body
PactDslRequestWithPath body(BodyBuilder builder)
Sets the body using the buidler
- Parameters:
builder- Body Builder
-
-
-
-