Appearance
@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
| Member | Type | Description |
|---|---|---|
headers | HttpHeaders | - |
status | number | - |
url | string | - |
bytes | Promise<Uint8Array> | - |
json | Promise<T> | - |
stream | AsyncIterable<Uint8Array> | Stream the body. The stream may be consumed at most once. |
text | Promise<string> | - |