@@ -9,18 +9,18 @@ import {
99} from '../../interfaces' ;
1010import { CACHE_KEY_METADATA , CACHE_MANAGER } from '../cache.constants' ;
1111
12- const APPLICATION_REFERENCE_HOST = 'ApplicationReferenceHost ' ;
12+ const HTTP_ADAPTER_HOST = 'HttpAdapterHost ' ;
1313const REFLECTOR = 'Reflector' ;
1414
15- export interface ApplicationHost < T extends HttpServer = any > {
16- applicationRef : T ;
15+ export interface HttpAdapterHost < T extends HttpServer = any > {
16+ httpAdapter : T ;
1717}
1818
1919@Injectable ( )
2020export class CacheInterceptor implements NestInterceptor {
2121 @Optional ( )
22- @Inject ( APPLICATION_REFERENCE_HOST )
23- protected readonly applicationHost : ApplicationHost ;
22+ @Inject ( HTTP_ADAPTER_HOST )
23+ protected readonly httpAdapterHost : HttpAdapterHost ;
2424
2525 constructor (
2626 @Inject ( CACHE_MANAGER ) protected readonly cacheManager : any ,
@@ -49,16 +49,16 @@ export class CacheInterceptor implements NestInterceptor {
4949 }
5050
5151 trackBy ( context : ExecutionContext ) : string | undefined {
52- const httpServer = this . applicationHost . applicationRef ;
53- const isHttpApp = httpServer && ! ! httpServer . getRequestMethod ;
52+ const httpAdapter = this . httpAdapterHost . httpAdapter ;
53+ const isHttpApp = httpAdapter && ! ! httpAdapter . getRequestMethod ;
5454
5555 if ( ! isHttpApp ) {
5656 return this . reflector . get ( CACHE_KEY_METADATA , context . getHandler ( ) ) ;
5757 }
5858 const request = context . getArgByIndex ( 0 ) ;
59- if ( httpServer . getRequestMethod ( request ) !== 'GET' ) {
59+ if ( httpAdapter . getRequestMethod ( request ) !== 'GET' ) {
6060 return undefined ;
6161 }
62- return httpServer . getRequestUrl ( request ) ;
62+ return httpAdapter . getRequestUrl ( request ) ;
6363 }
6464}
0 commit comments