module HTTP::Handler
What serves requests: a Router, a procedure (HTTP.handler) or a
class or data of one's own. Handlers are Shareable, since every
connection's task calls them: state shared between requests lives in
an Atom or a Channel. Middleware is a handler holding the next.
data DocLogged_HTTP(inner: HTTP::Handler)
include HTTP::Handler
def call(req: HTTP::Request) -> HTTP::Response
inner.call(req).header("x-served-by", "quarz")
end
end
app = DocLogged_HTTP.new(HTTP.handler { |req| HTTP::Response.text(req.path) })
app.call(HTTP::Request.get("/a")).headers["x-served-by"] # => "quarz"
<std:http>:1108
Methods
def call(req: HTTP::Request) -> HTTP::Response
The response to req. An HTTP::Error raised is answered with its
status; another StandardError with a 500.
<std:http>:1113