Fix CORS duplicate registration (#15670)

This commit is contained in:
Paulus Schoutsen authored and GitHub committed 2018-07-25 11:36:44 +02:00
1 parent 68f03dcc67
commit 169c8d793a
3 files changed
+58 -22

No files matched your search

+3 -5
View File
@@ -69,15 +69,13 @@ class HomeAssistantView:
handler = request_handler_factory(self, handler)
for url in urls:
routes.append(
(method, router.add_route(method, url, handler))
)
routes.append(router.add_route(method, url, handler))
if not self.cors_allowed:
return
for method, route in routes:
app['allow_cors'](route, [method.upper()])
for route in routes:
app['allow_cors'](route)
def request_handler_factory(view, handler):