Skip to content

Instantly share code, notes, and snippets.

@jfirebaugh
Created April 6, 2011 23:02
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 jfirebaugh/906721 to your computer and use it in GitHub Desktop.
Save jfirebaugh/906721 to your computer and use it in GitHub Desktop.
class ResponseTimer
def call(env, &block)
now = Time.now
@app.call(env, &block)
$stderr.puts({'X-Response-Took' => (Time.now - now)})
end
end
class FakeRack
def serve(application)
application.call({}) do |status, headers, body|
p :status => status
p :headers => headers
body.each do |string|
p string
end
body.close if body.respond_to?(:close)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment