Skip to content

Commit

Permalink
Backport PR jupyter-server#798: missing required arguments in utils.f…
Browse files Browse the repository at this point in the history
…etch
  • Loading branch information
minrk authored and meeseeksmachine committed Apr 25, 2022
1 parent bb677f5 commit e374eee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion jupyter_server/serverapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ def shutdown_server(server_info, timeout=5, log=None):
if log:
log.debug("POST request to %sapi/shutdown", url)

fetch(url, method="POST", headers={"Authorization": "token " + server_info["token"]})
fetch(url, method="POST", body=b"", headers={"Authorization": "token " + server_info["token"]})
# Poll to see if it shut down.
for _ in range(timeout * 10):
if not check_pid(pid):
Expand Down
8 changes: 6 additions & 2 deletions jupyter_server/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,9 @@ def fetch(urlstring, method="GET", body=None, headers=None):
Send a HTTP, HTTPS, or HTTP+UNIX request
to a Tornado Web Server. Returns a tornado HTTPResponse.
"""
with _request_for_tornado_client(urlstring) as request:
with _request_for_tornado_client(
urlstring, method=method, body=body, headers=headers
) as request:
response = HTTPClient(AsyncHTTPClient).fetch(request)
return response

Expand All @@ -356,7 +358,9 @@ async def async_fetch(urlstring, method="GET", body=None, headers=None, io_loop=
Send an asynchronous HTTP, HTTPS, or HTTP+UNIX request
to a Tornado Web Server. Returns a tornado HTTPResponse.
"""
with _request_for_tornado_client(urlstring) as request:
with _request_for_tornado_client(
urlstring, method=method, body=body, headers=headers
) as request:
response = await AsyncHTTPClient(io_loop).fetch(request)
return response

Expand Down

0 comments on commit e374eee

Please sign in to comment.