HttpGet

Perform a synchronous HTTP GET.

Syntax

Susano.HttpGet(string) -> number, string

Parameters

url (string): Absolute URL.

Return(s)

status (number): HTTP status code (e.g., 200).

body (string): Response body.

On error: nil, err (string).

Behavior

Blocking call. Runs on the calling thread.

Follows redirects. Accepts gzip/deflate.

TLS verification enabled.

No custom headers or timeout in this variant.

Body may be binary; use #body for length.

Example(s)

local st, body = Susano.HttpGet("https://httpbin.org/get")
if not st then 
    print("GET failed:", body) 
else 
    print("GET", st, #body) 
end

Last updated