You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to create a PACT consumer test for a provider that returns a simple String as it's response body with a Content-Type of application/json. I am declaring my PACT fragment as follows:
Map<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/json");
builder
.uponReceiving("a request for a simple string")
.path("/provider/uri")
.method("GET")
.willRespondWith()
.status(STATUS_OK)
.headers(headers)
.body(PactDslJsonRootValue.stringType())
.toFragment();
However, when I run this junit consumer test (as a consumer) I receive the following error:
groovy.json.JsonException: false not parsed properly
The current character read is 'f' with an int value of 102
false not parsed properly
line number 1
index number 1
fMqERmSJkswiAwHKYlbV
.^
If I change the Content-Type to text/plain the unit test will run and the PACT contract will be created, however it will obviously fail when run against our provider. I have also tried creating the fragment using a String literal as the body (rather than the type matcher) with the same result.
Is this a bug or is there another way to test this type of provider?
Thanks in advance!
Dave
The text was updated successfully, but these errors were encountered:
I'm trying to create a PACT consumer test for a provider that returns a simple String as it's response body with a Content-Type of application/json. I am declaring my PACT fragment as follows:
However, when I run this junit consumer test (as a consumer) I receive the following error:
If I change the Content-Type to text/plain the unit test will run and the PACT contract will be created, however it will obviously fail when run against our provider. I have also tried creating the fragment using a String literal as the body (rather than the type matcher) with the same result.
Is this a bug or is there another way to test this type of provider?
Thanks in advance!
Dave
The text was updated successfully, but these errors were encountered: