Skip to content

request

request sends a HTTP request to the given URL using the provided configuration table. It yields until the request is complete and returns a structured response.

type RequestOptions = {
    Url: string,
    Method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE",
    Body: string?,
    Headers: { [string]: string }?,
    Cookies: { [string]: string }?
}

type Response = {
    Body: string,
    StatusCode: number,
    StatusMessage: string,
    Success: boolean,
    Headers: { [string]: string }
}

function request(options: RequestOptions): Response

Parameters

Parameter Description
options A table of fields defining the HTTP request.

RequestOptions Fields

Field Type Description
Url string The target URL.
Method string The HTTP method (GET, POST, PATCH, or PUT).
Body string? (Optional) The request payload.
Headers { [string]: string }? (Optional) Dictionary of HTTP headers.
Cookies { [string]: string }? (Optional) Dictionary of cookies.

Response Fields

Field Type Description
Body string The returned response body.
StatusCode number The numeric HTTP status code.
StatusMessage string The human-readable status description.
Success boolean Whether the request was successful.
Headers { [string]: string } Dictionary of response headers.

Automatically added Headers

Executors will attach this unique header automatically:

Header Description
PREFIX-User-Identifier Unique user ID that stays consistent across devices for the same user.
PREFIX-Fingerprint Hardware-bound identifier (HWID) of the client's machine.
User-Agent Executor name and version string.

Examples

Example 1

Basic GET request with fingerprint lookup
local response = request({
    Url = "http://httpbin.org/get",
    Method = "GET",
})

local decoded = game:GetService("HttpService"):JSONDecode(response.Body)
local retrieved_fingerprint

for key in pairs(decoded.headers) do
    if key:match("Fingerprint") then
        retrieved_fingerprint = key
        break
    end
end

print(response.StatusCode)         -- Output: 200
print(response.Success)            -- Output: true
print(retrieved_fingerprint)        -- Output: PREFIX-Fingerprint

Example 2

Basic POST request with payload
1
2
3
4
5
6
7
8
9
local response = request({
    Url = "http://httpbin.org/post",
    Method = "POST",
    Body = "Example"
})

print(response.StatusMessage)                               -- Output: OK
print(response.StatusCode)                                  -- Output: 200
print(game:GetService("HttpService"):JSONDecode(response.Body).data) -- Output: Example