Skip to content
BasaltSoftware
Bedrock 1.26.60

Site colour

Discord
Esc

    ↑↓ moveEnter openEsc close

    Keyboard shortcuts
    Ctrl K
    Search the whole site, from any page
    /
    Jump to the sidebar search, or search the whole site where there isn't one
    Enter
    Open the top search result
    Esc
    Clear the search, or close this panel
    ?
    Show these shortcuts

    Class in @minecraft/server-net

    Makes HTTP requests. Use http.

    import { HttpClient } from '@minecraft/server-net';
    import { http, HttpError, type HttpResponse } from '@minecraft/server-net';
    async function fetchStatus(): Promise<void> {
    try {
    const response: HttpResponse = await http.get('https://example.com/status.json');
    console.log(response.status, response.body);
    } catch (error) {
    if (error instanceof HttpError) console.warn(`Request failed: ${error.reason}`);
    else throw error;
    }
    }
    fetchStatus();
    import { http, HttpError } from '@minecraft/server-net';
    async function fetchStatus() {
    try {
    const response = await http.get('https://example.com/status.json');
    console.log(response.status, response.body);
    }
    catch (error) {
    if (error instanceof HttpError)
    console.warn(`Request failed: ${error.reason}`);
    else
    throw error;
    }
    }
    fetchStatus();
    cancelAll(reason: string): void;

    Abandons every request in flight; their promises reject with reason as the message.

    Parameters
    reason
    string
    get(uri: string): Promise<HttpResponse>;

    A GET request for uri.

    Parameters
    uri
    string
    Returns
    Promise<HttpResponse>
    request(config: HttpRequest): Promise<HttpResponse>;

    Sends a request, resolving with its answer whatever the status, or rejecting with an HttpError when none comes.

    Parameters
    config
    HttpRequest
    Returns
    Promise<HttpResponse>