Status Codes
Status Codes
Falcon provides a list of constants for common HTTP response status codes.
For example:
# Override the default "200 OK" response status resp.status = falcon.HTTP_409
Or, using the more verbose name:
resp.status = falcon.HTTP_CONFLICT
Using these constants helps avoid typos and cuts down on the number of string objects that must be created when preparing responses.
Falcon also provides a generic HTTPStatus
class. Raise this class from a hook, middleware, or a responder to stop handling the request and skip to the response handling. It takes status, additional headers and body as input arguments.
HTTPStatus
-
class falcon.HTTPStatus(status, hea