Skip to content

Instantly share code, notes, and snippets.

@techiferous
Created October 26, 2009 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save techiferous/219018 to your computer and use it in GitHub Desktop.
Save techiferous/219018 to your computer and use it in GitHub Desktop.
# This Rack middleware is inspired by Homey D. Clown.
class Homey
def initialize app, options = {}
@app = app
end
def call(env)
status, headers, body = @app.call(env)
if (400..499).include?(status) && status != 404
body = "I don't think so. Homey don't play that!"
headers['Content-Length'] = Rack::Utils.bytesize(body).to_s
end
[status, headers, body]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment