Permalink
Browse files

cache request object

  • Loading branch information...
rkh committed Mar 26, 2011
1 parent b6b0414 commit 82a7b8e2e4a525bc68a057178ae9bfbae0e8f1e0
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/sinatra/base.rb
View
@@ -12,6 +12,10 @@ module Sinatra
# The request object. See Rack::Request for more info:
# http://rack.rubyforge.org/doc/classes/Rack/Request.html
class Request < Rack::Request
+ def self.new(env)
+ env['sinatra.request'] ||= super
+ end
+
# Returns an array of acceptable media types for the response
def accept
@env['sinatra.accept'] ||= begin

0 comments on commit 82a7b8e

Please sign in to comment.