import Context from "../Context" ; import IResponse from "../IResponse" ; import ILogger from "../utils/ILogger" ; export param { Context } context param { Request } req param { Response } res param { ILogger } logger export default function endMiddleware ( context , res , logger ) { const totalTimeInMS = context . startTime ? new Date ( ) . getTime ( ) - context . startTime . getTime ( ) : undefined ; logger . info ( `EndMiddleware: End response. TotalTimeInMS=${ totalTimeInMS } StatusCode=${ res . getStatusCode ( ) } StatusMessage=${ res . getStatusMessage ( ) } Headers=${ JSON . stringify ( res . getHeaders ( ) ) }` , context . contextId ) ; res . getBodyStream ( ) . end ( ) ; }