Appearance
@loontail/minecraft-kit v0.8.14 / HttpClient
Type alias: HttpClient
ts
type HttpClient: {
request: Promise<HttpResponse>;
};Pluggable HTTP client. The default implementation uses Node's built-in fetch; consumers can inject a fake (e.g. for tests) by passing an httpClient to the MinecraftKit constructor.
Example
ts
import { MinecraftKit, type HttpClient } from "@loontail/minecraft-kit";
const fakeHttp: HttpClient = {
request: async (url) => ({
status: 200, headers: {}, url, text: async () => "{}", json: async () => ({}),
bytes: async () => new Uint8Array(), stream: async function* () {},
}),
};
const kit = new MinecraftKit({ httpClient: fakeHttp });Type declaration
| Member | Type |
|---|---|
request | Promise<HttpResponse> |