public override void OnRaiseEvent(IRaiseEventCallInfo info) { var request = new HttpRequest { Url = "https://httpbin.org/response-headers", UserState = info, Method = info.Request.EvCode == 1 ? "GET" : "POST", Callback = this.Callback }; if (this.PluginHost.GameId.Contains("OldHttp")) { #pragma warning disable CS0612 // Type or member is obsolete PluginHost.HttpRequest(request); #pragma warning restore CS0612 // Type or member is obsolete base.OnRaiseEvent(info); } else { PluginHost.HttpRequest(request, info); if (this.PluginHost.GameId.Contains("Async")) { base.OnRaiseEvent(info); } } }
public override void OnCreateGame(ICreateGameCallInfo info) { Dictionary <string, string> expectedHeaders = new Dictionary <string, string>(); // you can add as many as you want or even send them through unit test as actor or game properties expectedHeaders.Add("GameId", info.Request.GameId); expectedHeaders.Add("LobbyType", info.Request.LobbyType.ToString()); expectedHeaders.Add("ActorNr", info.Request.ActorNr.ToString()); expectedHeaders.Add("JoinMode", info.Request.JoinMode.ToString()); expectedHeaders.Add("AppId", AppId); expectedHeaders.Add("Region", Region); expectedHeaders.Add("AppVersion", AppVersion); expectedHeaders.Add("UserId", info.UserId); expectedHeaders.Add("Nickname", info.Nickname); StringBuilder url = new StringBuilder("https://httpbin.org/response-headers?"); foreach (var key in expectedHeaders.Keys) { url.AppendFormat("{0}={1}&", key, expectedHeaders[key]); } url.Remove(url.Length - 1, 1); HttpRequest request = new HttpRequest(); request.Url = url.ToString(); request.Callback = Callback; request.UserState = expectedHeaders; PluginHost.HttpRequest(request, info); }