diff patchablegraph.py @ 23:8d6ba6d372c8

add CORS support to graph responses
author drewp@bigasterisk.com
date Sat, 23 Apr 2022 23:45:45 -0700
parents 8ec07d997cd5
children e11d407c46f8
line wrap: on
line diff
--- a/patchablegraph.py	Wed Nov 24 20:29:38 2021 -0800
+++ b/patchablegraph.py	Sat Apr 23 23:45:45 2022 -0700
@@ -263,3 +263,11 @@
 
     def unbind(self):
         self.masterGraph.removeObserver(self.onPatch)
+
+    def flush(self):
+        if getattr(self.settings, 'allowOrigin'):
+            allow = self.settings.allowOrigin
+            if allow != b'*':
+                raise NotImplementedError()
+            self.set_header(b"Access-Control-Allow-Origin", allow)
+        return CycloneGraphEventsHandler.flush(self)
\ No newline at end of file