class Kemal::Exceptions::MethodNotAllowed

Overview

Raised when the request path is routed for at least one other HTTP method.

RFC 9110 ยง15.5.6 separates this from a 404: the target resource exists, the method does not apply to it. #allowed_methods lists the methods that do, and Kemal::ExceptionHandler renders it into the mandatory Allow response header.

Defined in:

kemal/helpers/exceptions.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(context : HTTP::Server::Context, allowed_methods : Array(String)) #

The message is the bare status reason because it doubles as the default response body, and reflecting the request back into it would put client-controlled text on the page. The request itself stays reachable through #context.


[View source]

Instance Method Detail

def allowed_methods : Array(String) #

[View source]
def context : HTTP::Server::Context #

[View source]