Sending a bunch of binary back to the user like an image:
interface API
{
@path("/data/image")
@contentType("image/png")
ubyte[] getImagePreview(string foo);
}
The function is returning a Json array with the values of the ubyte[]
Here are the list of attributes I can use:
adjustMethodStyle
bodyParam
contentType
extractHTTPMethodAndName
headerParam
method
noRoute
path
queryParam
rootPathFromName
Source: Vibe.d site
The only attribute that can do the job is contentType and it's said there that it only works with ubyte[] functions, and that's what I used.
What am I missing?
You can try hunt framework so easy use:
More read wiki: https://github.com/huntlabs/hunt-framework/wiki/FileResponse