HttpPost

Perform a synchronous HTTP POST with a raw payload.

Syntax

Susano.HttpPost(string, string) -> number, string

Parameters

url (string): Absolute URL.

data (string): Request payload (raw bytes or text).

Return(s)

status (number): HTTP status code.

body (string): Response body.

On error: nil, err (string).

Behavior

Blocking call. Runs on the calling thread.

Sends data as-is. No automatic Content-Type.

Follows redirects. Accepts gzip/deflate.

TLS verification enabled.

No custom headers or timeout in this variant.

Example(s)

local payload = '{"x":1}'
local st, body = Susano.HttpPost("https://httpbin.org/post", payload)
if not st then 
    print("POST failed:", body) 
else 
    print("POST", st, #body) 
end

Last updated