aio-libs / aio-libs/aiohttp

Typings aren't generic enough when using `response_class`

Đang mở
#7,109 18 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement
Ngôn ngữ chính
Python
Star
16.5k
Fork
2.4k
Merge trung bình
17 giờ 22 phút
Pull request đã merge (30 ngày)
212

Mô tả

### Describe the bug

The `ClientSession` class allows you to specify a `response_class` which is then used for responses in place of `ClientResponse` when handling responses. However the typings are not generic, they are hard coded to use `ClientResponse` so custom aspects of the `response_class` result in type errors.

### To Reproduce

1. Add a custom `response_class`
2. Use a request method on a `ClientSession`, e.g. `client.post()`
3. The `response_class` in 1 will be used, but it will still be typed as the default `ClientResponse`

### Expected behavior

Use the `response_class` type in typings.

### Versions

```console
python=3.10.8
aiohttp=3.8.3
```

### Code of Conduct

- [X] I agree to follow the aio-libs Code of Conduct

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.