diff --git a/DevProxy.Abstractions/Proxy/ProxyEvents.cs b/DevProxy.Abstractions/Proxy/ProxyEvents.cs index 810387d3..a69c2834 100644 --- a/DevProxy.Abstractions/Proxy/ProxyEvents.cs +++ b/DevProxy.Abstractions/Proxy/ProxyEvents.cs @@ -61,6 +61,7 @@ public class RequestLog public MessageType MessageType { get; set; } public string? Method { get; init; } public string? PluginName { get; set; } + public DateTimeOffset Timestamp { get; init; } = DateTimeOffset.UtcNow; public string? Url { get; init; } public RequestLog(string message, MessageType messageType, LoggingContext? context) : diff --git a/DevProxy.Plugins/Generation/HarGeneratorPlugin.cs b/DevProxy.Plugins/Generation/HarGeneratorPlugin.cs index e376bcb1..fc85ffc9 100644 --- a/DevProxy.Plugins/Generation/HarGeneratorPlugin.cs +++ b/DevProxy.Plugins/Generation/HarGeneratorPlugin.cs @@ -103,11 +103,10 @@ private HarEntry CreateHarEntry(RequestLog log) var request = log.Context.Session.HttpClient.Request; var response = log.Context.Session.HttpClient.Response; - var currentTime = DateTime.UtcNow; var entry = new HarEntry { - StartedDateTime = currentTime.ToString("o"), + StartedDateTime = log.Timestamp.ToString("o"), Time = 0, // We don't have actual timing data in RequestLog Request = new HarRequest {