Skip to content

Enable header overrides in jp_ws_fetch fixture #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
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
5 changes: 3 additions & 2 deletions pytest_jupyter/jupyter_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,9 @@ def client_fetch(*parts, headers=None, params=None, **kwargs):
urlparts = urllib.parse.urlparse(f"ws://localhost:{jp_http_port}")
urlparts = urlparts._replace(path=base_path_url, query=urllib.parse.urlencode(params))
url = urlparts.geturl()
# Add auth keys to header
headers.update(jp_auth_header)
# Add auth keys to header, if not overridden
for key, value in jp_auth_header.items():
headers.setdefault(key, value)
# Make request.
req = tornado.httpclient.HTTPRequest(url, headers=headers, connect_timeout=120)
return tornado.websocket.websocket_connect(req)
Expand Down