The request body should be encoded according to the request header #1012
+49
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently the setupBody() method in the ProviderClient class does not set a contentType. This results in the StringEntity() constructor to use the HTTP.DEF_CONTENT_CHARSET, which in turn resolves to Consts.ISO_8859_1.
This is a problem when you have a UTF-8 encoded pact.json file with special characters. The request that is being sent by the mock consumer, will read the UTF-8 encoded body (from the pact file) as ISO-8859-1, thus messing up any special characters it contains.
I've also got a very basic Spring Boot project set up to show the problem at https://github.com/BenVercammen/pact-jvm-provider-encoding-issue.git
(make sure the pact files are properly encoded, probably will check out in default encoding)
Disclaimer: I'm not familiar with kotlin or groovy...