[PR #585] [MERGED] Fix response date header #984

Closed
opened 2025-12-29 15:34:39 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/wiremock/WireMock.Net/pull/585
Author: @wolf8196
Created: 2/11/2021
Status: Merged
Merged: 2/11/2021
Merged by: @StefH

Base: masterHead: master


📝 Commits (1)

📊 Changes

1 file changed (+7 additions, -1 deletions)

View changed files

📝 src/WireMock.Net/Owin/Mappers/OwinResponseMapper.cs (+7 -1)

📄 Description

I noticed two things while updating from 1.4.1 to 1.4.4.

First - is an issue with formatting in Date header.
The DateTimeFormat.RFC1123Pattern can't be used with string.Format, since it doesn't seem to have {0} placeholder. Also the RFC1123Pattern is supplied not only as the 'format' parameter, but also as 'arg0' parameter.
I replaced string.Format with date.ToString(...).
Here is the output from simple console example:

Current: ddd, dd MMM yyyy HH':'mm':'ss 'GMT'
Fix: Thu, 11 Feb 2021 11:53:02 GMT

The second thing - it looks like the date header can't be in local time (at least developer.mozilla.org says that. I didn't read the actual standard, so might be wrong).
I'm not sure if there is a reason current implementation uses DateTime.Now instead of DateTime.UtcNow, but I also added this to PR.

Will appreciate the feedback. Thanks


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/wiremock/WireMock.Net/pull/585 **Author:** [@wolf8196](https://github.com/wolf8196) **Created:** 2/11/2021 **Status:** ✅ Merged **Merged:** 2/11/2021 **Merged by:** [@StefH](https://github.com/StefH) **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`e24e0b4`](https://github.com/wiremock/WireMock.Net/commit/e24e0b402cc5847e1295d9770ec89ed707ed9eae) Fix response date header ### 📊 Changes **1 file changed** (+7 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/WireMock.Net/Owin/Mappers/OwinResponseMapper.cs` (+7 -1) </details> ### 📄 Description I noticed two things while updating from 1.4.1 to 1.4.4. First - is an issue with formatting in Date header. The DateTimeFormat.RFC1123Pattern can't be used with string.Format, since it doesn't seem to have {0} placeholder. Also the RFC1123Pattern is supplied not only as the 'format' parameter, but also as 'arg0' parameter. I replaced string.Format with date.ToString(...). Here is the output from simple console example: ``` Current: ddd, dd MMM yyyy HH':'mm':'ss 'GMT' Fix: Thu, 11 Feb 2021 11:53:02 GMT ``` The second thing - it looks like the date header can't be in local time (at least developer.mozilla.org says that. I didn't read the actual standard, so might be wrong). I'm not sure if there is a reason current implementation uses DateTime.Now instead of DateTime.UtcNow, but I also added this to PR. Will appreciate the feedback. Thanks --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 15:34:39 +01:00
adam closed this issue 2025-12-29 15:34:39 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#984