Hey Torsten, On 16 Apr 2013, at 20:48, "Torsten Bergmann" <astares@gmx.de> wrote:
Thanks - Pharo 2.0 and Zinc makes it really easy to work with, write AND test HTTP stuff:
------------------------------------------------------------------------------------------------------------------ testHandleRequestForFavIcon
| response mime | response := requestHandler handleRequest: (ZnRequest get: '/favicon.ico' asZnUrl). self assert: response status = 200. "HTTP OK"
mime := response entity contentType. self assert: mime main= 'image'; assert: mime sub = 'vnd.microsoft.icon'
------------------------------------------------------------------------------------------------------------------
testSearchEngineIsSatisfied
self assert: (ZnEasy get: 'http://www.pharo.org/robots.txt') status = 200
------------------------------------------------------------------------------------------------------------------ â¦
Thanks for the feedback ;-) That was indeed one of the main goals: to make it easy to work with HTTP using objects, be it requests or responses, client or server side. If you encounter places to improve the framework, don't hesitate to make suggestions. I would write the second assert in the first test as self assert: response contentType equals: 'image/vnd.microsoft.icon' asZnMimeType There are also test messages you can send to response objects, like #isSuccess even though that is slightly more general than 200. If you are OK with that, you can write self assert: response isSuccess Sven -- Sven Van Caekenberghe http://stfx.eu Smalltalk is the Red Pill