Skip to content
Snippets Groups Projects
Commit 6896aa54 authored by ptangu01's avatar ptangu01
Browse files

add CORS support

git-svn-id: https://redmine.imt-atlantique.fr/svn/xaal/code/Python/trunk@1048 b32b6428-25c9-4566-ad07-03861ab6144f
parent 6c3e5031
No related branches found
No related tags found
No related merge requests found
......@@ -39,6 +39,8 @@ class Devices(object):
db.close()
cherrypy.response.headers['Content-Type'] = "application/json"
#TODO CORS
cherrypy.response.headers['Access-Control-Allow-Origin'] = '*'
if addr == None:
return ujson.dumps(devices)
......@@ -79,6 +81,8 @@ class Sender(object):
body=body)
self.eng.queue(msg)
cherrypy.response.headers['Content-Type'] = "application/json"
#TODO CORS
cherrypy.response.headers['Access-Control-Allow-Origin'] = '*'
return ujson.dumps({'success':True})
......@@ -98,6 +102,8 @@ class Notifications(object):
cherrypy.response.headers["Content-Type"] = "text/event-stream;charset=utf-8"
cherrypy.response.headers['Cache-Control'] = 'no-cache'
cherrypy.response.headers['Connection'] = 'keep-alive'
#TODO CORS
cherrypy.response.headers['Access-Control-Allow-Origin'] = '*'
def stream():
# create stream
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment