Cleanup EOL whitespace

This commit is contained in:
Erik Michaels-Ober 2010-10-08 12:33:09 -07:00
parent ca5ec52b71
commit bfae62f840
10 changed files with 25 additions and 26 deletions

View File

@ -34,7 +34,7 @@ module Faraday
# ignored. Default: env[:body]
# headers - The Hash of request headers. Default: env[:request_headers]
#
# Returns nothing. If the body is processed, it is replaced in the
# Returns nothing. If the body is processed, it is replaced in the
# environment for you.
def process_body_for_request(env, body = env[:body], headers = env[:request_headers])
return if body.nil? || body.empty? || !body.respond_to?(:each_key)
@ -99,4 +99,4 @@ module Faraday
full_path
end
end
end
end

View File

@ -3,7 +3,7 @@ module Faraday
class ActionDispatch < Faraday::Adapter
attr_reader :session
# Initializes a new middleware instance for each request. Instead of
# Initializes a new middleware instance for each request. Instead of
# initiating an HTTP request with a web server, this adapter calls
# a Rails 3 app using integration tests.
#
@ -36,4 +36,4 @@ module Faraday
end
end
end
end
end

View File

@ -28,7 +28,7 @@ module Faraday
req = env[:request]
http.read_timeout = net.open_timeout = req[:timeout] if req[:timeout]
http.open_timeout = req[:open_timeout] if req[:open_timeout]
full_path = full_path_for(env[:url].path, env[:url].query, env[:url].fragment)
http_req = Net::HTTPGenericRequest.new(
env[:method].to_s.upcase, # request method
@ -50,8 +50,8 @@ module Faraday
end
env.update \
:status => http_resp.code.to_i,
:response_headers => resp_headers,
:status => http_resp.code.to_i,
:response_headers => resp_headers,
:body => http_resp.body
@app.call env

View File

@ -16,8 +16,7 @@ module Faraday
def call(env)
super
req = ::Typhoeus::Request.new env[:url].to_s,
req = ::Typhoeus::Request.new env[:url].to_s,
:method => env[:method],
:body => env[:body],
:headers => env[:request_headers],

View File

@ -14,7 +14,7 @@ module Faraday
end
def self.inner_app
lambda do |env|
lambda do |env|
env[:parallel_manager] ? env[:response] : env[:response].finish(env)
end
end

View File

@ -109,7 +109,7 @@ module Faraday
def proxy(arg = nil)
return @proxy if arg.nil?
@proxy =
@proxy =
case arg
when String then {:uri => proxy_arg_to_uri(arg)}
when URI then {:uri => arg}
@ -123,7 +123,7 @@ module Faraday
end
# Parses the giving url with Addressable::URI and stores the individual
# components in this connection. These components serve as defaults for
# components in this connection. These components serve as defaults for
# requests made by this connection.
#
# conn = Faraday::Connection.new { ... }
@ -174,7 +174,7 @@ module Faraday
end
end
# Takes a relative url for a request and combines it with the defaults
# Takes a relative url for a request and combines it with the defaults
# set on the connection instance.
#
# conn = Faraday::Connection.new { ... }

View File

@ -68,8 +68,8 @@ module Faraday
connection.merge_headers(env_headers, headers)
connection.merge_params(env_params, params)
{ :method => request_method,
:body => body,
{ :method => request_method,
:body => body,
:url => connection.build_url(path, env_params),
:request_headers => env_headers.update(headers),
:parallel_manager => connection.parallel_manager,
@ -84,4 +84,4 @@ module Faraday
app.call(env)
end
end
end
end

View File

@ -9,7 +9,7 @@ module Faraday
HEADERS = Hash.new do |h, k|
if k.respond_to?(:to_str)
k
else
else
k.to_s.split('_'). # :user_agent => %w(user agent)
each { |w| w.capitalize! }. # => %w(User Agent)
join('-') # => "User-Agent"
@ -37,8 +37,8 @@ module Faraday
end
end
# Turns headers keys and values into strings. Look up symbol keys in the
# the HEADERS hash.
# Turns headers keys and values into strings. Look up symbol keys in the
# the HEADERS hash.
#
# h = merge_headers(HeaderHash.new, :content_type => 'text/plain')
# h['Content-Type'] # = 'text/plain'
@ -61,4 +61,4 @@ module Faraday
query.split('&').sort.join('&')
end
end
end
end

View File

@ -11,8 +11,8 @@ class MultipartTest < Faraday::TestCase
def test_processes_nested_body
# assume params are out of order
regexes = [
/name\=\"a\"/,
/name=\"b\[c\]\"\; filename\=\"multipart_test\.rb\"/,
/name\=\"a\"/,
/name=\"b\[c\]\"\; filename\=\"multipart_test\.rb\"/,
/name=\"b\[d\]\"/]
@env[:body] = {:a => 1, :b => {:c => Faraday::UploadIO.new(__FILE__, 'text/x-ruby'), :d => 2}}
@app.process_body_for_request @env
@ -24,7 +24,7 @@ class MultipartTest < Faraday::TestCase
assert_equal [], regexes
assert_kind_of CompositeReadIO, @env[:body]
assert_equal "%s;boundary=%s" %
[Faraday::Adapter::MULTIPART_TYPE, Faraday::Adapter::DEFAULT_BOUNDARY],
[Faraday::Adapter::MULTIPART_TYPE, Faraday::Adapter::DEFAULT_BOUNDARY],
@env[:request_headers]['Content-Type']
end

View File

@ -19,9 +19,9 @@ private
Faraday::Connection.new do |b|
b.use encoder
b.adapter :test do |stub|
stub.post('echo_body') do |env|
[200,
{'Content-Type' => env[:request_headers]['Content-Type']},
stub.post('echo_body') do |env|
[200,
{'Content-Type' => env[:request_headers]['Content-Type']},
env[:body]
]
end