Class: Grape::Middleware::Globals

Inherits:
Base
  • Object
show all
Defined in:
lib/grape/middleware/globals.rb

Constant Summary

Constants inherited from Base

Base::TEXT_HTML

Instance Attribute Summary

Attributes inherited from Base

#app, #env, #options

Instance Method Summary collapse

Methods inherited from Base

#after, #call, #call!, #content_type, #content_type_for, #content_types, #default_options, #initialize, #mime_types, #response

Methods included from DSL::Headers

#header

Constructor Details

This class inherits a constructor from Grape::Middleware::Base

Instance Method Details

#beforeObject


6
7
8
9
10
11
# File 'lib/grape/middleware/globals.rb', line 6

def before
  request = Grape::Request.new(@env)
  @env[Grape::Env::GRAPE_REQUEST] = request
  @env[Grape::Env::GRAPE_REQUEST_HEADERS] = request.headers
  @env[Grape::Env::GRAPE_REQUEST_PARAMS] = request.params if @env[Grape::Env::RACK_INPUT]
end