Fix valid method condition

This commit is contained in:
0880
2026-01-20 22:19:57 +03:30
parent e679865e50
commit f91943cde2

View File

@@ -100,7 +100,7 @@ class App:
method: str, method: str,
func: Callable[[Request, ...], Awaitable[Response]], func: Callable[[Request, ...], Awaitable[Response]],
): ):
if method not in ["GET", "POST", "PUT", "DELETE"]: if method not in ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD"]:
raise RuntimeError(f'Invalid method "{method}".') raise RuntimeError(f'Invalid method "{method}".')
pat = self._pattern_to_regex(path) pat = self._pattern_to_regex(path)
if pat not in self.routes: if pat not in self.routes: