Miscellaneous
request
Performs a structured HTTP request and yields until completion.
Related to sUNC documentation
This page follows the official sUNC reference.
Signature
function request(options: RequestOptions): ResponseReturns
A structured Response table.
RequestOptions
type RequestOptions = { Url: string, Method: "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "OPTIONS" | "PATCH", Body: string?, Headers: { [string]: string }?, Cookies: { [string]: string }? }| Name | Type | Description |
|---|---|---|
Url | string | The target URL. |
Method | string | The HTTP method. |
Body | string? | The optional request payload. |
Headers | { [string]: string }? | Optional request headers. |
Cookies | { [string]: string }? | Optional request cookies. |
Response
type Response = { Success: boolean, Body: string, StatusCode: number, StatusMessage: string, Headers: { [string]: string } }| Name | Type | Description |
|---|---|---|
Success | boolean | Whether the request succeeded. |
Body | string | The response body. |
StatusCode | number | The numeric HTTP status code. |
StatusMessage | string | The human-readable status description. |
Headers | { [string]: string } | The response headers. |