Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
EBT_HTTPRequest.c
Go to the documentation of this file.
1class EBT_HTTPErrorResponse: JsonApiStruct
2{
3 string error;
4
5 //---------------------------------------------------------------------
7 {
8 RegV("error");
9 }
10}
11
12class EBT_HTTPRequest
13{
14 //---------------------------------------------------------------------
15 static void DefaultOnError(RestCallback cb)
16 {
17 int code = cb.GetHttpCode();
18 string data = cb.GetData();
21
22 eResponse.ExpandFromRAW(data);
23 PrintFormat(string.Format("EBT HTTP Request ERROR: %1", eResponse.error), LogLevel.ERROR);
24
25 }
26
27 //---------------------------------------------------------------------
28 static void Send(string method, string endpoint, string payload, notnull RestCallback callback)
29 {
30 RestApi api = GetGame().GetRestApi();
31 RestContext ctx = api.GetContext("http://localhost:8080/");
32
33 if (method == "POST")
34 ctx.POST(callback, endpoint, payload);
35 else if (method == "GET")
36 ctx.GET(callback, endpoint);
37 else
38 PrintFormat("Unsupported HTTP method: %1", method);
39 }
40}
void EBT_HTTPErrorResponse()
EBT_HTTPErrorResponse JsonApiStruct DefaultOnError(RestCallback cb)
ArmaReforgerScripted GetGame()
Definition game.c:1398
Get all prefabs that have the spawner data
base classes for filtering in server browser
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)