4

I am setting up a mock server and would like to have a GET Response containing an image file, I cannot find any information on how to set this up.

The response section of Postman only has - Pretty/Raw/Preview options and no - from-data/binary?

Any hints appreciated!

Kris
  • 322
  • 8
  • 19

1 Answers1

2

You should be able to add the image to a Mock Server example with an <img> tag and add the text/html Content-Type header.

You can either reference the URL or base64 encode the image and use the value within the tag. The base64 value of the image is going to be massive though.

Mock Image

Danny Dainton
  • 23,069
  • 6
  • 67
  • 80
  • Hi Danny, thanks for shedding a light on the matter. I had the same thought initially that I am talking over HTTP and I should be getting and sending out text based messages, however, there is a Postman directory in - `C:\Users\\Postman\files` - where one would store files. So I figured the mock server also have some basic storage capabilities and I do not need to convert the image into base64 value. With that being said, I am processing this endpoint as `Stream` and the stream still has 0 bytes length. Ultimately I would need Postman to host an image file, is this possible? – Kris Dec 19 '19 at 13:06
  • I guess the only way it's going to _host_ it, is if you put that base64 value into a variable, that's synced to your Postman account. The working directory is related to something different, not the mock servers. – Danny Dainton Dec 19 '19 at 13:13
  • escaped ASCII ? http://www.endmemo.com/unicode/ascii.php - No idea :) – Danny Dainton Dec 20 '19 at 10:46