I've found that the pact-stub-server tries to correct invalid JSON root value strings by adding extra quotes but unfortunately it also does this for those which are valid.
I have a consumer test which uses the PactDslJsonRootValue.stringType() as it's response body so the value already has extra quotes added to the pact file. When the stub-server picks up the pact and receives a matching request, the response adds a 2nd set of quotes to the JSON root value when it shouldn't.
Would it be possible to only add the extra quotes when the JsonRootValue is invalid (doesn't contain the require extra quotes)? I'm going to have a look into if something like this is possible but my rust isn't the best!
The real solution is probably to use proper JSON key pairs or have a content type as plain/text but for now that is out of the question 😢
After a quick investigation I realised that this is a problem with the pact_matching library rather than the stub-server itself. I'll move this issue to the pact_matching repo
I've found that the pact-stub-server tries to correct invalid JSON root value strings by adding extra quotes but unfortunately it also does this for those which are valid.
I have a consumer test which uses the PactDslJsonRootValue.stringType() as it's response body so the value already has extra quotes added to the pact file. When the stub-server picks up the pact and receives a matching request, the response adds a 2nd set of quotes to the JSON root value when it shouldn't.
Would it be possible to only add the extra quotes when the JsonRootValue is invalid (doesn't contain the require extra quotes)? I'm going to have a look into if something like this is possible but my rust isn't the best!
The real solution is probably to use proper JSON key pairs or have a content type as plain/text but for now that is out of the question 😢