Skip to content

Commit

Permalink
fix: replace JupyterHandler with APIHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
zhanba committed Jul 20, 2023
1 parent 19a4cc3 commit ae82f11
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions python_packages/jupyter_lsp/jupyter_lsp/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
from typing import Optional, Text

from jupyter_server.base.handlers import JupyterHandler
from jupyter_server.base.handlers import APIHandler
from jupyter_server.base.zmqhandlers import WebSocketHandler, WebSocketMixin
from jupyter_server.utils import url_path_join as ujoin

Expand All @@ -11,7 +11,7 @@
from .specs.utils import censored_spec


class BaseHandler(JupyterHandler):
class BaseHandler(APIHandler):
manager = None # type: LanguageServerManager

def initialize(self, manager: LanguageServerManager):
Expand Down Expand Up @@ -75,21 +75,6 @@ async def get(self):

self.finish(response)

def options(self, *args, **kwargs):
"""Get the options."""
self.log.warning("handle options request: %s", self.request.path)
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")


def add_handlers(nbapp):
"""Add Language Server routes to the notebook server web application"""
Expand Down

0 comments on commit ae82f11

Please sign in to comment.