File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ def authorize_params
4343 end
4444
4545 def raw_info
46- access_token . options [ :mode ] = :query
46+ access_token . options [ :mode ] = :header
4747 @raw_info ||= access_token . get ( 'user' ) . parsed
4848 end
4949
@@ -59,7 +59,7 @@ def primary_email
5959 # The new /user/emails API - http://developer.github.com/v3/users/emails/#future-response
6060 def emails
6161 return [ ] unless email_access_allowed?
62- access_token . options [ :mode ] = :query
62+ access_token . options [ :mode ] = :header
6363 @emails ||= access_token . get ( 'user/emails' , :headers => { 'Accept' => 'application/vnd.github.v3' } ) . parsed
6464 end
6565
Original file line number Diff line number Diff line change 122122 expect ( access_token ) . to receive ( :get ) . with ( 'user' ) . and_return ( response )
123123 expect ( subject . raw_info ) . to eq ( parsed_response )
124124 end
125+
126+ it 'should use the header auth mode' do
127+ expect ( access_token ) . to receive ( :get ) . with ( 'user' ) . and_return ( response )
128+ subject . raw_info
129+ expect ( access_token . options [ :mode ] ) . to eq ( :header )
130+ end
125131 end
126132
127133 context '#emails' do
133139 subject . options [ 'scope' ] = 'user'
134140 expect ( subject . emails ) . to eq ( parsed_response )
135141 end
142+
143+ it 'should use the header auth mode' do
144+ expect ( access_token ) . to receive ( :get ) . with ( 'user/emails' , :headers => {
145+ 'Accept' => 'application/vnd.github.v3'
146+ } ) . and_return ( response )
147+
148+ subject . options [ 'scope' ] = 'user'
149+ subject . emails
150+ expect ( access_token . options [ :mode ] ) . to eq ( :header )
151+ end
136152 end
137153
138154 context '#info.email' do
You can’t perform that action at this time.
0 commit comments