HTTPRequest - xAranaktu/FC-25-Live-Editor GitHub Wiki

HTTPRequest

Represents the request that you send using HTTP Request

Fields

Type Name Description
__int32 method HTTP Method Check Method Enum
string url URL
string body Raw Body
table auth Used for authentication. Check Auth
table payload Request payload
table headers Request headers
table cookies Request cookies
__int32 timeout Request timeout in ms

Methods

SetMethod

Sets HTTP Method -> Method Enum

Declaration

void REQUEST:SetMethod(HTTPMethod method)

Parameters

Type Name Description
__int32 method HTTP Method from Method Enum

Returns

Doesn't return anything

SetUrl

Sets URL

Declaration

void REQUEST:SetUrl(string url)

Parameters

Type Name Description
string url URL

Returns

Doesn't return anything

SetAuth

Sets Auth

Declaration

void REQUEST:SetAuth(table auth)

Parameters

Type Name Description
table auth Authentication Method. Check Auth

Returns

Doesn't return anything

SetBody

Sets Body

Declaration

void REQUEST:SetBody(string body)

Parameters

Type Name Description
string body Request body

Returns

Doesn't return anything

SetPayload

Sets Payload

Declaration

void REQUEST:SetPayload(table payload)

Parameters

Type Name Description
table payload Request payload

Returns

Doesn't return anything

SetHeaders

Sets Headers

Declaration

void REQUEST:SetHeaders(table headers)

Parameters

Type Name Description
table headers Request headers

Returns

Doesn't return anything

SetCookies

Sets Cookies

Declaration

void REQUEST:SetCookies(table cookies)

Parameters

Type Name Description
table cookies Request cookies

Returns

Doesn't return anything

SetTimeout

Sets Timeout

Declaration

void REQUEST:SetTimeout(int timeout)

Parameters

Type Name Description
__int32 timeout Request timeout in ms

Returns

Doesn't return anything

Auth

local basic_auth = {
    ["username"] = "user",
    ["password"] = "pass",
    ["auth_mode"] = HTTP_AUTH_METHOD_BASIC
}
local digest_auth = {
    ["username"] = "user",
    ["password"] = "pass",
    ["auth_mode"] = HTTP_AUTH_METHOD_DIGEST
}
local bearer_token_auth = {
    ["access_token"] = "ACCESS_TOKEN",
    ["auth_mode"] = HTTP_AUTH_METHOD_BEARER
}

Method Enum

HTTP_GET_REQUEST = 1
HTTP_HEAD_REQUEST = 2
HTTP_OPTIONS_REQUEST = 3
HTTP_PUT_REQUEST = 4 
HTTP_DELETE_REQUEST = 5
HTTP_POST_REQUEST = 6
HTTP_PATCH_REQUEST = 7

Auth Method Enum

HTTP_AUTH_METHOD_BASIC = 0
HTTP_AUTH_METHOD_DIGEST = 1
HTTP_AUTH_METHOD_NTLM = 2
HTTP_AUTH_METHOD_BEARER = 3