interface IDiscoveryHttp
Since 0.2.0

The HTTP surface the Consul and Kubernetes providers need.

One seam with two methods rather than two seams: both providers need both a buffered read and a streaming one. Injecting it is also the documented escape hatch for a caller-supplied TLS configuration — an in-cluster Kubernetes API server presents a CA that plain fetch rejects.

Methods

request(
url: string,
): Promise<DiscoveryHttpResponse>

Performs a request and reads the whole body.

A non-2xx response is returned with ok: false, never thrown — callers decide what a 404 or a 410 means.

stream(
url: string,
): Promise<DiscoveryHttpStream>

Performs a request and leaves the body unread.

Usage

import { type IDiscoveryHttp } from "service-discovery-plugin/src/index.ts";