'set global ( module level ) interceptor in nestjs/ axios HttpModule

how can I add an interceptor for logging outgoing requests? I know I can add it per instance of HttpService like this:

this.httpService.axiosRef.interceptors.request.use((config) => ...)

But I want to add it once, that's why I'm asking if there's a way to add it at the module level - I saw there is an option to add configuration to the module like this:

imports: [HttpModule.register({...})]

there is anyone knows how can I config the interceptor this way? thanks in advance.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source