-
- All Implemented Interfaces:
public class PactDslRequestWithoutPath extends PactDslRequestBase
-
-
Field Summary
Fields Modifier and Type Field Description public String
requestMethod
public Map<String, List<String>>
requestHeaders
public Map<String, List<String>>
query
public OptionalBody
requestBody
public MatchingRules
requestMatchers
public Generators
requestGenerators
private MultipartEntityBuilder
multipartBuilder
private List<String>
comments
private PactSpecVersion
version
-
Constructor Summary
Constructors Constructor Description PactDslRequestWithoutPath(ConsumerPactBuilder consumerPactBuilder, PactDslWithState pactDslWithState, String description, PactDslRequestWithoutPath defaultRequestValues, PactDslResponse defaultResponseValues, PactSpecVersion version, Map<String, JsonValue> additionalMetadata)
PactDslRequestWithoutPath(ConsumerPactBuilder consumerPactBuilder, PactDslWithState pactDslWithState, String description, PactDslRequestWithoutPath defaultRequestValues, PactDslResponse defaultResponseValues, Map<String, JsonValue> additionalMetadata)
-
Method Summary
Modifier and Type Method Description final MultipartEntityBuilder
getMultipartBuilder()
final Unit
setMultipartBuilder(MultipartEntityBuilder multipartBuilder)
final List<String>
getComments()
final Unit
setComments(List<String> comments)
final PactSpecVersion
getVersion()
final Unit
setVersion(PactSpecVersion version)
final PactDslRequestWithoutPath
method(String method)
The HTTP method for the request final PactDslRequestWithoutPath
headers(Map<String, String> headers)
Headers to be included in the request final PactDslRequestWithoutPath
headers(String firstHeaderName, String firstHeaderValue, String headerNameValuePairs)
Headers to be included in the request final PactDslRequestWithoutPath
query(String query)
The query string for the request final PactDslRequestWithoutPath
body(String body)
The body of the request final PactDslRequestWithoutPath
body(String body, String contentType)
The body of the request final PactDslRequestWithoutPath
body(String body, ContentType contentType)
The body of the request final PactDslRequestWithoutPath
body(Supplier<String> body)
The body of the request final PactDslRequestWithoutPath
body(Supplier<String> body, String contentType)
The body of the request final PactDslRequestWithoutPath
body(Supplier<String> body, ContentType contentType)
The body of the request final PactDslRequestWithoutPath
body(JSONObject body)
The body of the request final PactDslRequestWithoutPath
body(DslPart body)
The body of the request final PactDslRequestWithoutPath
body(Document body)
The body of the request final PactDslRequestWithoutPath
body(PactXmlBuilder xmlBuilder)
XML Response body to return PactDslRequestWithoutPath
body(MultipartEntityBuilder body)
The body of the request final PactDslRequestWithoutPath
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. final PactDslRequestWithoutPath
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. final PactDslRequestWithoutPath
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. PactDslRequestWithoutPath
bodyMatchingContentType(String contentType, String exampleContents)
Sets up a content type matcher to match any body of the given content type final PactDslRequestWithPath
path(String path)
The path of the request final PactDslRequestWithPath
path(String path, Function1<PactDslRequestWithPath, PactDslRequestWithPath> addRequestMatchers)
Variant of PactDslRequestWithPath.path that introduces a Lambda DSL syntax to better visually separate request and response in a pact. final PactDslRequestWithPath
matchPath(String pathRegex, String path)
The path of the request. final PactDslRequestWithPath
matchPath(String pathRegex)
The path of the request. final PactDslRequestWithPath
matchPath(String pathRegex, String path, Function1<PactDslRequestWithPath, PactDslRequestWithPath> addRequestMatchers)
Variant of PactDslRequestWithoutPath.matchPath that introduces a Lambda DSL syntax to better visually separate request and response in a pact. final PactDslRequestWithPath
matchPath(String pathRegex, Function1<PactDslRequestWithPath, PactDslRequestWithPath> addRequestMatchers)
Variant of PactDslRequestWithoutPath.matchPath that introduces a Lambda DSL syntax to better visually separate request and response in a pact. final PactDslRequestWithoutPath
withFileUpload(String partName, String fileName, String fileContentType, ByteArray data)
Sets up a file upload request. final PactDslRequestWithoutPath
headerFromProviderState(String name, String expression, String example)
Adds a header that will have it's value injected from the provider state final PactDslRequestWithoutPath
queryParameterFromProviderState(String name, String expression, String example)
Adds a query parameter that will have it's value injected from the provider state final PactDslRequestWithPath
pathFromProviderState(String expression, String example)
Sets the path to have it's value injected from the provider state final PactDslRequestWithPath
pathFromProviderState(String expression, String example, Function1<PactDslRequestWithPath, PactDslRequestWithPath> addRequestMatchers)
Variant of PactDslRequestWithoutPath.pathFromProviderState that introduces a Lambda DSL syntax to better visually separate request and response in a pact. final PactDslRequestWithoutPath
queryMatchingDate(String field, String pattern, String example)
Matches a date field using the provided date pattern final PactDslRequestWithoutPath
queryMatchingDate(String field, String pattern)
Matches a date field using the provided date pattern. final PactDslRequestWithoutPath
queryMatchingTime(String field, String pattern, String example)
Matches a time field using the provided time pattern final PactDslRequestWithoutPath
queryMatchingTime(String field, String pattern)
Matches a time field using the provided time pattern. final PactDslRequestWithoutPath
queryMatchingTime(String field)
Matches a time field using the ISO time pattern. final PactDslRequestWithoutPath
queryMatchingDatetime(String field, String pattern, String example)
Matches a datetime field using the provided pattern final PactDslRequestWithoutPath
queryMatchingDatetime(String field, String pattern)
Matches a datetime field using the provided pattern. final PactDslRequestWithoutPath
queryMatchingISODate(String field, String example)
Matches a date field using the ISO date pattern. final PactDslRequestWithoutPath
queryMatchingISODate(String field)
Matches a date field using the ISO date pattern. final PactDslRequestWithoutPath
queryMatchingISOTime(String field, String example)
Matches a time field using the ISO time pattern final PactDslRequestWithoutPath
queryMatchingISODatetime(String field, String example)
Matches a datetime field using the ISO pattern. final PactDslRequestWithoutPath
queryMatchingISODatetime(String field)
Matches a datetime field using the ISO pattern. final PactDslRequestWithoutPath
addMetadataValue(String key, String value)
Adds additional values to the metadata section of the Pact file final PactDslRequestWithoutPath
addMetadataValue(String key, JsonValue value)
Adds additional values to the metadata section of the Pact file -
-
Constructor Detail
-
PactDslRequestWithoutPath
PactDslRequestWithoutPath(ConsumerPactBuilder consumerPactBuilder, PactDslWithState pactDslWithState, String description, PactDslRequestWithoutPath defaultRequestValues, PactDslResponse defaultResponseValues, PactSpecVersion version, Map<String, JsonValue> additionalMetadata)
-
PactDslRequestWithoutPath
PactDslRequestWithoutPath(ConsumerPactBuilder consumerPactBuilder, PactDslWithState pactDslWithState, String description, PactDslRequestWithoutPath defaultRequestValues, PactDslResponse defaultResponseValues, Map<String, JsonValue> additionalMetadata)
-
-
Method Detail
-
getMultipartBuilder
final MultipartEntityBuilder getMultipartBuilder()
-
setMultipartBuilder
final Unit setMultipartBuilder(MultipartEntityBuilder multipartBuilder)
-
getComments
final List<String> getComments()
-
setComments
final Unit setComments(List<String> comments)
-
getVersion
final PactSpecVersion getVersion()
-
setVersion
final Unit setVersion(PactSpecVersion version)
-
method
final PactDslRequestWithoutPath method(String method)
The HTTP method for the request
- Parameters:
method
- Valid HTTP method
-
headers
final PactDslRequestWithoutPath headers(Map<String, String> headers)
Headers to be included in the request
- Parameters:
headers
- Key-value pairs
-
headers
final PactDslRequestWithoutPath headers(String firstHeaderName, String firstHeaderValue, 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.
-
query
final PactDslRequestWithoutPath query(String query)
The query string for the request
- Parameters:
query
- query string
-
body
final PactDslRequestWithoutPath body(String body)
The body of the request
- Parameters:
body
- Request body in string form
-
body
final PactDslRequestWithoutPath body(String body, String contentType)
The body of the request
- Parameters:
body
- Request body in string form
-
body
final PactDslRequestWithoutPath body(String body, ContentType contentType)
The body of the request
- Parameters:
body
- Request body in string form
-
body
final PactDslRequestWithoutPath body(Supplier<String> body)
The body of the request
- Parameters:
body
- Request body in Java Functional Interface Supplier that must return a string
-
body
final PactDslRequestWithoutPath 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
final PactDslRequestWithoutPath 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
-
body
final PactDslRequestWithoutPath body(JSONObject body)
The body of the request
- Parameters:
body
- Request body in JSON form
-
body
final PactDslRequestWithoutPath body(DslPart body)
The body of the request
- Parameters:
body
- Built using the Pact body DSL
-
body
final PactDslRequestWithoutPath body(Document body)
The body of the request
- Parameters:
body
- XML Document
-
body
final PactDslRequestWithoutPath body(PactXmlBuilder xmlBuilder)
XML Response body to return
- Parameters:
xmlBuilder
- XML Builder used to construct the XML document
-
body
PactDslRequestWithoutPath body(MultipartEntityBuilder body)
The body of the request
- Parameters:
body
- Built using MultipartEntityBuilder
-
bodyWithSingleQuotes
final PactDslRequestWithoutPath 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
final PactDslRequestWithoutPath 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
final PactDslRequestWithoutPath 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
-
bodyMatchingContentType
PactDslRequestWithoutPath bodyMatchingContentType(String contentType, String exampleContents)
Sets up a content type matcher to match any body of the given content type
-
path
final PactDslRequestWithPath path(String path)
The path of the request
- Parameters:
path
- string path
-
path
final PactDslRequestWithPath path(String path, Function1<PactDslRequestWithPath, PactDslRequestWithPath> addRequestMatchers)
Variant of PactDslRequestWithPath.path that introduces a Lambda DSL syntax to better visually separate request and response in a pact.
-
matchPath
@JvmOverloads() final PactDslRequestWithPath matchPath(String pathRegex, String path)
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
@JvmOverloads() final 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
@JvmOverloads() final PactDslRequestWithPath matchPath(String pathRegex, String path, Function1<PactDslRequestWithPath, PactDslRequestWithPath> addRequestMatchers)
Variant of PactDslRequestWithoutPath.matchPath that introduces a Lambda DSL syntax to better visually separate request and response in a pact.
-
matchPath
@JvmOverloads() final PactDslRequestWithPath matchPath(String pathRegex, Function1<PactDslRequestWithPath, PactDslRequestWithPath> addRequestMatchers)
Variant of PactDslRequestWithoutPath.matchPath that introduces a Lambda DSL syntax to better visually separate request and response in a pact.
-
withFileUpload
final PactDslRequestWithoutPath withFileUpload(String partName, String fileName, String fileContentType, ByteArray 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
final PactDslRequestWithoutPath 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
final PactDslRequestWithoutPath 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
final 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
-
pathFromProviderState
final PactDslRequestWithPath pathFromProviderState(String expression, String example, Function1<PactDslRequestWithPath, PactDslRequestWithPath> addRequestMatchers)
Variant of PactDslRequestWithoutPath.pathFromProviderState that introduces a Lambda DSL syntax to better visually separate request and response in a pact.
-
queryMatchingDate
final PactDslRequestWithoutPath 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
final PactDslRequestWithoutPath 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
final PactDslRequestWithoutPath 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
final PactDslRequestWithoutPath 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
-
queryMatchingTime
final PactDslRequestWithoutPath 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
-
queryMatchingDatetime
final PactDslRequestWithoutPath 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
final PactDslRequestWithoutPath 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
@JvmOverloads() final PactDslRequestWithoutPath queryMatchingISODate(String field, String example)
Matches a date field using the ISO date pattern. The current system date will be used for the example value if not provided.
- Parameters:
field
- field nameexample
- Example value
-
queryMatchingISODate
@JvmOverloads() final PactDslRequestWithoutPath queryMatchingISODate(String field)
Matches a date field using the ISO date pattern. The current system date will be used for the example value if not provided.
- Parameters:
field
- field name
-
queryMatchingISOTime
final PactDslRequestWithoutPath queryMatchingISOTime(String field, String example)
Matches a time field using the ISO time pattern
- Parameters:
field
- field nameexample
- Example value
-
queryMatchingISODatetime
@JvmOverloads() final PactDslRequestWithoutPath queryMatchingISODatetime(String field, String example)
Matches a datetime field using the ISO pattern. The current system date and time will be used for the example value if not provided.
- Parameters:
field
- field nameexample
- Example value
-
queryMatchingISODatetime
@JvmOverloads() final PactDslRequestWithoutPath queryMatchingISODatetime(String field)
Matches a datetime field using the ISO pattern. The current system date and time will be used for the example value if not provided.
- Parameters:
field
- field name
-
addMetadataValue
final PactDslRequestWithoutPath addMetadataValue(String key, String value)
Adds additional values to the metadata section of the Pact file
-
addMetadataValue
final PactDslRequestWithoutPath addMetadataValue(String key, JsonValue value)
Adds additional values to the metadata section of the Pact file
-
-
-
-