Utilities

HttpGet

Sends a GET request and returns the response body.

Syntax

HttpGet(context: any, url: string, cache?: boolean | number): string

Arguments

NameTypeDescription
contextanySelf or context argument supplied when calling method-style helpers.
urlstringHTTP or WebSocket URL to connect to.
cache?boolean | numberBoolean option that enables or disables this behavior.

Returns

NameTypeDescription
bodystringHTTP response body.

Description

Sends a GET request and returns the response body.

Call it with 3 parameter(s): context, url, cache. The argument table explains which values are required and which ones only refine the behavior.

It returns body (string). Use the returns table to separate successful values from nil results and recoverable errors.

Example

Example call with placeholder values.

local result = HttpGet(nil, "example", true)
print(result)