@@ -34,7 +34,14 @@ export class APIClientService {
3434 if ( ! this . debugMode ) return
3535 const request = Object . assign ( { } , {
3636 url, path, body,
37- } )
37+ } ) as any
38+ if ( request . body && Object . keys ( request . body ) . length > 0 ) {
39+ Object . keys ( request . body ) . forEach ( key => {
40+ if ( ! request . body [ key ] ) return
41+ if ( / T o k e n / . test ( key ) && request . body [ key ] ) request . body [ key ] = '=== SECRET ==='
42+ if ( / p a s s w o r d / . test ( key . toLocaleLowerCase ( ) ) && request . body [ key ] ) request . body [ key ] = '=== SECRET ==='
43+ } )
44+ }
3845 console . log ( {
3946 request,
4047 } )
@@ -49,6 +56,7 @@ export class APIClientService {
4956 const data = Object . assign ( { } , result . data ) as any
5057 Object . keys ( data ) . forEach ( key => {
5158 if ( / T o k e n / . test ( key ) && data [ key ] ) data [ key ] = '=== SECRET ==='
59+ if ( / p a s s w o r d / . test ( key . toLocaleLowerCase ( ) ) && data [ key ] ) data [ key ] = '=== SECRET ==='
5260 } )
5361 return data
5462 } ) ( )
@@ -63,7 +71,7 @@ export class APIClientService {
6371
6472 protected async _post ( path : string , body ?: object , config ?: AxiosRequestConfig ) {
6573 const url = pathJoin ( this . endpoint , path )
66- this . _recordAxiosRequest ( url , path , config , body )
74+ this . _recordAxiosRequest ( url , path , config , { ... body } )
6775 const result = await axios . post ( url , body , config )
6876 this . _recordAxiosResponse ( result )
6977 return result . data
0 commit comments