make the default uri parser configurable

This commit is contained in:
risk danger olson 2013-05-08 08:43:28 -06:00
parent 63b8a1d977
commit c24a02c73b

View File

@ -187,8 +187,11 @@ module Faraday
class << self
attr_writer :default_params_encoder
attr_accessor :default_uri_parser
end
self.default_uri_parser = Kernel.method(:URI)
# Stolen from Rack
def normalize_params(params, name, v = nil)
name =~ %r(\A[\[\]]*([^\[\]]+)\]*)
@ -235,7 +238,7 @@ module Faraday
if url.respond_to?(:host)
url
elsif url.respond_to?(:to_str)
Kernel.URI(url)
default_uri_parser.call(url)
else
raise ArgumentError, "bad argument (expected URI object or URI string)"
end