Skip to content

Commit

Permalink
Fixing CORS support (#1200)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
daveflr committed May 21, 2022
1 parent df35564 commit 95bd80b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions flower/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 95bd80b

Please sign in to comment.