mirror of
				https://github.com/lostisland/faraday.git
				synced 2025-11-04 00:02:33 -05:00 
			
		
		
		
	make the default uri parser configurable
This commit is contained in:
		
							parent
							
								
									63b8a1d977
								
							
						
					
					
						commit
						c24a02c73b
					
				@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user