Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
21 lines (18 sloc) 459 Bytes
module Rack
class Backstage
File = ::File
def initialize(app, path)
@app = app
@file = File.expand_path(path)
end
def call(env)
if File.exists?(@file)
content = File.read(@file)
length = "".respond_to?(:bytesize) ? content.bytesize.to_s : content.size.to_s
[503, {'Content-Type' => 'text/html', 'Content-Length' => length}, [content]]
else
@app.call(env)
end
end
end
end
Something went wrong with that request. Please try again.