Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow crossdomain AJAX requests to the API

  • Loading branch information...
commit 751d4adcf8141b196d5fb128bfb8de197d487f64 1 parent bb04910
@kjagiello kjagiello authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 thunderpush/api.py
View
8 thunderpush/api.py
@@ -58,6 +58,14 @@ def response(self, data, code=200):
def error(self, message, code=500):
self.response({"message": message}, code)
+ def prepare(self, *args, **kwargs):
+ self.set_header("Access-Control-Allow-Origin", "*")
+ self.set_header("Access-Control-Allow-Headers", "X-Thunder-Secret-Key")
+ self.set_header("Access-Control-Allow-Methods", "GET, POST, DELETE")
+
+ def options(self, *args, **kwargs):
+ pass
+
class ChannelHandler(ThunderApiHandler):
@is_authenticated
Please sign in to comment.
Something went wrong with that request. Please try again.