class Hanami::Router::NotAllowedError

Error raised when a request is made for a route using a HTTP method not allowed on the route.

Raised only when using hanami-router as part of a full Hanami app. When using hanami-router standalone, the behavior for such requests is to return a “Method Not Allowed” response.

@api public @since 2.1.0

Attributes

allowed_methods[R]

@return [Array<String>] the allowed methods for the route

@api public @since 2.1.0

env[R]

@return [Hash] the Rack environment for the request

@api public @since 2.1.0

Public Class Methods

new(env, allowed_methods) click to toggle source
Calls superclass method
# File lib/hanami/extensions/router/errors.rb, line 49
def initialize(env, allowed_methods)
  @env = env
  @allowed_methods = allowed_methods

  message = "Only #{allowed_methods.join(', ')} requests are allowed at #{env["PATH_INFO"]}"
  super(message)
end