Last active
July 13, 2017 01:40
-
-
Save gerardtoconnor/1c2bc955dfed6518e072f0eff2853c54 to your computer and use it in GitHub Desktop.
Example Middleware next format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type GiraffeMiddleware (next : RequestDelegate, | |
handler : HttpHandler, | |
loggerFactory : ILoggerFactory) = | |
member __.Invoke (ctx : HttpContext) = | |
task { | |
let finalNext = (fun ctx -> task { Some ctx } ) | |
let! result = handler finalNext ctx | |
if (result.IsNone) then | |
return! next.Invoke ctx | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment