Open andreas-sundstrom opened 11 months ago
Thanks for this.
Unfortunately, matching rules only work on JSON (and XML) content types - not on plain text (or other content types).
So it's a bug of sorts that we allow you to put a matching rule in there or that we serialise the matching rule as plain text.
If you remove the matcher, I expect it to work (however the provider side would need to match on exact values).
Thanks for the answer @mefellows , that does indeed work and it's the way we solved it. Is this specific to the V3 matchers or has this always been the case?
Software versions
Please provide at least OS and version of pact-js
18.16.1
Issue Checklist
Please confirm the following:
Expected behaviour
Testing an api-client for an endpoint that returns a string I create a pact provider that responds with a body and an exact content-type. The matching should only ensure it's a string body, but the content-type header must be exact match:
I expect something like:
Actual behaviour
When providing a content-type header, the actual matcher is serialized to a json-string:
When not providing a content-type header the body is correct but the header is incorrect:
Steps to reproduce
Generated pact-file (stub):
If removing the header in the response the body matching rule is correct but content-type is wrong:
Relevant log files
Please ensure you set logging to
DEBUG
and attach any relevant log files here (or link to a gist).