From f7a9e80829642874527770fdba0938b5171634a8 Mon Sep 17 00:00:00 2001 From: Weihan Li Date: Tue, 26 Dec 2023 22:23:49 +0800 Subject: [PATCH] feat: add request duration in execute response message --- src/HTTPie/Commands/ExecuteCommand.cs | 4 +++- src/HTTPie/Implement/HttpParser.cs | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/HTTPie/Commands/ExecuteCommand.cs b/src/HTTPie/Commands/ExecuteCommand.cs index a3fb9ef..67b3eb1 100644 --- a/src/HTTPie/Commands/ExecuteCommand.cs +++ b/src/HTTPie/Commands/ExecuteCommand.cs @@ -103,8 +103,10 @@ private async Task ExecuteRequest( Console.WriteLine("Request message:"); Console.WriteLine(await requestMessage.ToRawMessageAsync(cancellationToken)); + var startTimestamp = Stopwatch.GetTimestamp(); var response = await requestExecutor.ExecuteAsync(requestMessage, cancellationToken); - Console.WriteLine("Response message:"); + var requestDuration = ProfilerHelper.GetElapsedTime(startTimestamp); + Console.WriteLine($"Response message({requestDuration.TotalMilliseconds}ms):"); Console.WriteLine(await response.ToRawMessageAsync(cancellationToken)); Console.WriteLine(); diff --git a/src/HTTPie/Implement/HttpParser.cs b/src/HTTPie/Implement/HttpParser.cs index af604ae..1ba31f4 100644 --- a/src/HTTPie/Implement/HttpParser.cs +++ b/src/HTTPie/Implement/HttpParser.cs @@ -13,6 +13,10 @@ namespace HTTPie.Implement; public sealed class HttpParser : IHttpParser { + private const string DotEnvFileName = ".env"; + private const string HttpEnvFileName = "httpenv.json"; + private const string UserHttpEnvFileName = "httpenv.json.user"; + public Task ParseScriptAsync(string script, CancellationToken cancellationToken = default) { throw new NotImplementedException();