Skip to main content

Network API

Handles Networking related operations.

network.request

Signatures

request(url, opts \ [])

Description

Makes an HTTP request and returns the response.

Options:

  • method: HTTP method (e.g., "GET", "POST", "PUT", "DELETE")
  • headers: A table of HTTP headers
  • body: The request body (for POST, PUT, etc.). Maximum size is 10 MB.
  • auth: Authentication method and credentials
  • params: Query parameters
  • timeout: Request timeout in milliseconds

Returns a table with:

  • status: HTTP status code
  • body: Response body (decoded)
  • error: Error message (if any)

Example:

local response = network.request("https://api.example.com/data", {
method = "GET",
headers = {["Content-Type"] = "application/json"},
auth = {type = "bearer", token = "my-token"},
params = {limit = 10, offset = 0}
})

Only supports json at the moment