Skip to content

Search documentation

Enter at least two characters.

    HttpHeader

    SDK 0.1.0-preview.1 · ExperimentalDownload & release notes ↗

    A single HTTP header name and value.

    This client fragment needs a running endpoint. The complete local HTTP recipe starts its own server and avoids a fixed port.

    Where to put it: replace Src/Main.luau in a project created with this SDK. This is the complete entry file.

    Project setup: add network.client to Capabilities in lui.json. See the capability guide.

    local Window = Instance.new("Window", {
    Title = "LUI example", Size = UDim2.fromOffset(560, 280),
    })
    local Status = Instance.new("TextLabel", {
    Parent = Window, Text = "Ready", Position = UDim2.fromOffset(16, 170),
    Size = UDim2.new(1, -32, 0, 72),
    })
    local Button = Instance.new("TextButton", {
    Parent = Window, Text = "Try it", Size = UDim2.fromOffset(220, 44),
    Position = UDim2.fromOffset(16, 16),
    })
    Button.Text = "Request local status"
    Button.Activated:Connect(function()
    task.spawn(function()
    local Ok, Response = pcall(function()
    return app:GetService("HttpService"):RequestAsync({
    Url = "http://127.0.0.1:8080/status", TimeoutMs = 3000,
    MaxResponseBytes = 4096,
    })
    end)
    if not Ok then Status.Text = "Request could not complete"; return end
    Status.Text = "HTTP " .. Response.StatusCode .. ": " .. Response.Body
    end)
    end)
    Window.Visible = true

    Expected result: With a local server on port 8080, pressing the button displays its status/body. Without one, it reports request failure without a dialog.

    For source, manifest, pin and assets together, use the complete practical recipe.

    Header field name, such as Content-Type. Repeated names can appear as separate records.

    Type: string. Read-only.

    Header field value. Do not insert a raw HTTP header line or newline characters.

    Type: string. Read-only.

    Full type declaration — for type checking and deeper reference

    The declaration is generated from the SDK. Self is supplied by a colon call; read means the field cannot be assigned. See how to read this reference.

    export type HttpHeader = {
    read Name: string,
    read Value: string,
    }

    See platform limits before relying on host-specific behavior. The framework design specification and reflection/type sources are deeper engineering references, not extra setup required to build an app.