Hi Sven, Thanks a lot. Zinc is my friend ;). Nice and understandable. bon weekend, camillo On 2011-04-23, at 21:27, Sven Van Caekenberghe wrote:
Hey Camillo,
On 23 Apr 2011, at 20:05, Camillo Bruni wrote:
I am too dumb and there is too little documentation which is hard to find :). So can anyone tell me how I do the following bash thingy in pharo?
curl $URL --data-binary $SOME_FILE -H 'Content-type:application/json'
I don't manage to get this working properly. I guess HTTPSocket is the class to use...
thanks a lot camillo
Well, Zinc HTTP Components [1], of course:
| json entity | json := (FileStream fileNamed: '/tmp/foo.json') contentsOfEntireFile. entity := ZnEntity with: json type: ZnMimeType applicationJson. ZnClient post: 'http://example.com/foo' data: entity
This will return a ZnResponse, inspect it for more details. There are many more options, but this is a simple example to get you started.
The source code should be your friend.
Sven