pact-jvm icon indicating copy to clipboard operation
pact-jvm copied to clipboard

plain text request body not matching?

Open yekster opened this issue 7 years ago • 1 comments

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

yekster avatar May 24 '17 01:05 yekster