package contracts
org.springframework.cloud.contract.spec.Contract.make {
request {
method 'POST'
url '/foo'
body(
xyz: 'abc'
)
headers { header('Content-Type', 'application/json;charset=UTF-8') }
}
response {
status 200
body(
bar: $(consumer(regex('some value \u0022with quote\u0022|bar')))
)
headers { header('Content-Type': 'application/json;charset=UTF-8') }
}
}
I'm trying the above regex but I get the double escaping in my ContractVerifierTest.java ... same with regex('some value \"with quote\"|bar')
DocumentContext parsedJson = JsonPath.parse(response.getBody().asString());
assertThatJson(parsedJson).field("bar").matches("some value \\"with quote\\"|bar");
I'm trying the above regex but I get the double escaping in my ContractVerifierTest.java ... same with
regex('some value \"with quote\"|bar')