Skip to content

@loontail/minecraft-kit v0.8.14 / HttpResponse

Type alias: HttpResponse

ts
type HttpResponse: {
  headers: HttpHeaders;
  status: number;
  url: string;
  bytes: Promise<Uint8Array>;
  json: Promise<T>;
  stream: AsyncIterable<Uint8Array>;
  text: Promise<string>;
};

Response delivered by the HttpClient interface.

Example

ts
import type { HttpClient, HttpResponse } from "@loontail/minecraft-kit";

const fetchManifest = async (http: HttpClient): Promise<unknown> => {
  const response: HttpResponse = await http.request("https://example.com/manifest.json");
  return response.json();
};

Type declaration

MemberTypeDescription
headersHttpHeaders-
statusnumber-
urlstring-
bytesPromise<Uint8Array>-
jsonPromise<T>-
streamAsyncIterable<Uint8Array>Stream the body. The stream may be consumed at most once.
textPromise<string>-

Source

src/types/http.ts:27

MIT License