Hey all,

This is probably me missing something, but: for an upcoming
presentation, I wanted to find the tersest way to demonstrate making an
HTTP POST.  Something equivalent to Python's

    requests.post('http://some/thing', data={'foo': 'bar', 'baz':
    'quux'})

The closest I could come up with for Pharo was

    ZnEasy post: 'http://some/thing' data:
    (ZnApplicationFormUrlEncodedEntity withAll: {
        'foo' -> 'bar'.
        'baz' -> 'quux'.
    } asDictionary)

I just wanted to verify that is, in fact, the shortest way to do this. 
I feel as if I'm almost certainly missing a utility method around the
ZnApplicationFormUrlEncodedEntity bit, and, especially for demos,
terseness matters.  (It's obviously trivial to write a utility method if
this *is* the shortest way to do this, but then people in the audience
won't be able to execute the resulting code snippet without the utility
method.)

Thanks,

--Benjamin

Reply via email to