From f2b42ae72c36db7e4090771cd272afb3cfd4a126 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Thu, 24 Sep 2015 15:03:24 -0500 Subject: [PATCH] Allow cross-origin patches for config --- notebook/services/config/handlers.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/notebook/services/config/handlers.py b/notebook/services/config/handlers.py index 017c2c8ec..906602f2e 100644 --- a/notebook/services/config/handlers.py +++ b/notebook/services/config/handlers.py @@ -12,7 +12,7 @@ from ipython_genutils.py3compat import PY3 from ...base.handlers import APIHandler, json_errors class ConfigHandler(APIHandler): - SUPPORTED_METHODS = ('GET', 'PUT', 'PATCH') + SUPPORTED_METHODS = ('GET', 'PUT', 'PATCH', 'OPTIONS') @web.authenticated @json_errors @@ -34,6 +34,13 @@ class ConfigHandler(APIHandler): section = self.config_manager.update(section_name, new_data) self.finish(json.dumps(section)) + @web.authenticated + @json_errors + def options(self, section_name): + self.set_header('Access-Control-Allow-Headers', 'accept, content-type') + self.set_header('Access-Control-Allow-Methods', 'GET, PUT, PATCH') + self.finish() + # URL to handler mappings