Skip to main content

porla_http_client

Allows plugins to make asynchronous HTTP requests. It wraps cURL with support for http and https only.

Response size is limited to 8MiB.

Exports​

request(url: string, callback: PoHttpClientCallback): void​

v0.42.0

Makes a HTTP GET request to the url given.

Example​

local http_client = require("porla_http_client")

http_client.request("https://porla.org", function(err, res)
print(res.status)
end)

request(url: string, callback: PoHttpClientCallback, options: PoHttpClientRequestOptions): void​

v0.42.0

Makes any type of HTTP request to the url given. Use options to customize the request.

Example​

Send a HTTP POST to some URL.

local http_client = require("porla_http_client")

local callback = function(err, res)
-- do stuff with the response
end

http_client.request("http://some-url", callback, {
body = "{}",
method = "POST",
headers = {
["X-Foo"] = "bar"
}
})