From 06dadf14fee73489dc7b838425ccb2ce2c11984f Mon Sep 17 00:00:00 2001 From: Ske Date: Thu, 28 Feb 2019 17:44:35 +0100 Subject: [PATCH] Revert "Add CORS headers to API responses" This reverts commit 6952de98cf6b27e4e9b4ae10a181c3261f8d6d96. --- src/api_main.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/api_main.py b/src/api_main.py index bdb18cea..7fe9484c 100644 --- a/src/api_main.py +++ b/src/api_main.py @@ -169,11 +169,6 @@ async def get_stats(request: web.Request, conn): "messages": message_count }) -@web.middleware -async def add_cors_headers(request, handler): - resp = await handler(request) - resp.headers["Access-Control-Allow-Origin"] = "*"; - return resp @web.middleware async def render_pk_errors(request, handler): @@ -183,7 +178,7 @@ async def render_pk_errors(request, handler): raise web.HTTPBadRequest(body=e.message) -app = web.Application(middlewares=[render_pk_errors, add_cors_headers]) +app = web.Application(middlewares=[render_pk_errors]) app.add_routes([ web.get("/systems/{id}", get_system), web.get("/systems/{id}/switches", get_switches),