Version: beta
FUNCTION | |
---|---|
http.request() | perform a HTTP/HTTPS request |
http.request(url,method,callback,[headers],[post_data],[options])
0
(which blocks indefinitely).
PARAMETERS
url |
target url |
method |
HTTP/HTTPS method, e.g. "GET", "PUT", "POST" etc. |
callback |
response callback function
|
[headers] |
optional table with custom headers |
[post_data] |
optional data to send |
[options] |
optional table with request parameters. Supported entries:
|
EXAMPLES
Basic HTTP-GET request. The callback receives a table with the response in the fields status, the response (the data) and headers (a table).local function http_result(self, _, response) print(response.status) print(response.response) pprint(response.headers) end function init(self) http.request("http://www.google.com", "GET", http_result) end