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

Function test_fetch_404_error_handling

core/tests/python/tests/test_fetch.py:247–256  ·  view source on GitHub ↗

The fetch function should handle 404 responses gracefully.

()

Source from the content-addressed store, hash-verified

245
246
247async def test_fetch_404_error_handling():
248 """
249 The fetch function should handle 404 responses gracefully.
250 """
251 response = await fetch("https://jsonplaceholder.typicode.com/todos/999999")
252 assert not response.ok
253 assert response.status == 404
254 # Should still be able to extract data even from error responses.
255 data = await response.json()
256 assert data == {}
257
258
259async def test_fetch_error_response_with_text():

Callers

nothing calls this directly

Calls 2

fetchFunction · 0.90
jsonMethod · 0.45

Tested by

no test coverage detected