The secret sauce for cookies:

resp = RestClient.post(server_url' + '/resource', :args => "")
@session_cookies = resp.cookies

Then when calling again:
RestClient.put('#{server_url + '/resource/id',
              {:args => args}, {:cookies => @session_cookies})

You have to use a payload (:args => args) for PUT and it must be the
first argument. The :cookies hash must be the second argument to
put().

Cheers,
Ed



On Mon, Dec 21, 2009 at 5:59 PM, Nicholas Wieland
<nicholas.wieland / gmail.com> wrote:
> Hi -
>
> On Dec 21, 2009, at 10:48 PM, Ed Howland wrote:
>
>> Hi,
>>
>> I am trying to make a request to a PHP application coded with limonade
>> (a REST sever like Sinatra). I'm using rest_client which rides on top
>> of Net::HTTP. I'd like to get the headers back from that call, so that
>> I can store the session cookie and pass it back on subsequent
>> requests.
>>
>> I know how to set the headers for RestClient.get, but how do I get the
>> headerts from a RestCleint.post?
>
> I don't think you want the headers of the GET or POST, but of the response, right ?
> Did you try to assign the RestClient.get to a variable (that should be a Response) and call headers on it ?
> Let me know if it works.
>
>  
>
>
>



-- 
Ed Howland
http://greenprogrammer.wordpress.com
http://twitter.com/ed_howland