New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@betsys-nestjs/http-client

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@betsys-nestjs/http-client

HTTP client for NestJS applications

  • 2.0.10
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-77.78%
Maintainers
4
Weekly downloads
 
Created
Source

@betsys/nestjs-http-client

This is a simple wrapper module built around @nestjs/axios. It adds prometheus monitoring and logging to all outgoing HTTP calls.

Dependencies

For this module to work, you need to install the following peer dependencies:

PackageVersion
@nestjs/common^7.0.0 || ^8.0.0
@betsys/nestjs-logger^0.0.5
@betsys/nestjs-monitoring^0.0.5
reflect-metadata^0.1.12
rxjs^7.1.0

Usage

The basic usage is similar to the @nestjs/axios module. You use the HttpClientService to make HTTP requests.

@Injectable()
export class CatsService {
  constructor(private httpService: HttpClientService) {}

  findAll(): Observable<AxiosResponse<Cat[]>> {
    return this.httpService.get('http://localhost:3000/cats');
  }
}

You need to import HttpClient module to use the HttpClientService. Both register and registerAsync are available:

@Module({
  imports: [
    HttpModule.register({
      timeout: 5000,
      maxRedirects: 5,
    }),
  ],
  providers: [CatsService],
})
export class CatsModule {}

In additional to params accepted by @nestjs/axios module, you can define if logging should be enabled, and you can choose from two logging levels:

  • HttpClientLogLevel.Info, logs basic request and response information
  • HttpClientLogLevel.Full, logs detailed request and response information (including headers, body, etc.)
@Module({
  imports: [
    HttpModule.register({
      log: true, // default true
      logLevel: HttpClientLogLevel.Info, // default 'HttpClientLogLevel.Info'
    }),
  ],
  providers: [CatsService],
})
export class CatsModule {}

FAQs

Package last updated on 20 Jan 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc