http_get(url) / HttpGet(url) / game:HttpGet(url)
Performs an HTTP GET; transport failures and non-200 responses are errors.
Syntax
http_get(url: string) -> string
Parameters
| Parameter | Type | Description |
|---|---|---|
url | string | http:// or https:// URL. |
Returns
| Type | Description |
|---|---|
string | Response body on HTTP 200. |
Description
Requests run asynchronously through the executor HTTP worker and resume the calling thread with the body.
Logic change: a failed request (DNS failure, timeout, connection error) or a non-200 status now raises an error instead of returning the error text as a successful result, matching game:HttpGet behavior. game.HttpGet and game:HttpGetAsync are routed to this implementation.
Example
local body = game:HttpGet("https://httpbin.org/get")
print(body:sub(1, 1)) -- {
Notes
- Blocked domains raise an error before the request is sent.