We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7b1e50b commit 5e2bf6fCopy full SHA for 5e2bf6f
aiohttp/web_ws.py
@@ -36,7 +36,7 @@
36
from .log import ws_logger
37
from .streams import EofStream
38
from .typedefs import JSONDecoder, JSONEncoder
39
-from .web_exceptions import HTTPBadRequest, HTTPException
+from .web_exceptions import HTTPBadRequest, HTTPException, HTTPMethodNotAllowed
40
from .web_request import BaseRequest
41
from .web_response import StreamResponse
42
@@ -226,6 +226,9 @@ def _handshake(
226
self, request: BaseRequest
227
) -> Tuple["CIMultiDict[str]", Optional[str], int, bool]:
228
headers = request.headers
229
+ if request.method != hdrs.METH_GET:
230
+ raise HTTPMethodNotAllowed(request.method, {hdrs.METH_GET})
231
+
232
if "websocket" != headers.get(hdrs.UPGRADE, "").lower().strip():
233
raise HTTPBadRequest(
234
text=(
0 commit comments