mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-11 14:20:29 +01:00
ISO8601 Date response #641
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tyurtyubek on GitHub (Oct 29, 2024).
How to return ISO8601 Date from __admin/mappings with Z in the end like
"signed_at": "2024-10-29T08:40:18.510383Z"always got in such format
"2024-10-29T21:51:06+02:00"@StefH commented on GitHub (Oct 31, 2024):
Please provide your full code or json mapping.
@StefH commented on GitHub (Nov 1, 2024):
Just use
"yyyy-MM-ddTHH:mm:ss.fffffffZ"as custom formatter.Like:
@tyurtyubek commented on GitHub (Nov 2, 2024):
Thank you! I tried to follow a similar approach. I’m attaching some code as an example.
{ "Request": { "Path": { "Matchers": [ { "Name": "RegexMatcher", "Pattern": "/api/test", "IgnoreCase": true } ] }, "Methods": [ "POST" ] }, "Response": { "StatusCode": 200, "BodyAsJson": { "data": { "eta": "{{DateTime.UtcNow}}", "signed_at": "{{String.Format (DateTime.UtcNow) \"yyyy-MM-ddTHH:mm:ss.fffffZ\"}}", "signed_at2": "{{String.Format (DateTime.UtcNow) \"yyyy-MM-ddTHH:mm:ss.fffffffZ\"}}", "signed_atZExample": "{{String.Format (DateTime.UtcNow) \"yyyy-MM-ddTHH:mm:ss.fffffffZ\"}}Z" } }, "UseTransformer": true, "UseTransformerForBodyAsFile": true, "Headers": { "Content-Type": "application/json" } } }and the results is
{ "data": { "eta": "2024-11-02T15:12:15.802873+02:00", "signed_at": "2024-11-02T15:12:15.80502+02:00", "signed_at2": "2024-11-02T15:12:15.806856+02:00", "signed_atZExample": "2024-11-02T13:12:15.8086470ZZ" } }