changeset 23:8d6ba6d372c8

add CORS support to graph responses
author drewp@bigasterisk.com
date Sat, 23 Apr 2022 23:45:45 -0700
parents 3ff5e739f4b1
children 1eac25669333
files patchablegraph.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
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