Skip to main content
nestrs-http is the Rust analogue of NestJS’s @nestjs/axios. It exposes a singleton reqwest::Client with bounded default timeouts and the standard HttpModule boot shape.

Install

The http-client feature on the umbrella re-exports the nestrs-http types so existing code (nestrs::HttpService, HttpServiceOptions, HttpModule) keeps compiling unchanged.

Why default timeouts matter

reqwest has no default timeout. Without an outbound deadline, a TCP-connected but unresponsive upstream hangs the calling handler’s future forever and concurrent hung calls accumulate until the runtime is saturated. HttpService enforces a 30s whole-request / 10s connect default — tunable per-deployment via HttpServiceOptions.

Boot

The HttpService is injectable — resolve it through the DI container the same way you would nestrs::MongoService.

Configuration

DEFAULT_REQUEST_TIMEOUT (30 s) and DEFAULT_CONNECT_TIMEOUT (10 s) are public constants — tests and docs can assert against them.

API surface

Feature flags

  • default = [] — base crate.
  • reqwest — re-exports reqwest at the crate root so callers don’t add a direct dep.