Skip to content

Commit 943aab5

Browse files
committed
fix: close connection when handling errors (warning on Python 3.14)
1 parent 3b4e7b5 commit 943aab5

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,16 @@ response.status
6363

6464
## Running the tests
6565

66-
```sh
67-
> python3 -m unittest thttp.py
66+
Use `uvx` to run tests with coverage and a specific Python version:
67+
68+
```
69+
uvx --python=3.14 coverage run -m unittest thttp.py
6870
```
6971

7072
And to check the coverage:
7173

72-
```sh
73-
> coverage run -m unittest thttp.py
74-
> coverage html && open htmlcov/index.html
7574
```
76-
77-
Run `black` before committing any changes.
78-
79-
```sh
80-
> black thttp.py
75+
uvx coverage html && open htmlcov/index.html
8176
```
8277

8378

thttp.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ def request(
156156
if "application/json" in headers.get("content-type", "").lower() and content
157157
else None
158158
)
159+
e.close()
159160

160161
return Response(req, content, json, status, resp_url, headers, cookiejar)
161162

0 commit comments

Comments
 (0)