matcher now correctly matches response instead of request 511 (#517)
This commit is contained in:
committed by
Marcin Grzejszczak
parent
bea0d4f78d
commit
833a7114ab
@@ -138,7 +138,7 @@ class PactContractConverter implements ContractConverter<Pact> {
|
||||
Map<String, Map<String, Object>> rules = requestResponseInteraction.response.matchingRules
|
||||
Map<String, Object> fullBodyCheck = rules.get(FULL_BODY)
|
||||
if (fullBodyCheck != null) {
|
||||
JsonPaths jsonPaths = JsonToJsonPathsConverter.transformToJsonPathWithStubsSideValuesAndNoArraySizeCheck(requestResponseInteraction.request?.body?.value)
|
||||
JsonPaths jsonPaths = JsonToJsonPathsConverter.transformToJsonPathWithStubsSideValuesAndNoArraySizeCheck(requestResponseInteraction.response?.body?.value)
|
||||
jsonPaths.each {
|
||||
jsonPath(it.keyBeforeChecking(), byType())
|
||||
}
|
||||
|
||||
@@ -96,8 +96,9 @@ class PactContractConverterSpec extends Specification {
|
||||
headers {
|
||||
contentType(applicationJson())
|
||||
}
|
||||
body(id: 42)
|
||||
body(id: 42, firstName: "Arthur", lastName: "Dent")
|
||||
testMatchers {
|
||||
jsonPath('''$.['id']''', byType())
|
||||
jsonPath('''$.['lastName']''', byType())
|
||||
jsonPath('''$.['firstName']''', byType())
|
||||
}
|
||||
|
||||
@@ -26,7 +26,9 @@
|
||||
"Content-Type": "application/json;charset=UTF-8"
|
||||
},
|
||||
"body": {
|
||||
"id": 42
|
||||
"id": 42,
|
||||
"firstName": "Arthur",
|
||||
"lastName": "Dent"
|
||||
},
|
||||
"matchingRules": {
|
||||
"$.body": {
|
||||
|
||||
Reference in New Issue
Block a user