Skip to content

Commit b71d448

Browse files
committed
Adds a spec to verify extra header params on Client Credentials
This is a regression spec, based on the issue in #257 which looks like it was fixed during a refactoring.
1 parent 4f14fa7 commit b71d448

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

spec/oauth2/strategy/client_credentials_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
stub.post('/oauth/token', 'grant_type' => 'client_credentials') do |env|
1111
client_id, client_secret = Base64.decode64(env[:request_headers]['Authorization'].split(' ', 2)[1]).split(':', 2)
1212
client_id == 'abc' && client_secret == 'def' || raise(Faraday::Adapter::Test::Stubs::NotFound)
13+
@last_headers = env[:request_headers]
1314
case @mode
1415
when 'formencoded'
1516
[200, {'Content-Type' => 'application/x-www-form-urlencoded'}, kvform_token]
@@ -66,4 +67,15 @@
6667
end
6768
end
6869
end
70+
71+
describe '#get_token (with extra header parameters)' do
72+
before do
73+
@mode = 'json'
74+
@access = subject.get_token(:headers => {'X-Extra-Header' => 'wow'})
75+
end
76+
77+
it 'sends the header correctly.' do
78+
expect(@last_headers['X-Extra-Header']).to eq('wow')
79+
end
80+
end
6981
end

0 commit comments

Comments
 (0)