Have the following code. Content Type should be image/gif
but is returning application/octet-stream
. Is there a way to override the application/octet-stream
?
If I’m reading Service Return Types correctly, byte[]
are not converted to a different content type?
Note: In another service it’ll need to return image/webp
so also need to be not limited to only image/gif
public class MyService : Service
{
// https://stackoverflow.com/questions/2570633/smallest-filesize-for-transparent-single-pixel-image
private static readonly byte[] TransparentGif =
{
0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x21, 0xF9, 0x04,
0x01, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02
};
[AddHeader(ContentType="image/gif")]
public byte[] Any(TransGif request)
{
return TransparentGif;
}
}