Module: Roda::RodaPlugins::MethodOverride::RequestMethods
- Defined in:
- bridgetown-core/lib/roda/plugins/method_override.rb
Constant Summary collapse
- HTTP_METHODS =
%w(GET HEAD PUT POST DELETE OPTIONS PATCH LINK UNLINK).freeze
- HTTP_METHOD_OVERRIDE_HEADER =
"HTTP_X_HTTP_METHOD_OVERRIDE"
- ALLOWED_METHODS =
%w(POST).freeze
Instance Method Summary collapse
Instance Method Details
#initialize(scope, env) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'bridgetown-core/lib/roda/plugins/method_override.rb', line 17 def initialize(scope, env) super return unless _allowed_methods.include?(env[Rack::REQUEST_METHOD]) method = _method_override(env) return unless HTTP_METHODS.include?(method) env[Rack::RACK_METHODOVERRIDE_ORIGINAL_METHOD] = env[Rack::REQUEST_METHOD] env[Rack::REQUEST_METHOD] = method end |