Sets Addressable as the default URI parser. Supports parsing templated uris.
Add this line to your application's Gemfile:
gem 'excon-addressable'
And then execute:
bundle
Or install it yourself as:
gem install excon-addressable
Be sure to add Excon::Addressable::Middleware
to the top of the middleware
stack, so that the variables get expanded as early as possible. This prevents
other middleware from choking on non-valid URIs.
Excon.defaults[:middlewares].unshift(Excon::Addressable::Middleware)
Then simply provide a templated variable, and the values with which to expand the template:
conn = Excon.new('http://www.example.com/{uid}', expand: { uid: 'hello' })
conn.request.path # => '/hello'
The gem is available as open source under the terms of the MIT License.