Skip to content

Commit 90b00b4

Browse files
Improved doc string for jp_fetch to include how to provide query parameters in GET and json data in POST (#83)
* Improved doc string * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * made argument order more consistent in POST * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 9312bc4 commit 90b00b4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

pytest_jupyter/jupyter_server.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,25 @@ def jp_fetch(jp_serverapp, http_server_client, jp_auth_header, jp_base_url):
268268
async def my_test(jp_fetch):
269269
response = await jp_fetch("api", "spec.yaml")
270270
...
271+
272+
With query parameters:
273+
274+
.. code-block:: python
275+
276+
async def my_test(jp_fetch):
277+
response = await jp_fetch("api", "spec.yaml", params={"parameter": "value"})
278+
...
279+
280+
A POST request with data:
281+
282+
.. code-block:: python
283+
284+
async def my_test(jp_fetch):
285+
response = await jp_fetch(
286+
"api", "spec.yaml", method="POST", body=json.dumps({"parameter": "value"})
287+
)
288+
...
289+
271290
"""
272291

273292
def client_fetch(*parts, headers=None, params=None, **kwargs):

0 commit comments

Comments
 (0)