import { ExecutionContext , Injectable } from '@nestjs/common' ; import { HttpInterceptorService } from '@ogma/nestjs-module' ; import { Request } from 'express' ; @ Injectable ( ) export class ExpressParser extends HttpInterceptorService { getCallerIp ( context ) { const req = this . getRequest ( context ) ; return req . ips . length ? req . ips . join ( ' ' ) : req . ip ; } getCallPoint ( context ) { const req = this . getRequest ( context ) ; return req . originalUrl ; } getMethod ( context ) { const req = this . getRequest ( context ) ; const method = req . method ; return method || 'GET' ; } getProtocol ( context ) { const req = this . getRequest ( context ) ; return `HTTP/${ this . getHttpMajor ( req ) }.${ this . getHttpMinor ( req ) }` ; } setRequestId ( context , requestId ) { const req = this . getRequest ( context ) as any ; req . requestId = requestId ; } private getHttpMajor ( req ) { return req . httpVersionMajor ; } private getHttpMinor ( req ) { return req . httpVersionMinor ; } getRequest ( context ) { return super . getRequest ( context ) ; } }