This file contains hidden or 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
| require "http/server" | |
| # from https://github.com/crystal-lang/crystal/pull/7302 | |
| class HTTP::Request | |
| @io : IO? | |
| def initialize(@method : String, @resource : String, headers : Headers? = nil, body : String | Bytes | IO | Nil = nil, @version = "HTTP/1.1", @io : IO? = nil) | |
| @headers = headers.try(&.dup) || Headers.new | |
| self.body = body |
This file contains hidden or 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
| namespace MyApp | |
| open Sol.Context | |
| module Middlewares = | |
| let authenticateAdmin next ctx = | |
| let isAdmin = hasQueryParam "is_admin" ctx |
OlderNewer