@@ -1042,7 +1042,7 @@ module.exports = (issuer, aadIssValidation = false) => class Client extends Base
10421042
10431043 return request . call ( this , {
10441044 ...requestOpts ,
1045- encoding : null ,
1045+ responseType : 'buffer' ,
10461046 method,
10471047 url : resourceUrl ,
10481048 } , { mTLS } ) ;
@@ -1071,8 +1071,7 @@ module.exports = (issuer, aadIssValidation = false) => class Client extends Base
10711071 throw new TypeError ( 'can only send body on POST' ) ;
10721072 }
10731073
1074- const jwt = ! ! ( this . userinfo_signed_response_alg
1075- || this . userinfo_encrypted_response_alg ) ;
1074+ const jwt = ! ! ( this . userinfo_signed_response_alg || this . userinfo_encrypted_response_alg ) ;
10761075
10771076 if ( jwt ) {
10781077 options . headers = { Accept : 'application/jwt' } ;
@@ -1155,11 +1154,7 @@ module.exports = (issuer, aadIssValidation = false) => class Client extends Base
11551154 try {
11561155 parsed = JSON . parse ( response . body ) ;
11571156 } catch ( error ) {
1158- const parseError = new ParseError (
1159- error , response . statusCode , response . request . gotOptions , response . body ,
1160- ) ;
1161- Object . defineProperty ( parseError , 'response' , { value : response } ) ;
1162- throw parseError ;
1157+ throw new ParseError ( error , response ) ;
11631158 }
11641159 }
11651160
@@ -1239,9 +1234,8 @@ module.exports = (issuer, aadIssValidation = false) => class Client extends Base
12391234 this ,
12401235 'token' ,
12411236 {
1242- form : true ,
1243- body,
1244- json : true ,
1237+ form : body ,
1238+ responseType : 'json' ,
12451239 } ,
12461240 { clientAssertionPayload } ,
12471241 ) ;
@@ -1269,9 +1263,8 @@ module.exports = (issuer, aadIssValidation = false) => class Client extends Base
12691263 this ,
12701264 'device_authorization' ,
12711265 {
1272- form : true ,
1273- body,
1274- json : true ,
1266+ responseType : 'json' ,
1267+ form : body ,
12751268 } ,
12761269 { clientAssertionPayload, endpointAuthMethod : 'token' } ,
12771270 ) ;
@@ -1296,17 +1289,16 @@ module.exports = (issuer, aadIssValidation = false) => class Client extends Base
12961289 throw new TypeError ( 'hint must be a string' ) ;
12971290 }
12981291
1299- const body = { ...revokeBody , token } ;
1292+ const form = { ...revokeBody , token } ;
13001293
13011294 if ( hint ) {
1302- body . token_type_hint = hint ;
1295+ form . token_type_hint = hint ;
13031296 }
13041297
13051298 const response = await authenticatedPost . call (
13061299 this ,
13071300 'revocation' , {
1308- body,
1309- form : true ,
1301+ form,
13101302 } , { clientAssertionPayload } ,
13111303 ) ;
13121304 processResponse ( response , { body : false } ) ;
@@ -1322,15 +1314,15 @@ module.exports = (issuer, aadIssValidation = false) => class Client extends Base
13221314 throw new TypeError ( 'hint must be a string' ) ;
13231315 }
13241316
1325- const body = { ...introspectBody , token } ;
1317+ const form = { ...introspectBody , token } ;
13261318 if ( hint ) {
1327- body . token_type_hint = hint ;
1319+ form . token_type_hint = hint ;
13281320 }
13291321
13301322 const response = await authenticatedPost . call (
13311323 this ,
13321324 'introspection' ,
1333- { body , form : true , json : true } ,
1325+ { form, responseType : 'json' } ,
13341326 { clientAssertionPayload } ,
13351327 ) ;
13361328
@@ -1443,8 +1435,8 @@ module.exports = (issuer, aadIssValidation = false) => class Client extends Base
14431435 headers : initialAccessToken ? {
14441436 Authorization : authorizationHeaderValue ( initialAccessToken ) ,
14451437 } : undefined ,
1446- json : true ,
1447- body : metadata ,
1438+ responseType : 'json' ,
1439+ json : metadata ,
14481440 url : this . issuer . registration_endpoint ,
14491441 method : 'POST' ,
14501442 } ) ;
@@ -1473,7 +1465,7 @@ module.exports = (issuer, aadIssValidation = false) => class Client extends Base
14731465 const response = await request . call ( this , {
14741466 method : 'GET' ,
14751467 url : registrationClientUri ,
1476- json : true ,
1468+ responseType : 'json' ,
14771469 headers : { Authorization : authorizationHeaderValue ( registrationAccessToken ) } ,
14781470 } ) ;
14791471 const responseBody = processResponse ( response , { bearer : true } ) ;
0 commit comments