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.
Luau
httpget(url: string, bypassCache: boolean?) -> string
httpget(game: DataModel, url: string, bypassCache: boolean?) -> stringParameters · overload 1
| Parameter | Type | Description |
|---|---|---|
url | string | URL to fetch. |
bypassCache | boolean? | Optional flag passed to the host GET method. |
Parameters · overload 2
| Parameter | Type | Description |
|---|---|---|
game | DataModel | DataModel receiver in the alternate game:HttpGet call form. |
url | string | URL to fetch. |
bypassCache | boolean? | Optional flag passed to the host GET method. |
Returns
stringThe 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
| Resource | Limit | What happens |
|---|---|---|
| Response body | 8 MiB of wire data and 8 MiB at each decoding stage | The call raises an error when any stage exceeds the limit. It does not return a truncated body. |
| Content encoding | Up to 3 encoding layers; 16 MiB of cumulative decoded output | gzip, deflate, and identity are supported. Unsupported encodings or an exhausted decoding budget raise an error. |
| Concurrent response readers | 4 across the process | An additional response read fails immediately while all readers are busy. This is not a four-request limit. |
| Transport deadlines | 30 seconds to connect, 60 seconds for a read, 90 seconds total | A 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
Luau
local ok, body = pcall(httpget, "https://example.com/")
if ok then
print(body)
else
warn("Download failed:", body)
end