request
Performs an HTTP request and returns a structured response.
Yields until the request completes. Method defaults to GET. Only these supplied headers are forwarded: Content-Type, User-Agent, Accept, Authorization, Cookie and Referer. Other headers are dropped.
This call goes out as the executor, with User-Agent: Virginia/1, an Acedia-Fingerprint machine identifier, Accept: */* and the Roblox session headers. A User-Agent or Accept you pass in Headers replaces the default rather than adding to it. See the header table for the full list.
Transport failures return a response with Success=false, StatusCode=0 and an error string in Body. HTTP non-2xx responses also have Success=false.
request(options: HttpRequestOptions): HttpResponseParameters
| Parameter | Type | Description |
|---|---|---|
options | HttpRequestOptions | Url, Method, Headers and Body fields. |
See HttpRequestOptions for request options and HttpResponse for the response fields.
Example
local response = request({ Url = "https://example.com", Method = "GET" })
if response.Success then print(response.Body) else warn(response.StatusCode, response.Body) endExample output
<!doctype html>
<html>
<head>
<title>Example Domain</title>
…
</head>
<body>
<div>
<h1>Example Domain</h1>
…
</div>
</body>
</html>The exact body is whatever the server returns; the shape above is example.com's current response.
Errors: Requires a table with a usable Url and an http:// or https:// scheme.
Aliases: http_request, http.request.
