Define a set of HTTPStatus subclasses that can be raised to perform various types of HTTP redirects. This should avoid the problem of hooks and responder methods possibly overriding the redirect. Raising an instance of one of these classes and will short-circuit request processing similar to raising an instance of HTTPError. Specifically, if raised in a before hook, it will skip any remaining hooks and the responder method, but will not skip any process_response middleware methods. If raised within a responder, it will skip the rest of the responder and all after hooks. If raised in an after hook, it would skip remaining after hooks but not middleware methods. And finally, if raised within a middleware method, execution would perceive as described at the bottom of [1]. The above behavior is inherited from HTTPStatus and so is not re-tested in the subclasses. [1]: https://falcon.readthedocs.org/en/stable/api/middleware.html Closes #406
595 B
595 B
Redirection
Falcon defines a set of exceptions that can be raised within a
middleware method, hook, or responder in order to trigger a 3xx
(Redirection) response to the client. Raising one of these classes
short-circuits request processing in a manner similar to raising an
instance or subclass of :py~.HTTPError
Base Class
falcon.http_status.HTTPStatus
Redirects
falcon