[Pharo-project] [Progress Report] Zinc HTTP Components

Lukas Renggli renggli at gmail.com
Fri Oct 1 08:49:23 EDT 2010

>> response := ZnHttp new
>>    url: 'http://www.foo.com';
>>    userAgent: 'FakeAgent';
>>    cookieAt: 'something' put: '123';
>>    parameterAt: 'q' put: 'smalltalk';
>>    onFailure: [ :error | self inform: 'failed' ];
>>    onProgress: [ :status | ... ];
>>    get
> A bit like Gofer I guess...

Yeah, the pattern is always the same :-)

Seaside rendering, Gofer loading, Magritte description, ...

> It certainly looks cool, the code above.
> I'll have to think a little bit about that approach.

The idea is that reasonably complex scenarios can be written as a
single expression.

> How should such an object handle wrong use of the API ?
> What if I don't specify an url, do the get before setting the cookie, ...
> It feels as if there will be little feedback in terms of errors, no ?

If you forget to specify an URL you'll likely get an exception at some
(later) point.

If you forget or do something after #get, #put, #delete, #head, ... it
has no effect. Also you don't get the result, which is returned from
these methods.

In my opinion the missing feedback is not a problem in practice,
people just have to remember to do the action last.


Lukas Renggli

More information about the Pharo-dev mailing list