Skip to content

Commit 2fa5370

Browse files
committed
no need for local_http_config, just use faraday feature
1 parent 8bf2248 commit 2fa5370

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

lib/rack/oauth2/client.rb

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ def force_token_type!(token_type)
6868
@forced_token_type = token_type.to_s
6969
end
7070

71-
def access_token!(*args, &local_http_config)
72-
headers, params, http_client, options = authenticated_context_from(*args, &local_http_config)
71+
def access_token!(*args)
72+
headers, params, http_client, options = authenticated_context_from(*args)
7373
params[:scope] = Array(options.delete(:scope)).join(' ') if options[:scope].present?
7474
params.merge! @grant.as_json
7575
params.merge! options
@@ -78,12 +78,14 @@ def access_token!(*args, &local_http_config)
7878
absolute_uri_for(token_endpoint),
7979
Util.compact_hash(params),
8080
headers
81-
)
81+
) do |req|
82+
yield req if block_given?
83+
end
8284
end
8385
end
8486

85-
def revoke!(*args, &local_http_config)
86-
headers, params, http_client, options = authenticated_context_from(*args, &local_http_config)
87+
def revoke!(*args)
88+
headers, params, http_client, options = authenticated_context_from(*args)
8789

8890
params.merge! case
8991
when access_token = options.delete(:access_token)
@@ -111,7 +113,9 @@ def revoke!(*args, &local_http_config)
111113
absolute_uri_for(revocation_endpoint),
112114
Util.compact_hash(params),
113115
headers
114-
)
116+
) do |req|
117+
yield req if block_given?
118+
end
115119
end
116120
end
117121

@@ -126,9 +130,9 @@ def absolute_uri_for(endpoint)
126130
_endpoint_.to_s
127131
end
128132

129-
def authenticated_context_from(*args, &local_http_config)
133+
def authenticated_context_from(*args)
130134
headers, params = {}, {}
131-
http_client = Rack::OAuth2.http_client(&local_http_config)
135+
http_client = Rack::OAuth2.http_client
132136

133137
# NOTE:
134138
# Using Array#extract_options! for backward compatibility.

0 commit comments

Comments
 (0)