On 07 Jan 2011, at 14:14, Stéphane Ducasse wrote:
BTW it was thinking that the expected a JPEG should be more inadequate mimetype or something else.
Stef
getImageOfType: mimeType usingParser: parserClass fromUrl: urlObject | url stream request response | url := urlObject asZnUrl. stream := ZnUtils socketStreamToUrl: url. (request := ZnRequest get: url) setAccept: mimeType. response := self executeOneShot: request on: stream. response status = 200 ifFalse: [ ^ self error: 'Expected OK response' ]. response contentType = mimeType ifFalse: [ ^ self error: 'Expected a JPEG' ].
Name: Zinc-HTTP-SvenVanCaekenberghe.111 Author: SvenVanCaekenberghe Time: 7 January 2011, 7:35:18 pm UUID: d633bf09-4617-4e34-b6c7-0260dc759817 Ancestors: Zinc-HTTP-SvenVanCaekenberghe.110 fixed ZnClient class>>#getImageOfType:usingParser:fromUrl: to correctly report responses with unexpected mime types (Thx S.Ducasses)