Sha256: 9f4942f0fe874408ef051ba9ed4239df39ec956bdf43eb1c0b08161befec7ad3
Contents?: true
Size: 527 Bytes
Versions: 1
Compression:
Stored size: 527 Bytes
Contents
require 'rack' module WhatsUpDoc class Middleware DEFAULTS = {path: '/up'} def initialize(app, options = {}) @app = app @options = DEFAULTS.merge(options) end def call(env) @env = env if up_path? [200, {'Content-Type' => 'text/plain'}, ['']] else app.call(env) end end private attr_reader :app, :env, :options def request Rack::Request.new(env) end def up_path? options[:path] == request.fullpath end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
whats_up_doc-0.0.2 | lib/whats_up_doc/middleware.rb |