HTTPRequest
Methods
Sets the raw request body string. Returns the request, so calls can be chained.
Parameters
body
Returns
Sets a request header, replacing any previous value for the same name. Passing nil or an empty string as the value removes the header. Returns the request, so calls can be chained.
request:SetHeader("Content-Type", "application/json")
request:SetHeader("x-api-key", apiKey)
Parameters
name
value
Returns
Encodes the given Lua value (typically a table) as JSON and sets it as the request body. Returns the request, so calls can be chained.
Tables with consecutive integer keys starting at 1 encode as JSON arrays; all other tables encode as JSON objects. Note that an EMPTY table encodes as an empty JSON object (), never as an empty array. Use the global JSONNull to encode an explicit JSON null (a nil table value would simply omit the key).
request:SetJSONBody({
grants = {
{ user_id = player.user.id, tickets = 5 },
},
event_id = JSONNull, -- encodes as null
})
Parameters
value
Returns
Sets a URL query parameter, replacing any previous value for the same name. Passing nil or an empty string as the value removes the parameter. Returns the request, so calls can be chained.
request:SetQueryParameter("user_id", player.user.id)