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 bodyNo fixed Kawaii limitThe complete body is buffered before the call returns, so available memory and the deadlines below still apply. A failed read raises an error rather than returning a truncated body.
Content encodingNo fixed layer count or decoding budgetgzip, deflate, and identity are supported. An unsupported or malformed encoding raises an error.
Active requests64 across the processAnother request raises an error until one of them finishes. HTTP calls from every script share this count.
Redirects10 per requestOne more redirect raises an error.
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 transport 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