Outbound HTTP from the server — webhooks, external APIs, licence checks.

var response = Http.post(webhookUrl, Json.encode({content: "server started"}), ["Content-Type" => "application/json"]);
if (response.status >= 300) Logger.warn("webhook", response.body);

The blocking methods suspend only the calling coroutine, so the rest of the server keeps running. Even so, a slow endpoint delays whatever triggered the call — don't put a synchronous request inside a player-facing path without a timeout on the far end.

PerformHttpRequest is a Lua-level global rather than a native (the native underneath takes a serialised blob), so this goes through a small Lua glue function, the same approach as fivem.server.db.OxMysqlBridge.

Static methods

staticinlineget(url:String, ?headers:Map<String, String>):HttpResponse

Performs a GET and blocks until the response arrives.

staticinlinepost(url:String, body:String, ?headers:Map<String, String>):HttpResponse

Performs a POST and blocks until the response arrives.

@:value({ method : "GET" })staticrequest(url:String, method:String = "GET", ?body:String, ?headers:Map<String, String>):HttpResponse

Performs a request and blocks until it completes.

A network-level failure surfaces as a status of -1 with an empty body, matching what the runtime reports; it does not throw.

@:has_untyped@:value({ method : "GET" })staticsend(url:String, method:String = "GET", ?body:String, ?headers:Map<String, String>, ?onResponse:(response:HttpResponse) ‑> Void):Void

Performs a request without blocking, delivering the result to onResponse.

Use this for fire-and-forget webhooks, where nothing should wait on a Discord round trip.