mirror of
https://github.com/lostisland/faraday.git
synced 2025-08-10 00:03:15 -04:00
Fixes CodeClimate issues introduced in the latest PRs (#865)
This commit is contained in:
parent
91ddced8b2
commit
fcc4c4043e
@ -306,12 +306,12 @@ Metrics/AbcSize:
|
||||
# Configuration parameters: CountComments, ExcludedMethods.
|
||||
# ExcludedMethods: refine
|
||||
Metrics/BlockLength:
|
||||
Max: 473
|
||||
Max: 489
|
||||
|
||||
# Offense count: 5
|
||||
# Configuration parameters: CountComments.
|
||||
Metrics/ClassLength:
|
||||
Max: 209
|
||||
Max: 217
|
||||
|
||||
# Offense count: 20
|
||||
Metrics/CyclomaticComplexity:
|
||||
|
@ -27,9 +27,6 @@ module Faraday
|
||||
# @return [Faraday::Builder] Builder for this Connection.
|
||||
attr_reader :builder
|
||||
|
||||
# @return [Hash] request options.
|
||||
attr_reader :options
|
||||
|
||||
# @return [Hash] SSL options.
|
||||
attr_reader :ssl
|
||||
|
||||
@ -187,6 +184,7 @@ module Faraday
|
||||
# @return [Faraday::Response]
|
||||
def options(*args)
|
||||
return @options if args.size.zero?
|
||||
|
||||
url, params, headers = *args
|
||||
run_request(:options, url, nil, headers) do |request|
|
||||
request.params.update(params) if params
|
||||
@ -399,7 +397,7 @@ module Faraday
|
||||
def path_prefix=(value)
|
||||
url_prefix.path = if value
|
||||
value = '/' + value unless value[0,1] == '/'
|
||||
value
|
||||
value
|
||||
end
|
||||
end
|
||||
|
||||
@ -532,7 +530,7 @@ module Faraday
|
||||
case url
|
||||
when String
|
||||
uri = Utils.URI(url)
|
||||
uri = URI.parse("#{uri.scheme}://#{uri.hostname}").find_proxy
|
||||
uri = URI.parse("#{uri.scheme}://#{uri.hostname}").find_proxy
|
||||
when URI
|
||||
uri = url.find_proxy
|
||||
when nil
|
||||
|
@ -6,19 +6,19 @@ module Faraday
|
||||
set :environment, :test
|
||||
disable :logging
|
||||
disable :protection
|
||||
|
||||
|
||||
[:get, :post, :put, :patch, :delete, :options].each do |method|
|
||||
send(method, '/echo') do
|
||||
kind = request.request_method.downcase
|
||||
out = kind.dup
|
||||
out << ' ?' << request.GET.inspect if request.GET.any?
|
||||
out << ' ' << request.POST.inspect if request.POST.any?
|
||||
|
||||
|
||||
content_type 'text/plain'
|
||||
return out
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
[:get, :post].each do |method|
|
||||
send(method, '/stream') do
|
||||
content_type :txt
|
||||
@ -29,7 +29,7 @@ module Faraday
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
[:get, :post].each do |method|
|
||||
send(method, '/empty_stream') do
|
||||
content_type :txt
|
||||
@ -38,12 +38,12 @@ module Faraday
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
get '/echo_header' do
|
||||
header = "HTTP_#{params[:name].tr('-', '_').upcase}"
|
||||
request.env.fetch(header) { 'NONE' }
|
||||
end
|
||||
|
||||
|
||||
post '/file' do
|
||||
if params[:uploaded_file].respond_to? :each_key
|
||||
"file %s %s %d" % [
|
||||
@ -55,28 +55,28 @@ module Faraday
|
||||
status 400
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
get '/multi' do
|
||||
[200, { 'Set-Cookie' => 'one, two' }, '']
|
||||
end
|
||||
|
||||
|
||||
get '/who-am-i' do
|
||||
request.env['REMOTE_ADDR']
|
||||
end
|
||||
|
||||
|
||||
get '/slow' do
|
||||
sleep 10
|
||||
[200, {}, 'ok']
|
||||
end
|
||||
|
||||
|
||||
get '/204' do
|
||||
status 204 # no content
|
||||
end
|
||||
|
||||
|
||||
get '/ssl' do
|
||||
request.secure?.to_s
|
||||
end
|
||||
|
||||
|
||||
error do |e|
|
||||
"#{e.class}\n#{e.to_s}\n#{e.backtrace.join("\n")}"
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user