RequestLogExpirationDuration - bug #196

Closed
opened 2025-12-29 14:24:52 +01:00 by adam · 3 comments
Owner

Originally created by @gregoks on GitHub (Aug 11, 2019).

Originally assigned to: @StefH on GitHub.

Hi,

In OwinRequestMapper (line 55) you are setting RequestMessage.DateTime to DateTime.UtcNow:

return new RequestMessage(urldetails, method, clientIP, body, headers, cookies) { DateTime = DateTime.UtcNow };

Then in WireMockMiddleWare (line 175) when you are checking for expiration of that time, you are using DateTime.Now instead of DateTime.UtcNow:

var checkTime = DateTime.Now.AddHours(-_options.RequestLogExpirationDuration.Value);

That's causing you invalid behavior.
Please check.

Thanks,

Greg

Originally created by @gregoks on GitHub (Aug 11, 2019). Originally assigned to: @StefH on GitHub. Hi, In OwinRequestMapper (line 55) you are setting RequestMessage.DateTime to DateTime.UtcNow: `return new RequestMessage(urldetails, method, clientIP, body, headers, cookies) { DateTime = DateTime.UtcNow };` Then in WireMockMiddleWare (line 175) when you are checking for expiration of that time, you are using DateTime.Now instead of DateTime.UtcNow: `var checkTime = DateTime.Now.AddHours(-_options.RequestLogExpirationDuration.Value);` That's causing you invalid behavior. Please check. Thanks, Greg
adam added the bug label 2025-12-29 14:24:52 +01:00
adam closed this issue 2025-12-29 14:24:52 +01:00
Author
Owner

@StefH commented on GitHub (Aug 11, 2019):

Good catch, I've fixed this with PR #314

But you are also allowed to create a PR for other issues you find. ;-)

@StefH commented on GitHub (Aug 11, 2019): Good catch, I've fixed this with PR #314 But you are also allowed to create a PR for other issues you find. ;-)
Author
Owner

@gregoks commented on GitHub (Aug 11, 2019):

Thanks @StefH! Perhaps check if there are any other DateTime.Now <> DateTime.UtcNow shenanigans :)

@gregoks commented on GitHub (Aug 11, 2019): Thanks @StefH! Perhaps check if there are any other DateTime.Now <> DateTime.UtcNow shenanigans :)
Author
Owner

@StefH commented on GitHub (Aug 11, 2019):

I could not find any other inconsistencies.

@StefH commented on GitHub (Aug 11, 2019): I could not find any other inconsistencies.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#196