HttpResponse
The completed HTTP response, including status, headers, trailers and body.
Example
Section titled “Example”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 = trueExpected 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.
Properties
Section titled “Properties”StatusCode
Section titled “StatusCode”HTTP status number, such as 200 or 404.
Type: number. Read-only.
StatusMessage
Section titled “StatusMessage”HTTP reason phrase when supplied by the response.
Type: string. Read-only.
Success
Section titled “Success”Whether the completed status is successful. A 404 response is still a completed HTTP exchange.
Type: boolean. Read-only.
Response body as a string; decode JSON explicitly when appropriate.
Type: string. Read-only.
Headers
Section titled “Headers”List of response header records, preserving repeated fields.
Type: {HttpHeader}. Read-only.
Trailers
Section titled “Trailers”Trailer fields received after a chunked body, separate from initial headers.
Type: {HttpHeader}. 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 HttpResponse = { read StatusCode: number, read StatusMessage: string, read Success: boolean, read Body: string, read Headers: {HttpHeader}, read Trailers: {HttpHeader},}Availability and deeper reading
Section titled “Availability and deeper reading”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.