Fix: Added CORS header to REST API to allow cross-domain calls from modern browsers.
[osm/vim-emu.git] / src / emuvim / api / rest / network.py
index 83fbde7..2745602 100755 (executable)
@@ -39,6 +39,8 @@ import json
 
 logging.basicConfig(level=logging.INFO)
 
+CORS_HEADER = {'Access-Control-Allow-Origin': '*'}
+
 net = None
 
 
@@ -98,7 +100,7 @@ class NetworkAction(Resource):
                 cookie=cookie,
                 priority=priority)
             # return setChain response
-            return str(c), 200
+            return str(c), 200, CORS_HEADER
         except Exception as ex:
             logging.exception("API error.")
-            return ex.message, 500
\ No newline at end of file
+            return ex.message, 500, CORS_HEADER