コード例 #1
0
        public async Task <ActionResult <string> > RunCode([FromBody] TestRun testRun)
        {
            if (string.IsNullOrWhiteSpace(testRun.Code))
            {
                return(null);
            }

            var response = await codeRunner.RunCodeAsync(testRun.Code, testRun.Input);

            var content = await response.Content.ReadAsStringAsync();

            if (response.IsSuccessStatusCode)
            {
                return(content);
            }
            return(BadRequest(content));
        }