fix: force upgrade for all http methods
Python Lint CI / ruff-format-check (push) Successful in 1m2s
Python Lint CI / ruff (push) Successful in 1m4s
Python Lint CI / ty (push) Successful in 1m10s
Docker CI / docker-build (push) Successful in 2m32s
Python Test CI / coverage (push) Successful in 3m26s
Python Lint CI / ruff-format-check (push) Successful in 1m2s
Python Lint CI / ruff (push) Successful in 1m4s
Python Lint CI / ty (push) Successful in 1m10s
Docker CI / docker-build (push) Successful in 2m32s
Python Test CI / coverage (push) Successful in 3m26s
This commit is contained in:
@@ -689,3 +689,24 @@ class UpgradeHandler(RequestHandler):
|
|||||||
self.close_connection = True
|
self.close_connection = True
|
||||||
else:
|
else:
|
||||||
self.do_HEAD()
|
self.do_HEAD()
|
||||||
|
|
||||||
|
def do_POST(self) -> None:
|
||||||
|
self.do_HEAD()
|
||||||
|
|
||||||
|
def do_PUT(self) -> None:
|
||||||
|
self.do_HEAD()
|
||||||
|
|
||||||
|
def do_DELETE(self) -> None:
|
||||||
|
self.do_HEAD()
|
||||||
|
|
||||||
|
def do_OPTIONS(self) -> None:
|
||||||
|
self.do_HEAD()
|
||||||
|
|
||||||
|
def do_PATCH(self) -> None:
|
||||||
|
self.do_HEAD()
|
||||||
|
|
||||||
|
def do_CONNECT(self) -> None:
|
||||||
|
self.do_HEAD()
|
||||||
|
|
||||||
|
def do_TRACE(self) -> None:
|
||||||
|
self.do_HEAD()
|
||||||
|
|||||||
+15
-14
@@ -1358,21 +1358,22 @@ class TestUpgradeHandler(BaseHandlerTestCase):
|
|||||||
handler.data_dir = self.data_dir
|
handler.data_dir = self.data_dir
|
||||||
return handler
|
return handler
|
||||||
|
|
||||||
def test_do_get(self) -> None:
|
def test_do_upgrade(self) -> None:
|
||||||
handler = self._get_handler("/file")
|
handler = self._get_handler("/file")
|
||||||
with (
|
for method in [method.value for method in http.HTTPMethod]:
|
||||||
self.expects_status_only(
|
with (
|
||||||
handler,
|
self.subTest(None, method=method),
|
||||||
http.HTTPStatus.MOVED_PERMANENTLY,
|
self.expects_status_only(
|
||||||
headers={"Location": "https://localhost/file"},
|
handler,
|
||||||
),
|
http.HTTPStatus.MOVED_PERMANENTLY,
|
||||||
self.patch(
|
headers={"Location": "https://localhost/file"},
|
||||||
"http.server.SimpleHTTPRequestHandler.do_GET",
|
),
|
||||||
count=0,
|
self.patch(
|
||||||
),
|
f"http.server.SimpleHTTPRequestHandler.do_{method}", count=0
|
||||||
self.seal_mocks(),
|
),
|
||||||
):
|
self.seal_mocks(),
|
||||||
handler.do_GET()
|
):
|
||||||
|
getattr(handler, f"do_{method}")()
|
||||||
|
|
||||||
def test_do_get_certbot(self) -> None:
|
def test_do_get_certbot(self) -> None:
|
||||||
handler = self._get_handler("/.well-known/acme-challenge/abcde")
|
handler = self._get_handler("/.well-known/acme-challenge/abcde")
|
||||||
|
|||||||
Reference in New Issue
Block a user