@@ -182,10 +182,10 @@ OAuthClient.prototype.createToken = function createToken(uri) {
182
182
resolve ( this . getTokenRequest ( request ) ) ;
183
183
} )
184
184
. then ( ( res ) => {
185
- const authResponse = res . json ? res : null ;
185
+ const authResponse = res . hasOwnProperty ( ' json' ) ? res : null ;
186
186
const json = ( authResponse && authResponse . json ) || res ;
187
187
this . token . setToken ( json ) ;
188
- this . log ( 'info' , 'Create Token response is : ' , JSON . stringify ( authResponse && authResponse . json , null , 2 ) ) ;
188
+ this . log ( 'info' , 'Create Token response is : ' , JSON . stringify ( authResponse && authResponse . json , null , 2 ) ) ;
189
189
return authResponse ;
190
190
} )
191
191
. catch ( ( e ) => {
@@ -223,7 +223,7 @@ OAuthClient.prototype.refresh = function refresh() {
223
223
resolve ( this . getTokenRequest ( request ) ) ;
224
224
} )
225
225
. then ( ( res ) => {
226
- const authResponse = res . json ? res : null ;
226
+ const authResponse = res . hasOwnProperty ( ' json' ) ? res : null ;
227
227
const json = ( authResponse && authResponse . json ) || res ;
228
228
this . token . setToken ( json ) ;
229
229
this . log ( 'info' , 'Refresh Token () response is : ' , JSON . stringify ( authResponse && authResponse . json , null , 2 ) ) ;
@@ -265,7 +265,7 @@ OAuthClient.prototype.refreshUsingToken = function refreshUsingToken(refresh_tok
265
265
resolve ( this . getTokenRequest ( request ) ) ;
266
266
} )
267
267
. then ( ( res ) => {
268
- const authResponse = res . json ? res : null ;
268
+ const authResponse = res . hasOwnProperty ( ' json' ) ? res : null ;
269
269
const json = ( authResponse && authResponse . json ) || res ;
270
270
this . token . setToken ( json ) ;
271
271
this . log (
@@ -315,7 +315,7 @@ OAuthClient.prototype.revoke = function revoke(params) {
315
315
resolve ( this . getTokenRequest ( request ) ) ;
316
316
} )
317
317
. then ( ( res ) => {
318
- const authResponse = res . json ? res : null ;
318
+ const authResponse = res . hasOwnProperty ( ' json' ) ? res : null ;
319
319
this . token . clearToken ( ) ;
320
320
this . log ( 'info' , 'Revoke Token () response is : ' , JSON . stringify ( authResponse && authResponse . json , null , 2 ) ) ;
321
321
return authResponse ;
@@ -349,7 +349,7 @@ OAuthClient.prototype.getUserInfo = function getUserInfo() {
349
349
resolve ( this . getTokenRequest ( request ) ) ;
350
350
} )
351
351
. then ( ( res ) => {
352
- const authResponse = res . json ? res : null ;
352
+ const authResponse = res . hasOwnProperty ( ' json' ) ? res : null ;
353
353
this . log (
354
354
'info' ,
355
355
'The Get User Info () response is : ' , JSON . stringify ( authResponse && authResponse . json , null , 2 ) ,
0 commit comments