sunc docs
  • sUNC Introduction
  • Closures
    • hookfunction
    • hookmetamethod
    • newcclosure
    • iscclosure
    • islclosure
    • isexecutorclosure
    • clonefunction
    • getfunctionhash
  • Cryptography
    • crypt.base64encode
    • crypt.base64decode
  • Debug
    • debug.getconstants
    • debug.getconstant
    • debug.setconstant
    • debug.getupvalues
    • debug.getupvalue
    • debug.setupvalue
  • debug.getstack
  • debug.setstack
  • debug.getprotos
  • debug.getproto
  • Drawing
    • Drawing.new
      • Drawing Objects
    • cleardrawcache
    • getrenderproperty
    • setrenderproperty
    • isrenderobj
  • Environment
    • getgenv
    • getrenv
    • getgc
    • filtergc
  • Filesystem
    • appendfile
    • writefile
    • readfile
    • listfiles
    • isfile
    • delfile
    • loadfile
    • makefolder
    • isfolder
    • delfolder
    • getcustomasset
  • Instances
    • fireproximityprompt
    • fireclickdetector
    • firetouchinterest
    • getinstances
    • getnilinstances
    • cloneref
    • gethui
    • getcallbackvalue
    • compareinstances
  • Metatables
    • getrawmetatable
    • setrawmetatable
    • setreadonly
    • isreadonly
  • Miscellaneous
    • identifyexecutor
    • request
  • Reflection
    • gethiddenproperty
    • sethiddenproperty
    • setscriptable
    • checkcaller
    • setthreadidentity
    • getthreadidentity
  • Scripts
    • getscriptbytecode
    • getscripthash
    • getscriptclosure
    • getsenv
    • getscripts
    • getrunningscripts
    • getloadedmodules
    • getcallingscript
    • loadstring
  • Signals
    • getconnections
      • The Connection object
    • firesignal
    • replicatesignal
  • Websocket
    • WebSocket.connect
Powered by GitBook
On this page
  • Parameters
  • Request
  • Response
  • Headers
  • Examples
  1. Miscellaneous

request

Sends an HTTP request with the given options, yielding until the request is finished, and returns the response.

function request(options: HttpRequest): HttpResponse

Parameters

  • options - The options to use.


Request

Field
Type
Description

Url

string

The URL for the request.

Method

string

The HTTP method to use. Can be GET, POST, PATCH, or PUT.

Body

string?

The body of the request.

Headers

table?

A table of headers.

Cookies

table?

A table of cookies.

Response

Field
Type
Description

Body

string

The body of the response.

StatusCode

number

The number status code of the response.

StatusMessage

string

The status message of the response.

Success

boolean

Whether or not the request was successful.

Headers

table

A dictionary of headers.

Headers

The executor provides the following headers for identification on a web server:

Header
Description

PREFIX-User-Identifier

A string unique to each user, and does not change if the script executor is used across computers.

PREFIX-Fingerprint

The hardware identifier of the user.

User-Agent

The name and version of the executor.


Examples

local Response = request({
	Url = "http://httpbin.org/get",
	Method = "GET",
})

local RetrievedFingerprint

local Decoded = game:GetService("HttpService"):JSONDecode(Response.Body)
for i, v in pairs(Decoded["headers"]) do
    if i:match("Fingerprint") then RetrievedFingerprint = i break end
end

print(Response.StatusCode) -- Output: 200
print(Response.Success) -- Output: true
print(RetrievedFingerprint) -- Output: Prefix-Fingerprint (prefix being the exec's name)
local Response = request({
	Url = "http://httpbin.org/post",
	Method = "POST",
	Body = "Example"
})

print(Response.StatusMessage) -- Output: 200
print(Response.StatusCode) -- Output: true
print(game:GetService("HttpService"):JSONDecode(Response.Body).data) -- Output: Example
PreviousidentifyexecutorNextgethiddenproperty

Last updated 2 months ago