From e4ca08f1bcbc94e555807925884a2deee483ce23 Mon Sep 17 00:00:00 2001 From: 64J0 Date: Wed, 4 Sep 2024 21:53:04 -0300 Subject: [PATCH] use Option.iter for eTag and lastModified values at Precondition.fs, due to ionide-analyzers HandleOptionGracefullyAnalyzer --- src/Giraffe/Preconditional.fs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Giraffe/Preconditional.fs b/src/Giraffe/Preconditional.fs index 6f010de6..261c4d8b 100644 --- a/src/Giraffe/Preconditional.fs +++ b/src/Giraffe/Preconditional.fs @@ -150,12 +150,12 @@ type PreconditionExtensions() = | ConditionFailed -> ConditionFailed | ResourceNotModified -> ResourceNotModified - // Set ETag and Last-Modified in the response - if eTag.IsSome then - responseHeaders.ETag <- eTag.Value + // Set ETag in the response + eTag |> Option.iter (fun eTagValue -> responseHeaders.ETag <- eTagValue) - if lastModified.IsSome then - responseHeaders.LastModified <- Nullable(lastModified.Value.CutOffMs()) + // Set Last-Modified in the response + lastModified + |> Option.iter (fun lastModifiedValue -> responseHeaders.LastModified <- Nullable(lastModifiedValue.CutOffMs())) // Validate headers in correct precedence // RFC: https://tools.ietf.org/html/rfc7232#section-6