Skip to main content

Class: HttpClientWatcher

Defined in: watchers/http-client.watcher.ts:95

Implements​

  • OnModuleInit
  • OnModuleDestroy

Constructors​

Constructor​

new HttpClientWatcher(collector, nestlensConfig, axiosInstance?): HttpClientWatcher

Defined in: watchers/http-client.watcher.ts:104

Parameters​

collector​

CollectorService

nestlensConfig​

NestLensConfig

axiosInstance?​

unknown

Returns​

HttpClientWatcher

Methods​

onModuleDestroy()​

onModuleDestroy(): void

Defined in: watchers/http-client.watcher.ts:197

Takes the interceptors back off.

They live on an axios instance the application owns and keeps, so closing the module has to remove them. Otherwise the host goes on recording through a watcher whose collector is gone — and a process that builds the module more than once against the same instance, as tests and nest start --hmr do, installs another pair each round: measured at three lifecycles, three request interceptors and three response interceptors on one instance.

Returns​

void

Implementation of​

OnModuleDestroy.onModuleDestroy


onModuleInit()​

onModuleInit(): void

Defined in: watchers/http-client.watcher.ts:117

Returns​

void

Implementation of​

OnModuleInit.onModuleInit


setupInterceptors()​

setupInterceptors(axiosInstance): void

Defined in: watchers/http-client.watcher.ts:138

Setup interceptors on an axios instance. Can be called manually if you want to track a specific axios instance.

Parameters​

axiosInstance​

unknown

Returns​

void