rest-client headers or cookies

Discussion in 'Ruby' started by Ed Howland, Dec 21, 2009.

  1. Ed Howland

    Ed Howland Guest

    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
    Ed Howland, Dec 21, 2009
    #1
    1. Advertising

  2. 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
    Nicholas Wieland, Dec 21, 2009
    #2
    1. Advertising

  3. Ed Howland

    Ed Howland Guest

    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
    Ed Howland, Dec 22, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dont bother
    Replies:
    0
    Views:
    773
    dont bother
    Mar 3, 2004
  2. _Who
    Replies:
    7
    Views:
    2,638
  3. Phil
    Replies:
    4
    Views:
    663
    Gabriel Genellina
    Jan 17, 2010
  4. Ian
    Replies:
    2
    Views:
    1,914
  5. bigDWK

    HTTP::Cookies cookie_jar %rest hash

    bigDWK, Sep 29, 2004, in forum: Perl Misc
    Replies:
    1
    Views:
    177
    brian d foy
    Sep 29, 2004
Loading...

Share This Page