apiaryio / api-blueprint

API Blueprint
https://apiblueprint.org
MIT License
8.64k stars 2.14k forks source link

How can I send a image binary as a response? #357

Closed wangcansunking closed 4 years ago

wangcansunking commented 7 years ago

As the title saying, how can I send image with the response?

pksunkara commented 7 years ago

AFAIK, there is no current way of doing this.

zdne commented 7 years ago

@wangcansunking you can specify the media type in the response e.g. - Response 200 (img/png) however there si no way to provide an example for binary data in API Blueprint. Hint: you can also specify some metadata (headers) in the example response, these may include Content-Length etc.

Workaround would be to return a response with the link to the binary resource.

zdne commented 7 years ago

Also you can use base64 encoding. Finally, this could be addressed in #20

wangcansunking commented 6 years ago

Now I use redirect as the solution.