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

Methods included from Helpers

#context

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, build_params_with: @options[:build_params_with])
  @env[Grape::Env::GRAPE_REQUEST] = request
  @env[Grape::Env::GRAPE_REQUEST_HEADERS] = request.headers
  @env[Grape::Env::GRAPE_REQUEST_PARAMS] = request.params if @env[Rack::RACK_INPUT]
end