diff --git a/examples/teapot.py b/examples/teapot.py new file mode 100644 index 00000000..897f7836 --- /dev/null +++ b/examples/teapot.py @@ -0,0 +1,13 @@ +from sanic import Sanic +from sanic import response as res + +app = Sanic(__name__) + + +@app.route("/") +async def test(req): + return res.text("I\'m a teapot", status=418) + + +if __name__ == '__main__': + app.run(host="0.0.0.0", port=8000) diff --git a/sanic/response.py b/sanic/response.py index 902b21c6..3b0ef449 100644 --- a/sanic/response.py +++ b/sanic/response.py @@ -56,6 +56,7 @@ ALL_STATUS_CODES = { 415: b'Unsupported Media Type', 416: b'Requested Range Not Satisfiable', 417: b'Expectation Failed', + 418: b'I\'m a teapot', 422: b'Unprocessable Entity', 423: b'Locked', 424: b'Failed Dependency', @@ -63,6 +64,7 @@ ALL_STATUS_CODES = { 428: b'Precondition Required', 429: b'Too Many Requests', 431: b'Request Header Fields Too Large', + 451: b'Unavailable For Legal Reasons', 500: b'Internal Server Error', 501: b'Not Implemented', 502: b'Bad Gateway',