Merge branch 'master' into 2.0.x
This commit is contained in:
@@ -536,6 +536,31 @@ proper values. Additionally, it registers two helper functions:
|
||||
* `escapejsonbody`: Escapes the request body in a format that can be embedded in a JSON.
|
||||
* `jsonpath`: For a given parameter, find an object in the request body.
|
||||
|
||||
==== Registering Your Own WireMock Extension
|
||||
|
||||
WireMock lets you register custom extensions. By default, Spring Cloud Contract registers
|
||||
the transformer, which lets you reference a request from a response. If you want to
|
||||
provide your own extensions, you can register an implementation of the
|
||||
`org.springframework.cloud.contract.verifier.dsl.wiremock.WireMockExtensions` interface.
|
||||
Since we use the spring.factories extension approach, you can create an entry in
|
||||
`META-INF/spring.factories` file similar to the following:
|
||||
|
||||
[source,groovy,indent=0]
|
||||
----
|
||||
include::{stubrunner_core_path}/src/test/resources/META-INF/spring.factories[indent=0]
|
||||
----
|
||||
|
||||
The following is an example of a custom extension:
|
||||
|
||||
.TestWireMockExtensions.groovy
|
||||
[source,groovy,indent=0]
|
||||
----
|
||||
include::{stubrunner_core_path}/src/test/groovy/org/springframework/cloud/contract/verifier/dsl/wiremock/TestWireMockExtensions.groovy[indent=0]
|
||||
----
|
||||
|
||||
IMPORTANT: Remember to override the `applyGlobally()` method and set it to `false` if you
|
||||
want the transformation to be applied only for a mapping that explicitly requires it.
|
||||
|
||||
==== Dynamic Properties in the Matchers Sections
|
||||
|
||||
If you work with https://docs.pact.io/[Pact], the following discussion may seem familiar.
|
||||
|
||||
Reference in New Issue
Block a user