File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
kernel_gateway/services/sessions Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,23 @@ def get(self):
27
27
else :
28
28
super (SessionRootHandler , self ).get ()
29
29
30
+ class SessionHandler (TokenAuthorizationMixin ,
31
+ CORSMixin ,
32
+ JSONErrorsMixin ,
33
+ notebook_handlers .SessionHandler ):
34
+ """Extends the notebook session handler with token auth, CORS, and
35
+ JSON errors.
36
+ """
37
+ def set_default_headers (self ):
38
+ self .set_header ('Content-Type' , 'application/json' )
39
+ self .set_header ('Access-Control-Allow-Origin' , '*' )
40
+ self .set_header ('Access-Control-Allow-Headers' , 'content-type' )
41
+ self .set_header ('Access-Control-Allow-Methods' , 'DELETE' )
42
+
43
+ def options (self , ** kwargs ):
44
+ """Method for properly handling CORS pre-flight"""
45
+ self .finish ()
46
+
30
47
default_handlers = []
31
48
for path , cls in notebook_handlers .default_handlers :
32
49
if cls .__name__ in globals ():
You can’t perform that action at this time.
0 commit comments