Skip to content

Commit 215be44

Browse files
committed
use Option.iter for eTag and lastModified values at Precondition.fs, due to ionide-analyzers HandleOptionGracefullyAnalyzer
1 parent 8dfe352 commit 215be44

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Giraffe/Preconditional.fs

+5-3
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,11 @@ type PreconditionExtensions() =
153153
| ConditionFailed -> ConditionFailed
154154
| ResourceNotModified -> ResourceNotModified
155155

156-
// Set ETag and Last-Modified in the response
157-
if eTag.IsSome then responseHeaders.ETag <- eTag.Value
158-
if lastModified.IsSome then responseHeaders.LastModified <- Nullable(lastModified.Value.CutOffMs())
156+
// Set ETag in the response
157+
eTag |> Option.iter (fun eTagValue -> responseHeaders.ETag <- eTagValue)
158+
159+
// Set Last-Modified in the response
160+
lastModified |> Option.iter (fun lastModifiedValue -> responseHeaders.LastModified <- Nullable(lastModifiedValue.CutOffMs()))
159161

160162
// Validate headers in correct precedence
161163
// RFC: https://tools.ietf.org/html/rfc7232#section-6

0 commit comments

Comments
 (0)