-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code scanning fix patches #638
Conversation
src/Giraffe/RequestLimitation.fs
Outdated
@@ -44,7 +44,7 @@ let mustAcceptAny (mimeTypes: string list) (optionalErrorHandler: OptionalErrorH | |||
) | |||
|
|||
match Option.ofObj (headers.Accept :> _ seq) with | |||
| Some xs when Seq.map (_.ToString()) xs |> Seq.exists (fun x -> Seq.contains x mimeTypes) -> next ctx | |||
| Some xs when Seq.map (_.ToString()) xs |> Seq.exists (fun x -> List.contains x mimeTypes) -> next ctx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick, you can probably move the ToString
inside the Seq.exists.
And I wonder if Sets
should be used here. The order of mimeTypes doesn't matter here.
src/Giraffe/ResponseCaching.fs
Outdated
@@ -55,14 +55,17 @@ module ResponseCaching = | |||
| Public duration -> tHeaders.CacheControl <- cacheHeader true duration | |||
| Private duration -> tHeaders.CacheControl <- cacheHeader false duration | |||
|
|||
if vary.IsSome then | |||
headers.[HeaderNames.Vary] <- StringValues [| vary.Value |] | |||
match vary with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Option.iter maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, using Option.iter
improves readability (my POV), thanks for the suggestion!
992f916
to
ec66153
Compare
Description
Fix the following code scan warnings:
Before this PR (29 open items):
After this PR (25 open items):
How to test
Check CI.