From 95bd80b932242f12ba4c8223af3e17ba6f1642cb Mon Sep 17 00:00:00 2001 From: David Flores Date: Sat, 21 May 2022 08:49:44 -0600 Subject: [PATCH] Fixing `CORS` support (#1200) * Add `*args` and `**kwargs` to options function signature * Add `POST`, `GET` and `PATCH` to the Access-Control-Allow-Methods header * Add `access-control-allow-origin,authorization,content-type` to the allowed headers list --- flower/views/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/flower/views/__init__.py b/flower/views/__init__.py index 84245f3d1..ffef204b3 100644 --- a/flower/views/__init__.py +++ b/flower/views/__init__.py @@ -17,11 +17,12 @@ class BaseHandler(tornado.web.RequestHandler): def set_default_headers(self): self.set_header("Access-Control-Allow-Origin", "*") - self.set_header("Access-Control-Allow-Headers", "x-requested-with") + self.set_header("Access-Control-Allow-Headers", + "x-requested-with,access-control-allow-origin,authorization,content-type") self.set_header('Access-Control-Allow-Methods', - ' PUT, DELETE, OPTIONS') + ' PUT, DELETE, OPTIONS, POST, GET, PATCH') - def options(self): + def options(self, *args, **kwargs): self.set_status(204) self.finish()