Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/linq/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails HTTParty将参数from:options哈希多次添加到URL_Ruby On Rails_Api_Uri_Params_Httparty - Fatal编程技术网

Ruby on rails HTTParty将参数from:options哈希多次添加到URL

Ruby on rails HTTParty将参数from:options哈希多次添加到URL,ruby-on-rails,api,uri,params,httparty,Ruby On Rails,Api,Uri,Params,Httparty,HTTParty.get正在向其发送的URI多次添加参数。以前有其他人遇到过这个吗 def initialize(address) self.address = address self.base_uri = 'https://api.randomapi.com/street-address' end def get response = HTTParty.get(base_uri, :query => { :street => address.street

HTTParty.get正在向其发送的URI多次添加参数。以前有其他人遇到过这个吗

def initialize(address)
   self.address = address
   self.base_uri = 'https://api.randomapi.com/street-address'
end

def get
  response = HTTParty.get(base_uri, :query => {
    :street => address.street.strip,
  })
end
如果这样,我将以这种方式格式化请求:

HTTParty.get(base_uri, :query => {:street=>"random street"})
这是发送的URI。注意添加了多少次
street
param

#<URI::HTTPS:0x007fbc78582d70 URL:https://api.randomapi.com/street-address?street=random%20street&street=random%20street&street=random%20street&street=random%20street>
#

原来这是gem(,)中的一个bug。我升级到0.11,它修复了重复参数的问题