Skip to content

Commit

Permalink
cache request object
Browse files Browse the repository at this point in the history
  • Loading branch information
rkh committed Mar 26, 2011
1 parent b81cbe2 commit ef69971
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/sinatra/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ef69971

Please sign in to comment.