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' ].
On Jan 7, 2011, at 11:05 AM, Sven Van Caekenberghe wrote:
> Hi,
>
> Maybe I am a bit late with this question, I also don't know who makes the
> decision, and it is probably external people who have to make the judgement,
> but would it be possible and/or a good idea to include Zinc HTTP Components
> into Pharo 1.2 Dev ?
>
> In any case, the code is in good shape, works on 1.2, has a reasonable number
> of tests, has comments, is pretty small and elegant.
>
> Whether or not to load the Zinc-Patch-HTTPSocket package is another question.
> This package patches (destructively overwrites) class methods in HTTPSocket,
> redirecting them to ZnHTTPSocketFacade, effectively steering all HTTP client
> access in your Smalltalk image through Zinc HTTP Components. This has been
> working for me for months, but my usage is certainly not universal. So maybe
> this should remain an option.
>
> I would especially like to expose this code to more people to get more
> feedback. I am also willing to keep on supporting the code.
>
> What do you think ?
>
> Sven
>
>
>
>