nestjs/terminus

Allow custom `HttpService` to be passed into `@nestjs/terminus`

jdurnell-rbi opened this issue · 1 comments

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

The HttpHealthIndicator does not provide any option to pass in the HttpService, which effectively means that you have to use @nestjs/axios. My company uses a custom http client that has additional diagnostics (i.e. logging) built in to help us troubleshoot when HTTP requests fail. We would like to use the HttpHealthIndicator, but without the option of passing in our own custom HttpService, our only option is to write our own indicator class.

Describe the solution you'd like

I feel like it kind of defeats the point of NestJS's IoC theme to take a hard dependency on the @nestjs/axios module. It would be nice if there was at least an option to pass in a custom service. The code could always fallback on @nestjs/axios if a custom HttpService wasn't provided (or possibly better, leave it up to the dev to configure which service to use in the module definition.)

Teachability, documentation, adoption, migration strategy

This would make it easier for larger organizations that may have more complex requirements around monitoring & diagnostics to use the @nestjs/terminus module.

What is the motivation / use case for changing the behavior?

Allow users to specify a custom implementation for HttpService

I think this functionality is provided via #1151. Closing ticket.