mirror of
https://github.com/lostisland/faraday.git
synced 2025-08-30 00:03:09 -04:00
Make sure to rewrite relative paths to absolute before setting “authority”.
Since version 2.1.2 of addressable gem, having an “authority” on the URI (user, password, userinfo, host, port) with a relative path is an error and an exception is thrown (see Issue 1), to avoid that make the path absolute before setting host, port and scheme.
This commit is contained in:
parent
67e2f47cc2
commit
66d532207d
@ -173,12 +173,12 @@ module Faraday
|
||||
#
|
||||
def build_url(url, params = nil)
|
||||
uri = URI.parse(url.to_s)
|
||||
uri.host ||= @host
|
||||
uri.port ||= @port
|
||||
uri.scheme ||= @scheme
|
||||
if @path_prefix && uri.path !~ /^\//
|
||||
uri.path = "#{@path_prefix.size > 1 ? @path_prefix : nil}/#{uri.path}"
|
||||
end
|
||||
uri.host ||= @host
|
||||
uri.port ||= @port
|
||||
uri.scheme ||= @scheme
|
||||
replace_query(uri, params)
|
||||
uri
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user