mirror of
https://github.com/lostisland/faraday.git
synced 2025-08-30 00:03:09 -04:00
parens are allright in my book
This commit is contained in:
parent
48cbbac378
commit
c1fdbe3e02
@ -56,19 +56,19 @@ module Faraday
|
||||
end
|
||||
|
||||
def request(key, *args, &block)
|
||||
use_symbol Faraday::Request, key, *args, &block
|
||||
use_symbol(Faraday::Request, key, *args, &block)
|
||||
end
|
||||
|
||||
def response(key, *args, &block)
|
||||
use_symbol Faraday::Response, key, *args, &block
|
||||
use_symbol(Faraday::Response, key, *args, &block)
|
||||
end
|
||||
|
||||
def adapter(key, *args, &block)
|
||||
use_symbol Faraday::Adapter, key, *args, &block
|
||||
use_symbol(Faraday::Adapter, key, *args, &block)
|
||||
end
|
||||
|
||||
def use_symbol(mod, key, *args, &block)
|
||||
use mod.lookup_module(key), *args, &block
|
||||
use(mod.lookup_module(key), *args, &block)
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
@ -76,7 +76,7 @@ module Faraday
|
||||
end
|
||||
|
||||
def dup
|
||||
self.class.new @handlers.dup
|
||||
self.class.new(@handlers.dup)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -74,23 +74,23 @@ module Faraday
|
||||
end
|
||||
|
||||
def get(url = nil, headers = nil, &block)
|
||||
run_request :get, url, nil, headers, &block
|
||||
run_request(:get, url, nil, headers, &block)
|
||||
end
|
||||
|
||||
def post(url = nil, body = nil, headers = nil, &block)
|
||||
run_request :post, url, body, headers, &block
|
||||
run_request(:post, url, body, headers, &block)
|
||||
end
|
||||
|
||||
def put(url = nil, body = nil, headers = nil, &block)
|
||||
run_request :put, url, body, headers, &block
|
||||
run_request(:put, url, body, headers, &block)
|
||||
end
|
||||
|
||||
def head(url = nil, headers = nil, &block)
|
||||
run_request :head, url, nil, headers, &block
|
||||
run_request(:head, url, nil, headers, &block)
|
||||
end
|
||||
|
||||
def delete(url = nil, headers = nil, &block)
|
||||
run_request :delete, url, nil, headers, &block
|
||||
run_request(:delete, url, nil, headers, &block)
|
||||
end
|
||||
|
||||
def basic_auth(login, pass)
|
||||
@ -217,10 +217,10 @@ module Faraday
|
||||
def replace_query(uri, params)
|
||||
url_params = @params.dup
|
||||
if uri.query && !uri.query.empty?
|
||||
merge_params url_params, parse_query(uri.query)
|
||||
merge_params(url_params, parse_query(uri.query))
|
||||
end
|
||||
if params && !params.empty?
|
||||
merge_params url_params, params
|
||||
merge_params(url_params, params)
|
||||
end
|
||||
uri.query = url_params.empty? ? nil : build_query(url_params)
|
||||
uri
|
||||
|
@ -65,8 +65,8 @@ module Faraday
|
||||
def to_env_hash(connection, request_method)
|
||||
env_headers = connection.headers.dup
|
||||
env_params = connection.params.dup
|
||||
connection.merge_headers env_headers, headers
|
||||
connection.merge_params env_params, params
|
||||
connection.merge_headers(env_headers, headers)
|
||||
connection.merge_params(env_params, params)
|
||||
|
||||
{ :method => request_method,
|
||||
:body => body,
|
||||
|
@ -13,7 +13,7 @@ module Faraday
|
||||
def call(env)
|
||||
env[:request_headers]['Content-Type'] = 'application/json'
|
||||
if env[:body] && !env[:body].respond_to?(:to_str)
|
||||
env[:body] = ActiveSupport::JSON.encode env[:body]
|
||||
env[:body] = ActiveSupport::JSON.encode(env[:body])
|
||||
end
|
||||
@app.call env
|
||||
end
|
||||
|
@ -10,7 +10,7 @@ module Faraday
|
||||
def call(env)
|
||||
env[:request_headers]['Content-Type'] = 'application/json'
|
||||
if env[:body] && !env[:body].respond_to?(:to_str)
|
||||
env[:body] = Yajl::Encoder.encode env[:body]
|
||||
env[:body] = Yajl::Encoder.encode(env[:body])
|
||||
end
|
||||
@app.call env
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user