Sha256: f5d0408cbeb71cb973a6ac34aedf3cfc62ca18cdb928808d57ee4b80a3cb217e
Contents?: true
Size: 749 Bytes
Versions: 20
Compression:
Stored size: 749 Bytes
Contents
# encoding: utf-8 module Hyperdrive module Middleware class RequestMethod def initialize(app) @app = app end def call(env) http_request_method = env['REQUEST_METHOD'] unless request_method_supported?(http_request_method) raise Hyperdrive::Errors::NotImplemented.new(http_request_method) end unless env['hyperdrive.resource'].request_method_allowed?(http_request_method) raise Hyperdrive::Errors::MethodNotAllowed.new(http_request_method) end @app.call(env) end private def request_method_supported?(http_request_method) Hyperdrive::Values.http_request_methods.key?(http_request_method) end end end end
Version data entries
20 entries across 20 versions & 1 rubygems