Allow access control headers to be overriden in jupyter_notebook_config.py

This commit is contained in:
Bill Major 2018-08-28 15:42:15 -04:00
parent 98085dcb84
commit cc5e08d1bc

View File

@ -607,8 +607,11 @@ class APIHandler(IPythonHandler):
return super(APIHandler, self).finish(*args, **kwargs)
def options(self, *args, **kwargs):
self.set_header('Access-Control-Allow-Headers',
'accept, content-type, authorization, x-xsrftoken')
if 'Access-Control-Allow-Headers' in self.settings.get('headers', {}):
self.set_header('Access-Control-Allow-Headers', self.settings['headers']['Access-Control-Allow-Headers'])
else:
self.set_header('Access-Control-Allow-Headers',
'accept, content-type, authorization, x-xsrftoken')
self.set_header('Access-Control-Allow-Methods',
'GET, PUT, POST, PATCH, DELETE, OPTIONS')