request
Roblox-style request. Options: Url (required), Method (default "GET"), Body, Headers (table).
Syntax
request(options: table) -> table
Parameters
| Parameter | Type | Description |
|---|---|---|
options | table | A table of options that controls the call. |
Returns
| Type | Description |
|---|---|
table | Response table |
Description
request is part of the HTTP library. HTTP functions use the external WinHTTP client and return the raw response body or response table.
The operation is performed immediately using the arguments supplied at the call site.
The aliases http_request(options) resolve to the same implementation.
Example
local res = request({
Url = "https://httpbin.org/get",
Method = "GET",
Headers = { ["User-Agent"] = "yuari" }
})
if res.Success then
print(res.StatusCode, #res.Body)
end
Notes
- Aliases:
http_request(options). - HTTP requests are made through the external WinHTTP client.