@minecraft/server-net
    Preparing search index...

    Class HttpHeaderBeta

    Represents an HTTP header - a key/value pair of meta-information about a request.

    import { HttpRequest, HttpHeader, HttpRequestMethod, http } from '@minecraft/server-net';

    async function updateScore() {
    const req = new HttpRequest('http://localhost:3000/updateScore');

    req.body = JSON.stringify({
    score: 22,
    });

    req.method = HttpRequestMethod.Post;
    req.headers = [
    new HttpHeader('Content-Type', 'application/json'),
    new HttpHeader('auth', 'my-auth-token'),
    ];

    await http.request(req);
    }
    Index

    Constructors

    Properties

    Constructors

    • Beta

      Parameters

      • key: string
      • value: string | SecretString

      Returns HttpHeader

    Properties

    key: string

    Key of the HTTP header.

    This property can be edited in early-execution mode.

    value: string | SecretString

    Value of the HTTP header.

    This property can be edited in early-execution mode.