HTTP REQUEST

HttpPost

Performs an HTTP POST request and returns the response body.

Syntax

local status, body = ONYX.HttpPost(url, data)

Parameters

  • url (string) — Absolute URL.
  • data (string) — Request payload, raw bytes or text.

Return(s)

status (number) — HTTP status; body (string) — response body; on error nil and a message.

Behavior

  • Blocking call on the calling thread.
  • Sends the payload as-is with no automatic content type.
  • Follows redirects, accepts gzip/deflate, TLS verification enabled.
  • No custom headers or timeout in this variant.

Example(s)

local status, body = ONYX.HttpPost("https://httpbin.org/post", "hello")
if not status then print("failed", body) end