Skip to content

Commit ffa9848

Browse files
Backport PR #798 on branch 1.x (missing required arguments in utils.fetch) (#799)
Co-authored-by: Min RK <[email protected]>
1 parent bb677f5 commit ffa9848

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

jupyter_server/serverapp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ def shutdown_server(server_info, timeout=5, log=None):
504504
if log:
505505
log.debug("POST request to %sapi/shutdown", url)
506506

507-
fetch(url, method="POST", headers={"Authorization": "token " + server_info["token"]})
507+
fetch(url, method="POST", body=b"", headers={"Authorization": "token " + server_info["token"]})
508508
# Poll to see if it shut down.
509509
for _ in range(timeout * 10):
510510
if not check_pid(pid):

jupyter_server/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,9 @@ def fetch(urlstring, method="GET", body=None, headers=None):
346346
Send a HTTP, HTTPS, or HTTP+UNIX request
347347
to a Tornado Web Server. Returns a tornado HTTPResponse.
348348
"""
349-
with _request_for_tornado_client(urlstring) as request:
349+
with _request_for_tornado_client(
350+
urlstring, method=method, body=body, headers=headers
351+
) as request:
350352
response = HTTPClient(AsyncHTTPClient).fetch(request)
351353
return response
352354

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

0 commit comments

Comments
 (0)