77 VulcanInternalExtension ,
88} from '../../models/extensions' ;
99import axios , { AxiosRequestHeaders } from 'axios' ;
10- import { ConnectionConfig } from '../utils/url' ;
10+ import { ConnectionConfig , getUrl } from '../utils/url' ;
1111
1212export interface HttpLoggerConfig {
1313 connection ?: HttpLoggerConnectionConfig ;
@@ -29,7 +29,7 @@ export class HttpLogger extends BaseActivityLogger<HttpLoggerConfig> {
2929 throw new Error ( 'Http logger connection should be provided' ) ;
3030 }
3131 const headers = option . connection . headers ;
32- const url = this . getUrl ( option . connection ) ;
32+ const url = getUrl ( option . connection ) ;
3333 try {
3434 // get connection info from option and use axios to send a post requet to the endpoint
3535 await this . sendActivityLog ( url , payload , headers ) ;
@@ -42,20 +42,13 @@ export class HttpLogger extends BaseActivityLogger<HttpLoggerConfig> {
4242 }
4343 }
4444
45- protected sendActivityLog = async (
45+ protected async sendActivityLog (
4646 url : string ,
4747 payload : any ,
4848 headers : AxiosRequestHeaders | undefined
49- ) : Promise < void > => {
49+ ) : Promise < void > {
5050 await axios . post ( url , payload , {
5151 headers : headers ,
5252 } ) ;
53- } ;
54-
55- protected getUrl = ( connection : HttpLoggerConnectionConfig ) : string => {
56- const { ssl, host, port, path = '' } = connection ;
57- const protocol = ssl ? 'https' : 'http' ;
58- const urlbase = `${ protocol } ://${ host } :${ port } ` ;
59- return new URL ( path , urlbase ) . href ;
60- } ;
53+ }
6154}
0 commit comments