HI Team, there is a usercase in which I want to mo...
# help
s
HI Team, there is a usercase in which I want to mock an api which directly returns a pdf byte stream in response. Is it possible to mock the same?
b
l
There should be no reason why a PDF shouldn't work. I would try the example @Bas Dijkstra pointed you to. The main things you need to be aware of are: • You should set the correct content type in the response • You might need to turn off response templating because that can sometimes get in the way of returning a binary file. I have an example here of returning an image file which should be the same as a PDF other than you will need to set the correct content type for the response: • mapping - https://github.com/leeturner/wiremock-standalone-docker-example/blob/main/wiremock/mappings/return-image.json • file -

https://github.com/leeturner/wiremock-standalone-docker-example/blob/main/wiremock/__files/wiremock.png

• http file to test - https://github.com/leeturner/wiremock-standalone-docker-example/blob/main/tests/return-image.http