On 21 April 2010 14:48, Saris Hein <h...@beta9.be> wrote: > Hi, > > I am trying to get some stuff done with REST using Pharo. > So far, I am able to do GETs, but I am unable to do PUTs because the REST > service expects the content sent to be JSON. > For this to work, I need to set the Content-Type of the request to > 'application/json'. > I have successfully installed the CurlPlugin via Gofer (version 25 from dao), > and thanks to John (M. McIntosh), who provided me with a new version of the > bundle for Mac, I was able to pass all the tests, except for the > testApiOptions test, which fails on the timeout: test. > The version John provided me with is 2.0.0. I first tried with version 1.1.0, > but that failed on 13 tests due to a primitive that failed constantly > (<primitive: 'primSetOptLong' module: 'CurlPlugin'>). > There is a method addHeader: in the plugin, but it does not seem to do > anything useful. > > I have found a blog (Jazz Programming) by Giovanni Corriga, who claims to > have a version of the plugin that allows for custom headers to be set, but > the link to his version gives a 304 error. Plus the blog dates from 2007. > > Having a version of the CurlPlugin that allows me to set a custom header > would be great, so if anybody has one, please let me know. But what I would > really like to have is a good implementation of the HTTP protocol in > Squeak/Pharo, so that we are not dependent on a plugin. The standard HTTP > client in Squeak/Pharo is based on HttpSocket, and is only a partial > implementation of the HTTP protocol (it only supports GETs as far as I can > tell). > > Does anyone know of another way to do basic HTTP in Squeak/Pharo? >
Yes. I know :) Another way is to use sockets directly, without curl. This is way what i went for implementing a CouchDB interface for Pharo & Squeak. With this way you can generate _any_ request header with any contents, without bothering, if some 3rd party plugin supports it or not. You can check it out here: MCHttpRepository location: 'http://www.squeaksource.com/SCouchDB' user: '' password: '' > Regards, > > Hein > > > _______________________________________________ > Pharo-project mailing list > Pharo-project@lists.gforge.inria.fr > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project > -- Best regards, Igor Stasenko AKA sig. _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project