lib/setsuzoku/rspec/dynamic_spec_helper.rb in setsuzoku-0.11.9 vs lib/setsuzoku/rspec/dynamic_spec_helper.rb in setsuzoku-0.12.54
- old
+ new
@@ -1,6 +1,6 @@
-# typed: false
+# typed: ignore
require 'active_support/core_ext/class/subclasses'
require 'active_support/inflector/methods'
require 'faraday'
@@ -151,14 +151,15 @@
stubs.each do |provider, stub|
stub.each do |action_name, props|
props.each do |propz|
plugin.api_strategy.current_action = action_name
default_headers = plugin.api_strategy.request_options(propz[:request_format])[:headers] || { 'Content-Type' => "application/#{propz[:request_format]}" }
+ auth_headers = plugin.auth_strategy.auth_headers || {}
if plugin.auth_strategy.is_a?(Setsuzoku::Service::WebService::AuthStrategies::BasicAuthStrategy)
- basic_auth = plugin.api_strategy.request_options(propz[:request_format])[:basic_auth]
+ basic_auth = auth_headers[:authorization][:basic_auth]
auth_header = { 'Authorization' => "Basic #{Base64.encode64("#{basic_auth[:username]}:#{basic_auth[:password]}").gsub("\n", '')}" }
elsif plugin.auth_strategy.is_a?(Setsuzoku::Service::WebService::AuthStrategies::OAuthStrategy)
- auth_header = { 'Authorization' => "Bearer #{plugin.api_strategy.request_options(propz[:request_format])[:token]}" }
+ auth_header = { 'Authorization' => "Bearer #{auth_headers[:authorization][:token]}" }
end
default_headers.merge!(auth_header) if auth_header
headers = propz[:headers] ? [propz[:headers]] : [default_headers]
stub_directory ||= "#{plugin.class.plugin_namespace}/#{provider}"
\ No newline at end of file