Allow cross-origin patches for config

This commit is contained in:
Steven Silvester 2015-09-24 15:03:24 -05:00
parent 7a197feb33
commit f2b42ae72c

View File

@ -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