コード例 #1
0
        public string Execute()
        {
            var w = new Stopwatch();

            w.Start();

            Client = new HttpClient();
            using (Client)
            {
                try
                {
                    Task <string> task = MakeTheCall();
                    DisplayResult(Url, Method, task, w);

                    return(task.Result);
                }
                catch (WebException caught)
                {
                    var message = GetMessage(Url, w, Method, GetErrorMessage(caught));
                    AnsiConsole.WriteLineRed(message);
                    throw;
                }
                catch (Exception caught)
                {
                    var message = GetMessage(Url, w, Method, caught.Message);
                    AnsiConsole.WriteLineRed(message);
                    throw;
                }
            }
        }