Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions kernel_gateway/services/sessions/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ def get(self):
else:
super(SessionRootHandler, self).get()

class SessionHandler(TokenAuthorizationMixin,
CORSMixin,
JSONErrorsMixin,
notebook_handlers.SessionHandler):
"""Extends the notebook session handler with token auth, CORS, and
JSON errors.
"""
def set_default_headers(self):
self.set_header('Content-Type', 'application/json')
self.set_header('Access-Control-Allow-Origin', '*')
self.set_header('Access-Control-Allow-Headers', 'content-type')
self.set_header('Access-Control-Allow-Methods', 'DELETE')

def options(self, **kwargs):
"""Method for properly handling CORS pre-flight"""
self.finish()

default_handlers = []
for path, cls in notebook_handlers.default_handlers:
if cls.__name__ in globals():
Expand Down