16
16
*/
17
17
18
18
import ee , { Emitter } from 'event-emitter' ;
19
- import superagent , { Response } from 'superagent' ;
19
+ import superagent , { Response , SuperAgentRequest } from 'superagent' ;
20
20
import { Authentication } from './authentication/authentication' ;
21
21
import { RequestOptions , HttpClient , SecurityOptions , Emitters } from './api-clients/http-client.interface' ;
22
22
import { Oauth2 } from './authentication/oauth2' ;
@@ -217,7 +217,7 @@ export class SuperagentHttpClient implements HttpClient {
217
217
return request ;
218
218
}
219
219
220
- setCsrfToken ( request : any ) : void {
220
+ setCsrfToken ( request : SuperAgentRequest ) : void {
221
221
const token = SuperagentHttpClient . createCSRFToken ( ) ;
222
222
request . set ( 'X-CSRF-TOKEN' , token ) ;
223
223
@@ -236,13 +236,13 @@ export class SuperagentHttpClient implements HttpClient {
236
236
* Applies authentication headers to the request.
237
237
* @param {Object } request The request object created by a <code>superagent()</code> call.
238
238
*/
239
- private applyAuthToRequest ( request : any , authentications : Authentication ) {
239
+ private applyAuthToRequest ( request : SuperAgentRequest , authentications : Authentication ) {
240
240
if ( authentications ) {
241
241
switch ( authentications . type ) {
242
242
case 'basic' : {
243
243
const basicAuth : BasicAuth = authentications . basicAuth ;
244
244
if ( basicAuth . username || basicAuth . password ) {
245
- request . auth ( basicAuth . username ? encodeURI ( basicAuth . username ) : '' , basicAuth . password ? encodeURI ( basicAuth . password ) : '' ) ;
245
+ request . auth ( basicAuth . username || '' , basicAuth . password || '' ) ;
246
246
}
247
247
break ;
248
248
}
@@ -292,7 +292,7 @@ export class SuperagentHttpClient implements HttpClient {
292
292
* all properties on <code>data<code> will be converted to this type.
293
293
* @returns A value of the specified type.
294
294
*/
295
- private static deserialize ( response : any , returnType ?: any ) : any {
295
+ private static deserialize ( response : Response , returnType ?: any ) : any {
296
296
if ( response === null ) {
297
297
return null ;
298
298
}
0 commit comments