Example #1
0
        public async Task <string> PostCliCmd()
        {
            using var textReader = HttpContext.OpenRequestText();
            var line = textReader.ReadLine();

            if (line is not null)
            {
                var cliClient = new CLIClient();
                // FIXME! here we need to await the finishing of the request, not just adding the request to a queue!!!
                //        Otherwise the response will be empty as the request will not be processed yet
                //		  CLIProcessor should support async waiting for request completion (via awaiting the mutex  the request?)
                var r = _master.AddCliRequest(cliClient, line);
                await r.WaitAsync();

                return(cliClient.Response);
            }
            return(string.Empty);
        }