Skip to content

Commit

Permalink
Allow crossdomain AJAX requests to the API
Browse files Browse the repository at this point in the history
  • Loading branch information
kjagiello committed Aug 24, 2012
1 parent bb04910 commit 751d4ad
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions thunderpush/api.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ def response(self, data, code=200):
def error(self, message, code=500): def error(self, message, code=500):
self.response({"message": message}, code) 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): class ChannelHandler(ThunderApiHandler):
@is_authenticated @is_authenticated
Expand Down

0 comments on commit 751d4ad

Please sign in to comment.