@@ -48,6 +48,7 @@ type GetResourceDataToolResponse = {
4848type DateTimeColumnType = AdminForthDataTypes . DATETIME | AdminForthDataTypes . TIME ;
4949
5050const DEFAULT_USER_TIME_ZONE = 'UTC' ;
51+ const DEFAULT_REQUEST_PROTOCOL = process . env . NODE_ENV === 'production' ? 'https' : 'http' ;
5152
5253function getInputString ( inputs : Record < string , unknown > | undefined , key : string ) {
5354 const value = inputs ?. [ key ] ;
@@ -618,7 +619,7 @@ function getRequestOrigin(httpExtra?: Partial<HttpExtra>) {
618619 return undefined ;
619620 }
620621
621- const protocol = getHeaderValue ( httpExtra ?. headers , 'x-forwarded-proto' ) ?? 'http' ;
622+ const protocol = getHeaderValue ( httpExtra ?. headers , 'x-forwarded-proto' ) ?? DEFAULT_REQUEST_PROTOCOL ;
622623 return `${ protocol } ://${ host } ` ;
623624}
624625
@@ -740,11 +741,13 @@ async function callOpenApiSchema(params: {
740741 toolName,
741742 } ) ;
742743 const hasRequestBody = ! METHODS_WITHOUT_REQUEST_BODY . has ( method ) ;
744+ logger . info ( `Calling OpenAPI tool "${ toolName } " with method ${ method } at URL ${ requestUrl } ` ) ;
743745 const response = await fetch ( hasRequestBody ? requestUrl : appendInputsToQueryString ( requestUrl , body ) , {
744746 method,
745747 headers : createToolRequestHeaders ( httpExtra , userTimeZone ) ,
746748 body : hasRequestBody ? JSON . stringify ( body ) : undefined ,
747749 } ) ;
750+ logger . info ( `Received response with status ${ response . status } from OpenAPI tool "${ toolName } "` ) ;
748751
749752 return parseOpenApiToolResponse ( response ) ;
750753}
0 commit comments