Closed
Description
The uri_template
gem, which hyperclient uses to build urls, implements RFC6570, that expands a parameter in the {?foo*}
format as ?foo=a&foo=b&foo=c
.
Unfortunately, faraday's default argument parser (Faraday::Utils.default_params_encoder
) is set to the NestedParamsEncoder
which only considers parameters to be arrays if they have []
in the key.
The result is that values for a parameter are dropped in this process:
require 'faraday'
require 'uri_template'
Faraday::Utils.default_params_encoder.decode(
URITemplate.new('http://example.com/{?foo*}').expand(foo: ['a', 'b']).split('?').last
)
=> {"foo"=>"b"}
And thus the resulting faraday request will be missing some of the values.
The solution is to use faraday's other parameter encoder (the FlatParamsEncoder
).
I'm working on a PR to fix this, but wanted to open the issue to have something to reference.