Skip to content

Commit

Permalink
feat: add request duration in execute response message
Browse files Browse the repository at this point in the history
  • Loading branch information
WeihanLi committed Dec 26, 2023
1 parent e5b7fe5 commit f7a9e80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/HTTPie/Commands/ExecuteCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ private async Task<HttpResponseMessage> 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();

Expand Down
4 changes: 4 additions & 0 deletions src/HTTPie/Implement/HttpParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<HttpRequestMessage> ParseScriptAsync(string script, CancellationToken cancellationToken = default)
{
throw new NotImplementedException();
Expand Down

0 comments on commit f7a9e80

Please sign in to comment.