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

Function test_fetch_with_put_method

core/tests/python/tests/test_fetch.py:180–196  ·  view source on GitHub ↗

The fetch function should support PUT requests.

()

Source from the content-addressed store, hash-verified

178
179
180async def test_fetch_with_put_method():
181 """
182 The fetch function should support PUT requests.
183 """
184 response = await fetch(
185 "https://jsonplaceholder.typicode.com/posts/1",
186 method="PUT",
187 headers={"Content-Type": "application/json"},
188 body=json.dumps(
189 {"id": 1, "title": "updated", "body": "updated body", "userId": 1}
190 ),
191 )
192 assert response.ok
193 assert response.status == 200
194 data = await response.json()
195 assert data["title"] == "updated"
196 assert data["body"] == "updated body"
197
198
199async def test_fetch_with_delete_method():

Callers

nothing calls this directly

Calls 2

fetchFunction · 0.90
jsonMethod · 0.45

Tested by

no test coverage detected