From ae82f112b93d30ce14c7b116686519c4124fa425 Mon Sep 17 00:00:00 2001 From: zhanba Date: Thu, 20 Jul 2023 09:59:53 +0800 Subject: [PATCH] fix: replace JupyterHandler with APIHandler --- .../jupyter_lsp/jupyter_lsp/handlers.py | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/python_packages/jupyter_lsp/jupyter_lsp/handlers.py b/python_packages/jupyter_lsp/jupyter_lsp/handlers.py index 2f0afd24b..41cfc1bc8 100644 --- a/python_packages/jupyter_lsp/jupyter_lsp/handlers.py +++ b/python_packages/jupyter_lsp/jupyter_lsp/handlers.py @@ -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 @@ -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): @@ -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"""