798 B
798 B
#api/space-lua
Network-related APIs.
net.proxyRequest(url, options?)
Performs a HTTP call, proxied via the server (to avoid CORS issues, see HTTP API).
Options:
method: GET, POST, PUT, DELETE (GET is default)headers: table with header -> value mappingsbody: either a string or table (which will be JSON stringified)
Returns:
ok: boolean if the request went okstatus: HTTP status codeheaders: HTTP headersbody: for content types:text/*: stringapplication/json: parsed JSON object- anything else: UInt8Array
net.readURI(uri, options?)
Fetches the content of a URI.
Options:
encodingforce an encoding for the result, e.g.{encoding = "text/markdown"}
net.writeURI(uri, content)
Writes content to a specific URI.