1

我正在尝试将一些数据发布到 Google Places api。但是,当我运行代码(如下)时,我收到 411 Length Required 错误。有谁知道如何使用下面的代码解决这个问题。谢谢

require 'rubygems'
require 'httparty'

class Partay
   include HTTParty
  base_uri 'https://maps.googleapis.com/maps/api/place/add/json?sensor=false&key=API_Key' 

end

  #add to google API
   options = {
     :location => {
    :lat => '33.71064',
    :lng => '-84.479605'
  }
    }  
    {
      :accuracy => '50',
  :name=>"Rays NewShoeTree",
  :types=> "shoe_store",
  :language=> "en-AU"
    }

puts Partay.post('/maps/api/place/add/json?sensor=false&key=API_Key', options)
4

1 回答 1

0

您需要在帖子中指定正文。即使只是 nil 或空哈希,HTTParty 也会包含 Content-Length 标头。

于 2013-09-08T23:41:55.567 回答