Search code examples
rubyhttp-headersrubymotion

Using Bubblewrap: How to formulate get with custom headers?


I have the following Curl command that works:

curl -H "Authorization:GoogleLogin auth=xxx" http://www.google.com/reader/api/0/user-info

I'm trying to do this via a get in BubbleWrap HTTP:

HTTP.get("http://www.google.com/reader/api/0/user-info",
    {
        :headers => { "Authorization:GoogleLogin auth" => "xxx"}
    }) do |response|
    puts response
    puts response.body.to_str
end

But I get a 401 back so maybe I didn't set the header correctly?


Solution

  • The header name is supposed to be Authorization with a value of GoogleLogin auth=xxx. The way you're doing it, it's a header name of Authorization:GoogleLogin auth with a value of xxx. Try this instead:

    :headers => {"Authorization" => "GoogleLogin auth=xxx"}