httpget Asynchronous

  • HttpGet

Fetch a URL and return just its response body. Reach for request when you also need the status code, headers, or a non-GET method.

Syntax
Luau
httpget(url: string, bypassCache: boolean?) -> string

httpget(game: DataModel, url: string, bypassCache: boolean?) -> string

Parameters · overload 1

Function parameters
ParameterTypeDescription
urlstringURL to fetch.
bypassCacheboolean?Optional flag passed to the host GET method.

Parameters · overload 2

Function parameters
ParameterTypeDescription
gameDataModelDataModel receiver in the alternate game:HttpGet call form.
urlstringURL to fetch.
bypassCacheboolean?Optional flag passed to the host GET method.

Returns

string

The response body as a string.

Usage notes

An unsuccessful HTTP status or transport error raises instead of returning a response record. Keep optional downloads inside pcall.

Limits

ResourceLimitWhat happens
Response body8 MiB of wire data and 8 MiB at each decoding stageThe call raises an error when any stage exceeds the limit. It does not return a truncated body.
Content encodingUp to 3 encoding layers; 16 MiB of cumulative decoded outputgzip, deflate, and identity are supported. Unsupported encodings or an exhausted decoding budget raise an error.
Concurrent response readers4 across the processAn additional response read fails immediately while all readers are busy. This is not a four-request limit.
Transport deadlines30 seconds to connect, 60 seconds for a read, 90 seconds totalA timeout raises an error. A per-request Timeout option is not supported.

Use pcall to handle transport errors, rejected response decoding, and unsuccessful HTTP statuses. These response-reader limits are shared with request. Use request when you need the status and headers as a record.

Example

Example
Luau
local ok, body = pcall(httpget, "https://example.com/")
if ok then
    print(body)
else
    warn("Download failed:", body)
end
Kawaii documentation