Cleanup trailing whitespace

This commit is contained in:
Erik Michaels-Ober 2011-11-28 03:46:27 -08:00
parent 94cbe2e875
commit 4524cfafdc
9 changed files with 23 additions and 23 deletions

View File

@ -17,7 +17,7 @@ module Faraday
if http.use_ssl = (url.scheme == 'https' && (ssl = env[:ssl]) && true)
http.verify_mode = ssl[:verify_mode] || begin
if ssl.fetch(:verify, true)
if ssl.fetch(:verify, true)
OpenSSL::SSL::VERIFY_PEER
# Use the default cert store by default, i.e. system ca certs
store = OpenSSL::X509::Store.new

View File

@ -30,16 +30,16 @@ module Faraday
end
env_req = env[:request]
if proxy = env_req[:proxy]
req.proxy = "#{proxy[:uri].host}:#{proxy[:uri].port}"
if proxy[:username] && proxy[:password]
req.proxy_username = proxy[:username]
req.proxy_password = proxy[:password]
end
end
req.timeout = req.connect_timeout = (env_req[:timeout] * 1000) if env_req[:timeout]
req.connect_timeout = (env_req[:open_timeout] * 1000) if env_req[:open_timeout]

View File

@ -26,4 +26,4 @@ module Faraday
@app = app
end
end
end
end

View File

@ -13,10 +13,10 @@ module Faraday
end
@app.call env
end
def match_content_type(env)
type = request_type(env)
if process_request?(env)
env[:request_headers][CONTENT_TYPE] ||= self.class.mime_type
yield env[:body] unless env[:body].respond_to?(:to_str)

View File

@ -8,7 +8,7 @@ module Faraday
raise Faraday::Error::ClientError, response_values(env)
end
end
def response_values(env)
{:status => env[:status], :headers => env[:response_headers], :body => env[:body]}
end

View File

@ -10,7 +10,7 @@ end
module Faraday
class CompositeReadIO < ::CompositeReadIO
attr_reader :length
def initialize(parts)
@length = parts.inject(0) { |sum, part| sum + part.length }
ios = parts.map{ |part| part.to_io }

View File

@ -185,7 +185,7 @@ else
b.use adapter
end
end
Faraday::Connection.new(LIVE_SERVER, &builder_block).tap do |conn|
conn.headers['X-Faraday-Adapter'] = adapter.to_s
adapter_handler = conn.builder.handlers.last

View File

@ -112,45 +112,45 @@ class ResponseTest < Faraday::TestCase
}
@response = Faraday::Response.new @env
end
def test_finished
assert @response.finished?
end
def test_error_on_finish
assert_raises RuntimeError do
@response.finish({})
end
end
def test_not_success
assert !@response.success?
end
def test_status
assert_equal 404, @response.status
end
def test_body
assert_equal 'yikes', @response.body
end
def test_headers
assert_equal 'text/plain', @response.headers['Content-Type']
assert_equal 'text/plain', @response['content-type']
end
def test_apply_request
@response.apply_request :body => 'a=b', :method => :post
assert_equal 'yikes', @response.body
assert_equal :post, @response.env[:method]
end
def test_marshal
@response = Faraday::Response.new
@response.on_complete { }
@response.finish @env.merge(:custom => 'moo')
loaded = Marshal.load Marshal.dump(@response)
assert_nil loaded.env[:custom]
assert_equal %w[body response_headers status], loaded.env.keys.map { |k| k.to_s }.sort

View File

@ -23,7 +23,7 @@ class ResponseMiddlewareTest < Faraday::TestCase
@conn.get('ok')
end
end
def test_raises_not_found
error = assert_raises Faraday::Error::ResourceNotFound do
@conn.get('not-found')
@ -31,7 +31,7 @@ class ResponseMiddlewareTest < Faraday::TestCase
assert_equal 'the server responded with status 404', error.message
assert_equal 'because', error.response[:headers]['X-Reason']
end
def test_raises_error
error = assert_raises Faraday::Error::ClientError do
@conn.get('error')
@ -39,7 +39,7 @@ class ResponseMiddlewareTest < Faraday::TestCase
assert_equal 'the server responded with status 500', error.message
assert_equal 'bailout', error.response[:headers]['X-Error']
end
def test_upcase
@conn.builder.insert(0, ResponseUpcaser)
assert_equal '<BODY></BODY>', @conn.get('ok').body
@ -71,4 +71,4 @@ class ResponseNoBodyMiddleWareTest < Faraday::TestCase
def test_304
assert_equal nil, @conn.get('not modified').body
end
end
end