2013-01-05 25 views
2

我有以下的curl命令的作品:通過在氣泡布HTTP一個get使用Bubblewrap:如何制定自定義標題?

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

我試圖做到這一點:

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 

但我得到一個401回來,也許我沒」 t正確設置標題?

回答

2

標題名稱應爲Authorization,值爲GoogleLogin auth=xxx。你這樣做的方式,它的標題名稱爲Authorization:GoogleLogin auth,值爲xxx。試試這個:

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