From 2bb769eb5e36042181b3c2c8e7a09ee25c4f2cd3 Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Fri, 11 May 2018 16:14:01 -0400 Subject: [PATCH] support OPTIONS request method in aiohttp and sanic Fixes #70 --- engineio/async_aiohttp.py | 2 ++ engineio/async_sanic.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/engineio/async_aiohttp.py b/engineio/async_aiohttp.py index 97316485..d0e2a564 100644 --- a/engineio/async_aiohttp.py +++ b/engineio/async_aiohttp.py @@ -15,6 +15,8 @@ def create_route(app, engineio_server, engineio_endpoint): """ app.router.add_get(engineio_endpoint, engineio_server.handle_request) app.router.add_post(engineio_endpoint, engineio_server.handle_request) + app.router.add_route('OPTIONS', engineio_endpoint, + engineio_server.handle_request) def translate_request(request): diff --git a/engineio/async_sanic.py b/engineio/async_sanic.py index a4702ae9..8ff2eb8c 100644 --- a/engineio/async_sanic.py +++ b/engineio/async_sanic.py @@ -18,7 +18,7 @@ def create_route(app, engineio_server, engineio_endpoint): endpoint. """ app.add_route(engineio_server.handle_request, engineio_endpoint, - methods=['GET', 'POST']) + methods=['GET', 'POST', 'OPTIONS']) try: app.enable_websocket() except AttributeError: