Hi,
I'm having issues with the serverextension that acts as a proxy.
In GitLab, the
namespaced path shall be URL-encoded: user/repository shall be encoded as
user%2FrepositoryGET /api/v4/projects/diaspora%2Fdiaspora
When I call
proxiedApiRequest<any>(requestUrl, this._serverSettings) with requestUrl set to
http://localhost:8888/gitlab/projects/gitlab-org%2Fci-training-sample/repository/tree? in javascript, on Python side, my handler gets the path
/projects/gitlab-org/ci-training-sample/repository/tree which of course results in a 404.
I'd expect to get
/projects/gitlab-org%2Fci-training-sample/repository/tree instead.
get: /projects/gitlab-org/ci-training-sample/repository/tree
[W 22:23:42.676 LabApp] 404 GET /gitlab/projects/gitlab-org%2Fci-training-sample/repository/tree?&1544131422149 (::1) 524.77ms referer=http://localhost:8888/lab
Is tornado automatically unescaping the endpoint? Is there a way around that?
The Python code is almost the same as for the jupyterlab_github extension. Any endpoint shall be passed to the handler:
class GitLabHandler(APIHandler):
@gen.coroutine
def get(self, path):
"""
Proxy API requests to GitLab, adding authentication parameter(s) if
they have been set.
"""
print(f"get: {path}")
...
def load_jupyter_server_extension(nb_server_app):
web_app = nb_server_app.web_app
base_url = web_app.settings["base_url"]
endpoint = url_path_join(base_url, "gitlab")
handlers = [(endpoint + "(.*)", GitLabHandler)]
web_app.add_handlers(".*$", handlers)