refactor(handlers): handle all http methods
This commit is contained in:
@@ -313,12 +313,30 @@ class RequestHandler(http.server.SimpleHTTPRequestHandler, BaseHandler):
|
||||
self.registry.set_host(path, self.target_host)
|
||||
return None
|
||||
|
||||
def do_POST(self) -> None:
|
||||
self.do_PUT() # be gentle on them
|
||||
|
||||
def do_PATCH(self) -> None:
|
||||
self.do_PUT() # be gentle on them
|
||||
|
||||
def do_DELETE(self) -> None:
|
||||
self._pre_log_request()
|
||||
if (path := self.__check_update_request()) is None:
|
||||
return None
|
||||
return self._update_remove(path)
|
||||
|
||||
def do_CONNECT(self) -> None:
|
||||
self._pre_log_request()
|
||||
self.send_error(http.HTTPStatus.METHOD_NOT_ALLOWED)
|
||||
|
||||
def do_OPTIONS(self) -> None:
|
||||
self._pre_log_request()
|
||||
self.send_error(http.HTTPStatus.METHOD_NOT_ALLOWED)
|
||||
|
||||
def do_TRACE(self) -> None:
|
||||
self._pre_log_request()
|
||||
self.send_error(http.HTTPStatus.METHOD_NOT_ALLOWED)
|
||||
|
||||
def _update_extract(self, path: str) -> None:
|
||||
if self.in_size == 0:
|
||||
return self.send_error(http.HTTPStatus.LENGTH_REQUIRED, "No body found")
|
||||
|
||||
Reference in New Issue
Block a user