class Halite::Redirector
- Halite::Redirector
- Reference
- Object
Defined in:
halite/redirector.crConstant Summary
-
REDIRECT_CODES =
[300, 301, 302, 303, 307, 308]
-
HTTP status codes which indicate redirects
-
SEE_OTHER_ALLOWED_VERBS =
["GET", "HEAD"] of ::String
-
Verbs which will remain unchanged upon See Other response.
-
STRICT_SENSITIVE_CODES =
[300, 301, 302]
-
Codes which which should raise StateError in strict mode if original request was any of {UNSAFE_VERBS}
-
UNSAFE_VERBS =
["PUT", "DELETE", "POST"] of ::String
-
Insecure http verbs, which should trigger StateError in strict mode upon {STRICT_SENSITIVE_CODES}
Constructors
- .new(request : Halite::Request, response : Halite::Response, options : Halite::Options)
-
.new(request : Halite::Request, response : Halite::Response, max_hops : Int32 = 5, strict : Bool = true)
Instance a new Redirector
Instance Method Summary
-
#avaiable?
Return
true
if it should redirect, elsefalse
-
#each_redirect(&block : Halite::Request -> Halite::Response)
Loop each redirect request with block call
-
#endless_loop?
Check if we got into an endless loop
- #max_hops : Int32
-
#perform(&block : Halite::Request -> Halite::Response) : Halite::Response
Follows redirects until non-redirect response found
- #strict : Bool
Constructor Detail
def self.new(request : Halite::Request, response : Halite::Response, max_hops : Int32 = 5, strict : Bool = true)
#
Instance a new Redirector
Instance Method Detail
Loop each redirect request with block call
Follows redirects until non-redirect response found