Presently, you can upload an image and its content-type is limited to GIF, JPEG, PNG, and that is calculated by the signature of the first few bytes.
We store the raw image and the content-type of the image and we use URLs like this (https://host.com/images/image_1234567890123456789012/download) to download the image.
Now, when downloading an image, you are expected to include an Accept header, and this is limited to either:
image/png
image/gif
image/jpeg
or no Accept header
Anything else is rejected.
The problem is that the caller that wants to download the image needs to know the content-type to include in the download request.
The actual content type is NOT knowledge they would readily have.
Solution
Instead of providing the Accept header, it would be better to just make the download request without any Accept header or use the value of */* for the Accept header.
To do this, we would be better to either:
We already deal with no accept header now, and that works fine.
deal with the Accept: */*
OR, use file extensions on the image URL (such as: https://host.com/images/image_1234567890123456789012.jpeg) that self-identifies the respective image content type, and then we do not need to know the Accept header
Presently, you can upload an image and its content-type is limited to GIF, JPEG, PNG, and that is calculated by the signature of the first few bytes. We store the raw image and the content-type of the image and we use URLs like this (https://host.com/images/image_1234567890123456789012/download) to download the image.
Now, when downloading an image, you are expected to include an
Accept
header, and this is limited to either:image/png
image/gif
image/jpeg
Anything else is rejected. The problem is that the caller that wants to download the image needs to know the content-type to include in the download request.
The actual content type is NOT knowledge they would readily have.
Solution
Instead of providing the
Accept
header, it would be better to just make the download request without anyAccept
header or use the value of*/*
for theAccept
header. To do this, we would be better to either:Accept: */*
https://host.com/images/image_1234567890123456789012.jpeg
) that self-identifies the respective image content type, and then we do not need to know the Accept header