I am working against an API that forces me to send the same parameter name several times to cascade different filtering criteria. So the GET api example looks like this:
GET http:
I use Faraday for my REST adapter, which takes its URL parameters as a hash (therefore - it has unique keys). This means that I cannot do something like this:
response = Faraday.new({
url: 'http://api.site.com/search'
params: { a: 'b1', a: 'b2', a: 'b3', a: 'c2' } # => nay
}).get
I tried to crack the URL just before sending the request:
connection = Faraday.new(url: 'http://api.site.com/search')
url = connection.url_prefix.to_s
full_url = "#{ url }?a=b1&a=b2&a=b3&a=c2"
response = connection.get( full_url )
What didn't work - when I debug the answer, I see that the actual URL sent to the API server is:
GET http:
I have no way to change the API. Is there any way to continue working with Faraday and solve it in an elegant way? thank.
sa125 source
share