module
Orion::Controller::StatusHelpers
Overview
HTTP Status Code Helpers Provides semantic methods for setting HTTP status codes
Usage: get "/not-found" do not_found! end
get "/api/user" do unauthorized! json: {error: "Invalid token"} end
Direct including types
Defined in:
orion/controller/status_helpers.crInstance Method Summary
- #accepted!(message : String | Nil = nil)
- #bad_gateway!(message : String = "Bad Gateway")
-
#bad_request!(message : String = "Bad Request", *, json = nil)
4xx Client Errors
- #conflict!(message : String = "Conflict", *, json = nil)
- #created!(message : String | Nil = nil, *, json = nil, location : String | Nil = nil)
- #forbidden!(message : String = "Forbidden", *, json = nil)
- #found!(location : String)
- #gateway_timeout!(message : String = "Gateway Timeout")
- #gone!(message : String = "Gone")
-
#head(status : Int32 | Symbol)
Head response (status only, no body)
-
#internal_server_error!(message : String = "Internal Server Error", *, json = nil)
5xx Server Errors
- #method_not_allowed!(message : String = "Method Not Allowed", allowed_methods : Array(String) | Nil = nil)
-
#moved_permanently!(location : String)
3xx Redirection
- #no_content!
- #not_acceptable!(message : String = "Not Acceptable")
- #not_found!(message : String = "Not Found", *, json = nil)
- #not_implemented!(message : String = "Not Implemented")
- #not_modified!
-
#ok!(message : String | Nil = nil)
2xx Success
- #payment_required!(message : String = "Payment Required")
- #permanent_redirect!(location : String)
- #see_other!(location : String)
- #service_unavailable!(message : String = "Service Unavailable", retry_after : Int32 | Nil = nil)
-
#status(code : Int32)
Generic status setter
- #temporary_redirect!(location : String)
- #too_many_requests!(message : String = "Too Many Requests", retry_after : Int32 | Nil = nil)
- #unauthorized!(message : String = "Unauthorized", *, json = nil, www_authenticate : String | Nil = nil)
- #unprocessable_entity!(message : String = "Unprocessable Entity", *, json = nil)
Instance Method Detail
5xx Server Errors
def method_not_allowed!(message : String = "Method Not Allowed", allowed_methods : Array(String) | Nil = nil)
#
def unauthorized!(message : String = "Unauthorized", *, json = nil, www_authenticate : String | Nil = nil)
#