MCPcopy Create free account
hub / github.com/PenguLoader/PenguLoader / Request

Method Request

loader/Main/LCU.cs:44–74  ·  view source on GitHub ↗
(string api, string method, string body = null)

Source from the content-addressed store, hash-verified

42 }
43
44 public static async Task<string> Request(string api, string method, string body = null)
45 {
46 var lcPath = GetDir();
47
48 if (string.IsNullOrEmpty(lcPath) || !GetCredentials(lcPath, out var port, out var pass))
49 return null;
50
51 var uri = $"https://127.0.0.1:{port}{api}";
52 var authToken = Encoding.ASCII.GetBytes("riot:" + pass);
53 var authorization = "Basic " + Convert.ToBase64String(authToken);
54
55 try
56 {
57 using (var req = new HttpRequestMessage(new HttpMethod(method), uri))
58 {
59 req.Headers.Add("Authorization", authorization);
60
61 if (!string.IsNullOrEmpty(body))
62 req.Content = new StringContent(body, Encoding.UTF8, "application/json");
63
64 using (var res = await Http.SendAsync(req))
65 {
66 return await res.Content.ReadAsStringAsync();
67 }
68 }
69 }
70 catch
71 {
72 return null;
73 }
74 }
75
76 public static Task KillUxAndRestart() => Request("/riotclient/kill-and-restart-ux", "POST");
77

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected