Skip to content

Commit

Permalink
use Option.iter for eTag and lastModified values at Precondition.fs, …
Browse files Browse the repository at this point in the history
…due to ionide-analyzers HandleOptionGracefullyAnalyzer (#613)
  • Loading branch information
64J0 authored Sep 5, 2024
1 parent 79910c9 commit 1edaf3f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Giraffe/Preconditional.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1edaf3f

Please sign in to comment.