pact-foundation / pact-stub-server

Standalone pact stub server
MIT License
75 stars 19 forks source link

Stub server adds extra quotes to JSON root value strings even if they already have the extra quotes #8

Closed smckend closed 6 years ago

smckend commented 6 years ago

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 😢

smckend commented 6 years ago

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

uglyog commented 6 years ago

:+1: