pact-foundation / pact-js

JS version of Pact. Pact is a contract testing framework for HTTP APIs and non-HTTP asynchronous messaging systems.
https://pact.io
Other
1.58k stars 342 forks source link

Allow using `new ArrayBuffer(0)` in withRequest.body to be honest in the contract tests #1226

Open canny[bot] opened 1 week ago

canny[bot] commented 1 week ago

Our Team Lead proposed exciting things when we tried to cover our API endpoint (.NET language) with a contract test, which required binary content in the request body. But, as Matt Fellows mentioned, we cannot interpret new ArrayBuffer(0) in something at JSON. So, my question is - can we allow engineers to use new ArrayBuffer(0) in withRequest.body, but with interpretation to something like empty JavaScript object ( {} ) or something "magic" actions. In any case, this allowed us to write more honest contract tests, with explicit marks, that we expected to use in the request body - new ArrayBuffer(0) and can verify that in the generated pact specification.

https://pact.canny.io/admin/board/feature-requests/p/allow-using-new-arraybuffer0-in-withrequestbody-to-be-honest-in-the-contract-tes

canny[bot] commented 1 week ago

This issue has been linked to a Canny post: Allow using new ArrayBuffer(0) in withRequest.body to be honest in the contract tests :tada: