And you solved your problem well, I never tried it like that myself ;-)I would not write it differently.Like the comment says, it will only work with those types recognised by ImageReadWriter, which are the most common ones, JPG, GIF and PNG.Image/* is a wildcard matching any image type, and there are many, many more. The current mechanism in Zinc with #accept: and #enforceAcceptContentType: true assumes a singular 'Accept' header. But indeed, technically, it is possible to specify more than one.For example, this also works:ZnClient new url: 'http://pharo.org/files/pharo.png'; headerAt: 'Accept' add: ZnMimeType imageGif asString; headerAt: 'Accept' add: ZnMimeType imagePng asString; headerAt: 'Accept' add: ZnMimeType imageJpeg asString; contentReader: [ :entity | ImageReadWriter formFromStream: entity readStream ]; get.
Ah this would be better for me because like that I can probably control which exception is raised.
Because we do not support image/svg
But I have to think a bit about this issue.Another approach is to use the extension of the URL.ZnMimeType forFilenameExtension: 'http://pharo.org/files/pharo.png' asUrl file asFileReference extension.It all depends at what level you want to tell your user they tried getting an unsupported file type.
Broad :) but soon you will be my user and you will have the right to complain :)