pact-jvm
pact-jvm copied to clipboard
plain text request body not matching?
Sorry for the noob question, but I can't seem to get plain text request body to match the result. Changing to json works fine, so I'm not sure what I'm doing wrong. :(
service {
given('scenario for adding random plain text')
uponReceiving('random text')
withAttributes(
method: 'post',
path: '/random',
headers: headers,
body: regexp(~/\w+/,"randomText"))
willRespondWith(status: 200)
}
PactVerificationResult result = service.runTest { mockServer ->
def client = new RESTClient(mockServer.url)
def auth_response = client.post(
path: '/random',
headers : headers,
body: "randomText")
assert auth_response.status == 200
}
assert result == PactVerificationResult.Ok.INSTANCE