HTTP
Syn and Http requests with response tables.
Performs a GET and returns the body or an error string. Aliases: httpget, httpGet, syn_httpget, gethttp, HttpGetAsync, httpgetasync.
local body = http_get("https://httpbin.org/get")
print(body)
Performs a POST and returns the body or an error string. Aliases: httppost, httpPost, syn_httppost, posthttp, HttpPostAsync, httppostasync.
local body = http_post("https://httpbin.org/post", '{"name":"yuari"}', "application/json")
print(body)
Full request API. Options: Url, Method, Headers, Cookies, Body. Returns Success, StatusCode, StatusMessage, Headers, Cookies, Body.
local response = request({
Url = "https://httpbin.org/get",
Method = "GET",
Headers = { ["User-Agent"] = "yuari" }
})
print(response.Success, response.StatusCode, response.Body)
Request API on the http table. Global aliases: http_request, httprequest, syn_request, krnl_request, webrequest.
local response = http.request({
Url = "https://httpbin.org/get",
Method = "GET"
})
print(response.StatusCode)