Permalink
Browse files

fix a few cases where the configured params encoder was not being used

  • Loading branch information...
1 parent b035bcb commit b38bc47b726575a70cb292666d4d7fa113f96ee2 @technoweenie committed Dec 28, 2012
Showing with 7 additions and 11 deletions.
  1. +2 −2 lib/faraday/connection.rb
  2. +0 −4 lib/faraday/options.rb
  3. +1 −1 lib/faraday/request.rb
  4. +4 −4 lib/faraday/utils.rb
@@ -314,11 +314,11 @@ def self.URI(url)
# conn.get("nigiri?page=2") # accesses https://sushi.com/api/nigiri
#
# Returns the parsed URI from teh given input..
- def url_prefix=(url)
+ def url_prefix=(url, encoder = nil)
uri = @url_prefix = self.class.URI(url)
self.path_prefix = uri.path
- params.merge_query(uri.query)
+ params.merge_query(uri.query, encoder)
uri.query = nil
with_uri_credentials(uri) do |user, password|
View
@@ -90,10 +90,6 @@ def inspect
class RequestOptions < Options.new(:params_encoder, :proxy, :bind,
:timeout, :open_timeout, :boundary,
:oauth)
-
- def params_encoder
- self[:params_encoder] ||= Faraday::Utils.default_params_encoder
- end
end
class SSLOptions < Options.new(:verify, :ca_file, :ca_path, :verify_mode,
View
@@ -50,7 +50,7 @@ def url(path, params = nil)
path, query = path.split('?', 2)
end
self.path = path
- self.params.merge_query query
+ self.params.merge_query query, options.params_encoder
self.params.update(params) if params
end
View
@@ -128,15 +128,15 @@ def replace(other)
update(other)
end
- def merge_query(query, encoder=Utils.default_params_encoder)
+ def merge_query(query, encoder = nil)
if query && !query.empty?
- update encoder.decode(query)
+ update((encoder || Utils.default_params_encoder).decode(query))
end
self
end
- def to_query(encoder=Utils.default_params_encoder)
- encoder.encode(self)
+ def to_query(encoder = nil)
+ (encoder || Utils.default_params_encoder).encode(self)
end
private

0 comments on commit b38bc47

Please sign in to comment.