If I do:
conn = Faraday.new(url: 'http://example.com/api') do |builder|
builder.adapter :httpclint
end
it removes /api
from the base url and conn.host
returns "example.com"
. When I later do:
conn.post { |req| req.url '/resource'...}
it calls example.com/resource
, instead of example.com/api/resource
. How can I change that so it doesn't cut the base url?
I know I could initialize it with only example.com
and then just do something like:
conn.post { |req| req.url '/api/resource'...}
but I want to store the base url in a global configuration, so that only the names of the resources are used in the code.