mirror of
https://github.com/lostisland/faraday.git
synced 2025-10-09 00:04:39 -04:00
avoid ruby syntax warnings
This commit is contained in:
parent
08257d9deb
commit
a23124ea7b
@ -26,7 +26,7 @@ module Faraday
|
|||||||
|
|
||||||
# Public: Gets or sets the Symbol key identifying a default Adapter to use
|
# Public: Gets or sets the Symbol key identifying a default Adapter to use
|
||||||
# for the default Faraday::Connection.
|
# for the default Faraday::Connection.
|
||||||
attr_accessor :default_adapter
|
attr_reader :default_adapter
|
||||||
|
|
||||||
# Public: Sets the default Faraday::Connection for simple scripts that
|
# Public: Sets the default Faraday::Connection for simple scripts that
|
||||||
# access the Faraday constant directly.
|
# access the Faraday constant directly.
|
||||||
|
@ -5,7 +5,7 @@ module Faraday
|
|||||||
|
|
||||||
def initialize(app, &block)
|
def initialize(app, &block)
|
||||||
super(app)
|
super(app)
|
||||||
@block = block if block_given?
|
@block = block
|
||||||
end
|
end
|
||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
|
@ -79,6 +79,7 @@ module Faraday
|
|||||||
@params.update(options.params) if options.params
|
@params.update(options.params) if options.params
|
||||||
@headers.update(options.headers) if options.headers
|
@headers.update(options.headers) if options.headers
|
||||||
|
|
||||||
|
@proxy = nil
|
||||||
proxy(options.fetch(:proxy) { ENV['http_proxy'] })
|
proxy(options.fetch(:proxy) { ENV['http_proxy'] })
|
||||||
|
|
||||||
yield self if block_given?
|
yield self if block_given?
|
||||||
|
@ -58,7 +58,7 @@ module Adapters
|
|||||||
module Compression
|
module Compression
|
||||||
def test_GET_handles_compression
|
def test_GET_handles_compression
|
||||||
res = get('echo_header', :name => 'accept-encoding')
|
res = get('echo_header', :name => 'accept-encoding')
|
||||||
assert_match /gzip;.+\bdeflate\b/, res.body
|
assert_match(/gzip;.+\bdeflate\b/, res.body)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -37,9 +37,9 @@ class AuthenticationMiddlewareTest < Faraday::TestCase
|
|||||||
response = conn { |b|
|
response = conn { |b|
|
||||||
b.request :token_auth, 'baz', :foo => 42
|
b.request :token_auth, 'baz', :foo => 42
|
||||||
}.get('/auth-echo')
|
}.get('/auth-echo')
|
||||||
assert_match /^Token /, response.body
|
assert_match(/^Token /, response.body)
|
||||||
assert_match /token="baz"/, response.body
|
assert_match(/token="baz"/, response.body)
|
||||||
assert_match /foo="42"/, response.body
|
assert_match(/foo="42"/, response.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_token_middleware_does_not_interfere_with_existing_authorization
|
def test_token_middleware_does_not_interfere_with_existing_authorization
|
||||||
@ -52,14 +52,14 @@ class AuthenticationMiddlewareTest < Faraday::TestCase
|
|||||||
response = conn { |b|
|
response = conn { |b|
|
||||||
b.request :authorization, 'custom', 'abc def'
|
b.request :authorization, 'custom', 'abc def'
|
||||||
}.get('/auth-echo')
|
}.get('/auth-echo')
|
||||||
assert_match /^custom abc def$/, response.body
|
assert_match(/^custom abc def$/, response.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_authorization_middleware_with_hash
|
def test_authorization_middleware_with_hash
|
||||||
response = conn { |b|
|
response = conn { |b|
|
||||||
b.request :authorization, 'baz', :foo => 42
|
b.request :authorization, 'baz', :foo => 42
|
||||||
}.get('/auth-echo')
|
}.get('/auth-echo')
|
||||||
assert_match /^baz /, response.body
|
assert_match(/^baz /, response.body)
|
||||||
assert_match /foo="42"/, response.body
|
assert_match(/foo="42"/, response.body)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user