From 15262c3eedda74afafa188dcff5c71bcb80bdaab Mon Sep 17 00:00:00 2001 From: Christer van der Meeren Date: Mon, 8 Jun 2020 11:04:55 +0200 Subject: [PATCH] More robust workaround for Giraffe bug https://github.com/giraffe-fsharp/Giraffe/issues/424 --- README.md | 4 ++++ src/Felicity/Felicity.fsproj | 4 ++-- src/Felicity/Operations.fs | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c71c6fc..25dd4f1 100644 --- a/README.md +++ b/README.md @@ -282,6 +282,10 @@ That’s it! You now have a wonderfully compliant JSON:API exposing your wonderf Release notes ------------- +### 0.8.4 (2020-06-08) + +* More robust workaround workaround for [giraffe-fsharp/Giraffe#24](https://github.com/giraffe-fsharp/Giraffe/issues/424) + ### 0.8.3 (2020-06-05) * Added workaround for [giraffe-fsharp/Giraffe#24](https://github.com/giraffe-fsharp/Giraffe/issues/424) diff --git a/src/Felicity/Felicity.fsproj b/src/Felicity/Felicity.fsproj index c37bb77..2c336d9 100644 --- a/src/Felicity/Felicity.fsproj +++ b/src/Felicity/Felicity.fsproj @@ -13,8 +13,8 @@ MIT f# fsharp jsonapi json-api json:api api rest rest-api api-rest api-server api-client web-api asp-net-core aspnetcore giraffe framework felicity-logo-128x128.png - 0.8.3 - Added workaround for Giraffe bug (https://github.com/giraffe-fsharp/Giraffe/issues/424) + 0.8.4 + More robust workaround for Giraffe bug (https://github.com/giraffe-fsharp/Giraffe/issues/424) diff --git a/src/Felicity/Operations.fs b/src/Felicity/Operations.fs index bb509f8..a4cabab 100644 --- a/src/Felicity/Operations.fs +++ b/src/Felicity/Operations.fs @@ -34,7 +34,7 @@ type Preconditions<'ctx, 'entity> = internal { let lastModified = this.getLastModified ctx (unbox<'entity> entity) // Workaround for https://github.com/giraffe-fsharp/Giraffe/issues/424 - |> Option.map (fun dt -> dt.AddMilliseconds (float (-dt.Millisecond))) + |> Option.map (fun dt -> dt.AddTicks(-(dt.Ticks % TimeSpan.TicksPerSecond))) let res = httpCtx.ValidatePreconditions eTag lastModified // Clear headers because response-level ETag/Last-Modified headers don't // necessarily make sense in JSON:API due to compound documents; these values