MCPcopy Index your code
hub / github.com/pyscript/pyscript / test_fetch_with_post_method

Function test_fetch_with_post_method

core/tests/python/tests/test_fetch.py:161–177  ·  view source on GitHub ↗

The fetch function should support POST requests.

()

Source from the content-addressed store, hash-verified

159
160
161async def test_fetch_with_post_method():
162 """
163 The fetch function should support POST requests.
164 """
165 response = await fetch(
166 "https://jsonplaceholder.typicode.com/posts",
167 method="POST",
168 headers={"Content-Type": "application/json"},
169 body=json.dumps({"title": "foo", "body": "bar", "userId": 1}),
170 )
171 assert response.ok
172 assert response.status == 201
173 data = await response.json()
174 assert data["title"] == "foo"
175 assert data["body"] == "bar"
176 assert data["userId"] == 1
177 assert "id" in data
178
179
180async def test_fetch_with_put_method():

Callers

nothing calls this directly

Calls 2

fetchFunction · 0.90
jsonMethod · 0.45

Tested by

no test coverage detected