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
注意参数被添加 了多少次。
#<URI::HTTPS:0x007fbc78582d70 URL:https://api.randomapi.com/street-address?street=random%20street&street=random%20street&street=random%20street&street=random%20street>