import { CacheInterceptor , ExecutionContext , Injectable } from '@nestjs/common' ; @ Injectable ( ) class HttpCacheInterceptor extends CacheInterceptor { trackBy ( context ) { const request = context . switchToHttp ( ) . getRequest ( ) ; const httpServer = request . applicationRef ; const isGetRequest = httpServer . getRequestMethod ( request ) === 'GET' ; const excludePaths = [ ] ; if ( ! isGetRequest || ( isGetRequest && excludePaths . includes ( httpServer . getRequestUrl ) ) ) { return undefined ; } return httpServer . getRequestUrl ( request ) ; } }