Skip to content

Commit e4ca08f

Browse files
committed
use Option.iter for eTag and lastModified values at Precondition.fs, due to ionide-analyzers HandleOptionGracefullyAnalyzer
1 parent 79910c9 commit e4ca08f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Giraffe/Preconditional.fs

+5-5
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,12 @@ type PreconditionExtensions() =
150150
| ConditionFailed -> ConditionFailed
151151
| ResourceNotModified -> ResourceNotModified
152152

153-
// Set ETag and Last-Modified in the response
154-
if eTag.IsSome then
155-
responseHeaders.ETag <- eTag.Value
153+
// Set ETag in the response
154+
eTag |> Option.iter (fun eTagValue -> responseHeaders.ETag <- eTagValue)
156155

157-
if lastModified.IsSome then
158-
responseHeaders.LastModified <- Nullable(lastModified.Value.CutOffMs())
156+
// Set Last-Modified in the response
157+
lastModified
158+
|> Option.iter (fun lastModifiedValue -> responseHeaders.LastModified <- Nullable(lastModifiedValue.CutOffMs()))
159159

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

0 commit comments

Comments
 (0)