A handler is a class which includes HTTP::Handler
and implements the #call
method. You can use a handler to intercept any incoming request and can modify the response. These can be used for request throttling, ip-based whitelisting, adding custom headers e.g.
require "http/server/handler" class CustomHandler include HTTP::Handler def call(context) puts "Doing some stuff" call_next(context) end end
© 2012–2020 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.35.1/HTTP/Handler.html