Hi All, I have an get API which responds with zip ...
# general
s
Hi All, I have an get API which responds with zip file, so in the pact method I set the expected response header to be 'application/zip'. I want to know if I can do more than just validating response header? Meaning can I set specific expectation to return a zip file? like .binaryType() or .binaryBody(). Do we have anything like this? Basically I want to do just more than setting response header expectation. Any suggestion would be helpful.
y
assuming you are using pact-js (there are language specific channels) there is a method
withRequestBinaryFile
there is an example here https://github.com/pact-foundation/pact-js/blob/a5c5ee12bb534f20ce57879789b127d75cdcf656/examples/v3/todo-consumer/test/consumer.spec.js#L152
albeit for an image
there are methods for binary payloads on the response side too
s
Hi, thank you for responding. I am using Java actually. Can you point me to any example for adding binary payload on response side ? If you are aware. Looking for adding expectation of binary data on response side. Thanks