Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > rest-client headers or cookies

Reply
Thread Tools

rest-client headers or cookies

 
 
Ed Howland
Guest
Posts: n/a
 
      12-21-2009
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?

Thanks,
Ed

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

 
Reply With Quote
 
 
 
 
Nicholas Wieland
Guest
Posts: n/a
 
      12-21-2009
Hi -

On Dec 21, 2009, at 10:48 PM, Ed Howland wrote:

> Hi,
>=20
> 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.
>=20
> 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.

ngw


 
Reply With Quote
 
 
 
 
Ed Howland
Guest
Posts: n/a
 
      12-22-2009
On Mon, Dec 21, 2009 at 5:59 PM, Nicholas Wieland
<> wrote:
>
> I don't think you want the headers of the GET or POST, but of the respons=

e, 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.
>
> =A0ngw
>

Thanks,

That did the trick. I had believed that I was just getting
response.body from the call, but what apparently was happening was it
was auto-casting to a string. response.to_s is probably the same as
response.body.

Ed

>
>




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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with wsgiref.headers.Headers Phil Python 4 01-17-2010 04:47 PM
Give Request.Cookies and Response.Cookies is there any reason to use another method to use cookies? _Who ASP .Net 7 09-18-2008 07:49 PM
Server cannot clear headers after HTTP headers have been sent Ian ASP .Net Security 2 03-20-2007 09:00 AM
cookies in HTTP POST headers Antony HTML 1 02-02-2005 07:17 AM
Reading 'received' headers: Email Headers Parsing dont bother Python 0 03-03-2004 08:18 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57