Setu-TS
    Preparing search index...

    Function createHttpIndicator

    • Creates an HTTP probe indicator.

      This indicator performs an HTTP GET request to the specified URL and reports 'up' if the response status is 2xx or 3xx, 'down' otherwise. The request is aborted after timeoutMs via the web-standard AbortSignal.timeout, so the indicator needs no runtime services and can be constructed at app-registration time. Per-indicator latency is measured by the health service, not here.

      The fetcher option allows injecting a custom fetch implementation for testing purposes.

      Parameters

      Returns IHealthIndicator

      An indicator that probes an HTTP endpoint

      const indicator = createHttpIndicator('external-api', {
      url: 'https://api.example.com/health',
      timeoutMs: 3000,
      });
      app.register(HealthPlugin({
      indicators: [indicator],
      }));

      0.2.0