class
Kemal::Controller::Halt
- Kemal::Controller::Halt
- Exception
- Reference
- Object
Overview
Raised by halt to abort the current request.
The generated route handler rescues it, applies #status_code to the response and
returns #response as the body. WebSocket routes close the socket with
HTTP::WebSocket::CloseCode::PolicyViolation instead, using #response as the reason.
Raise it directly when halt isn't in scope, e.g. from a helper defined in an
included module rather than in the controller itself:
raise Kemal::Controller::Halt.new(403, "Forbidden")
Defined in:
kemal/controller.crConstructors
Instance Method Summary
-
#response : String
The response body, or the WebSocket close reason.
-
#status_code : Int32
The HTTP status code to respond with.