From 3fd14dd07cbc148d72b6e62c28993bf2d7ce4398 Mon Sep 17 00:00:00 2001 From: kgriffs Date: Mon, 7 Apr 2014 18:20:13 -0500 Subject: [PATCH] fix(errors): Remove HTTPUpgradeRequired class The '426 Upgrade Required' status code is for renegotiating the protocol used to talk between client and server; the app should rely on the WSGI server to perform this work. BREAKING CHANGE: HTTPUpgradeRequired is no longer available, and so any apps relying on it will break. This should be a very small number of apps, if any, since protocol negotiation should be up to the WSGI host, not the app. --- falcon/exceptions.py | 18 ------------------ tests/test_httperror.py | 1 - 2 files changed, 19 deletions(-) diff --git a/falcon/exceptions.py b/falcon/exceptions.py index c90e441..60a6d14 100644 --- a/falcon/exceptions.py +++ b/falcon/exceptions.py @@ -254,24 +254,6 @@ class HTTPRangeNotSatisfiable(HTTPError): HTTPError.__init__(self, status.HTTP_416, None, None, headers=headers) -class HTTPUpgradeRequired(HTTPError): - """426 Upgrade Required. - - The protocol used by the client is not supported. It must retry the - request using the protocol identified in the Upgrade header. - - Args: - title (str): Error title. - description (str): Human-friendly description of the error, along with - a helpful suggestion or two. - kwargs (optional): Same as for ``HTTPError``. - - """ - - def __init__(self, title, description, **kwargs): - HTTPError.__init__(self, status.HTTP_426, title, description, **kwargs) - - class HTTPInternalServerError(HTTPError): """500 Internal Server Error. diff --git a/tests/test_httperror.py b/tests/test_httperror.py index fcd1af7..f870dfa 100644 --- a/tests/test_httperror.py +++ b/tests/test_httperror.py @@ -335,6 +335,5 @@ class TestHTTPError(testing.TestBase): self._misc_test(falcon.HTTPPreconditionFailed, falcon.HTTP_412) self._misc_test(falcon.HTTPUnsupportedMediaType, falcon.HTTP_415, needs_title=False) - self._misc_test(falcon.HTTPUpgradeRequired, falcon.HTTP_426) self._misc_test(falcon.HTTPInternalServerError, falcon.HTTP_500) self._misc_test(falcon.HTTPBadGateway, falcon.HTTP_502)