#1112 Content type is overridden to application/json for message providers
Issue created by
matdodgson
Software versions
•
OS: Ubuntu 22.04
•
Consumer Pact library: Pact JS 9.18.1
•
Provider Pact library: Pact JS 12.1.0
•
Node Version: 18.17.0
Issue Checklist
Please confirm the following:
☑︎ I have upgraded to the latest
☑︎ I have the read the FAQs in the Readme
☑︎ I have triple checked, that there are
no unhandled promises in my code and have
read the section on intermittent test failures
Expected behaviour
That I can return an XML string from a message provider and be able to verify a pact from a message consumer that is also based on an XML string.
Actual behaviour
The content type on the provider is overridden to application/json so the verification always fails. See here:
pact-js/src/messageProviderPact.ts
Line 153 in </pact-foundation/pact-js/commit/ce5973cd6864e7b85c44468553ea6f94e8e34d3f|ce5973c>
Additionally, from first glance it appears that MessageProviderPact assumes that message providers only return JSON. See here:
pact-js/src/messageProviderPact.ts
Line 123 in </pact-foundation/pact-js/commit/ce5973cd6864e7b85c44468553ea6f94e8e34d3f|ce5973c>
Steps to reproduce
• Create a consumer message contract where the content is XML (ie. not JSON).
• Create a message provider that returns an XML string
• Verify the message contract
pact-foundation/pact-js