HTTP
Full HTTP client powered by WinHTTP — no Roblox HttpService restrictions.
Roblox-style request. Options: Url (required), Method (default "GET"), Body, Headers (table).
Returns { Success, StatusCode, Body, StatusMessage, Headers }.
local res = request({
Url = "https://httpbin.org/get",
Method = "GET",
Headers = { ["User-Agent"] = "yuari" }
})
if res.Success then
print(res.StatusCode, #res.Body)
end
GET a URL and return the response body as a string.
local body = httpget("https://httpbin.org/get")
print(body)
POST with an optional content type (default "application/json").
local body = httppost("https://httpbin.org/post", '{"name":"yuari"}', "application/json")
print(body)
Service-style wrapper:
HttpService:GetAsync(url, headers?),
HttpService:RequestAsync(options),
HttpService:JSONEncode(value),
HttpService:JSONDecode(string).
local json = HttpService:JSONEncode({ health = 100, name = "bot" })
local data = HttpService:JSONDecode('{"health": 100}')
print(data.health)