Permalink
Browse files

cache request object

  • Loading branch information...
1 parent b81cbe2 commit ef69971efaa90bd4ade136a352295a2f65c334b0 @rkh rkh committed Mar 26, 2011
Showing with 4 additions and 0 deletions.
  1. +4 −0 lib/sinatra/base.rb
View
@@ -11,6 +11,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 ef69971

Please sign in to comment.