On 08 May 2012, at 22:56, Sven Van Caekenberghe wrote:

> And yes, maybe yet another convenience method like the #downloadTo: would be 
> useful ;-)
> Even guessing the mime-type from the extension is possible (as in 
> ZnStaticFileServerDelegate>>#responseForFile:).
> I'll see what I can do later.

I added a convenience method called ZnClient>>#uploadEntityFrom: so the example 
now becomes:

ZnClient new
        url: 'http://hudson.server.org/createItem';
        queryAt: 'name' put: 'newjobname';
        username: 'user' password: 'password';
        uploadEntityFrom: '/tmp/foo.xml';
        post.

Now, for other people who might get confused: this is *not* the same as doing a 
'web style form based upload' !
This can be done with Zn as well, of course. It would look more or less like:

ZnClient new
        url: 'http://hudson.server.org/createItemForm';
        username: 'user' password: 'password';
        addPart: (ZnPart fieldNamed: 'file' fileNamed: '/tmp/foo.xml');
        post.

The last example is using a multi-part form-data entity.

Sven

Reply via email to