Skip to content

Commit

Permalink
fix the Globals middleware
Browse files Browse the repository at this point in the history
- add to the autoload configuration
- fix issues with it accessing an undefined var/method
  • Loading branch information
urkle committed Apr 29, 2015
1 parent c9c0fd4 commit 9dfc5e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/grape.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ module Middleware
autoload :Versioner
autoload :Formatter
autoload :Error
autoload :Globals

module Auth
extend ActiveSupport::Autoload
Expand Down
3 changes: 2 additions & 1 deletion lib/grape/middleware/globals.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ module Grape
module Middleware
class Globals < Base
def before
@env['grape.request'] = Grape::Request.new(@env)
request = Grape::Request.new(@env)
@env['grape.request'] = request
@env['grape.request.headers'] = request.headers
@env['grape.request.params'] = request.params if @env['rack.input']
end
Expand Down

0 comments on commit 9dfc5e5

Please sign in to comment.