HTTP::Handler

module HTTP::Handler

Overview

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.

A custom handler

class CustomHandler
  include HTTP::Handler

  def call(context)
    puts "Doing some stuff"
    call_next(context)
  end
end

Direct including types

Defined in:

http/server/handler.cr

Instance Method Summary

Instance Method Detail

abstract def call(context : HTTP::Server::Context)Source

def call_next(context : HTTP::Server::Context)Source

def next : Handler | Proc | NilSource

def next=(next : Handler | Proc | Nil)Source

© 2012–2017 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/0.22.0/HTTP/Handler.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部