Appearance
@loontail/minecraft-kit v0.8.14 / HttpRequestOptions
Type alias: HttpRequestOptions
ts
type HttpRequestOptions: {
acceptNonOk: boolean;
body: HttpRequestBody;
headers: HttpHeaders;
method: HttpMethod;
noCache: boolean;
signal: AbortSignal;
timeoutMs: number;
};Options for an HTTP request.
Example
ts
import type { HttpClient, HttpRequestOptions } from "@loontail/minecraft-kit";
const fetchJson = (http: HttpClient, url: string, signal: AbortSignal) => {
const options: HttpRequestOptions = { signal, timeoutMs: 30_000 };
return http.request(url, options).then((r) => r.json());
};Type declaration
| Member | Type | Description |
|---|---|---|
acceptNonOk | boolean | When true, the client returns the response even for non-2xx statuses instead of throwing. Useful for callers that must inspect the body of error responses (e.g. OAuth polling endpoints that return 400 with structured JSON like {"error":"authorization_pending"}). |
body | HttpRequestBody | Request body. Ignored for GET. |
headers | HttpHeaders | - |
method | HttpMethod | HTTP method. Defaults to GET. |
noCache | boolean | When true, do not consult the in-memory cache. |
signal | AbortSignal | - |
timeoutMs | number | - |