The fetch function should support PUT requests.
()
| 178 | |
| 179 | |
| 180 | async 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 | |
| 199 | async def test_fetch_with_delete_method(): |