Content-Length on Post

194 views
Skip to first unread message

Ray A.

unread,
Sep 22, 2011, 11:15:35 AM9/22/11
to HTTParty Gem
I'm trying to post a JSON request to Google Places using httparty.
However when I post I receive a content-length required error. I
can't seem to find out how to work around this. Can someone please
look at my code below and let me know how to resolve thsi issue.
Thanks.

lib/Partay.rb


require 'rubygems'
require 'httparty'

class Partay
include HTTParty
base_uri 'https://maps.googleapis.com'
end

#add to google API
options = {
:location => {
:lat => '33.71064',
:lng => '-84.479605'
}

}
{
:accuracy => '50',
:name=>"Rays NewshoeTree",
:types=> "shoe_store",
:language=> "en-AU"
}
-----------------------------------------------------
locations_controller.rb
class LocationsController

def index
require 'Partay
@reference = Partay.post('/maps/api/place/add/json?
sensor=false&key=AIzaSyA1mwwvv3NAL_N7gNRf_0uqK2pfiXEqkZc1',
{ :location => {:lat => '33.71064',:lng => '-84.479605'}} )
...

end



My Question is... Where do I put the content-length headers, or should
I be doing something differently, so that it is not needed.

Thanks.



Sandro

unread,
Sep 26, 2011, 2:21:06 PM9/26/11
to HTTParty Gem
Partay.post("/maps/api/place/add/json", :body => {'sensor' =>
false, ...})
Reply all
Reply to author
Forward
0 new messages