class
Kemal::PathHandler
- Kemal::PathHandler
- Reference
- Object
Overview
PathHandler wraps a HTTP::Handler to only execute for specific path prefixes.
Example
use "/api", AuthHandler.new
The handler will only execute for requests matching the path prefix:
/apimatches/api,/api/users,/api/posts/1/apidoes NOT match/,/apiv2,/other
A handler instance belongs to one use: the wrapped handler continues down
the chain from where its wrapper sits, and that is one place.
Included Modules
- HTTP::Handler
Defined in:
kemal/path_handler.crConstructors
Instance Method Summary
- #call(context : HTTP::Server::Context)
- #handler : HTTP::Handler
-
#next=(handler : HTTP::Handler | HTTP::Handler::HandlerProc | Nil)
Links the wrapped handler to the rest of the chain once, when the chain is built.
- #path_prefix : String
Constructor Detail
Instance Method Detail
def next=(handler : HTTP::Handler | HTTP::Handler::HandlerProc | Nil)
#
Links the wrapped handler to the rest of the chain once, when the chain is built. It used to be re-pointed on every matching request, which under parallel execution let one request re-aim it while another was about to call through it.