Miscellaneous

request

Performs a structured HTTP request and yields until completion.

Related to sUNC documentation

This page follows the official sUNC reference.

Signature

Luau
function request(options: RequestOptions): Response

Returns

A structured Response table.

RequestOptions

Luau
type RequestOptions = { Url: string, Method: "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "OPTIONS" | "PATCH", Body: string?, Headers: { [string]: string }?, Cookies: { [string]: string }? }
NameTypeDescription
Urlstring

The target URL.

Methodstring

The HTTP method.

Bodystring?

The optional request payload.

Headers{ [string]: string }?

Optional request headers.

Cookies{ [string]: string }?

Optional request cookies.

Response

Luau
type Response = { Success: boolean, Body: string, StatusCode: number, StatusMessage: string, Headers: { [string]: string } }
NameTypeDescription
Successboolean

Whether the request succeeded.

Bodystring

The response body.

StatusCodenumber

The numeric HTTP status code.

StatusMessagestring

The human-readable status description.

Headers{ [string]: string }

The response headers.