aio-libs / aio-libs/aiohttp

Typings aren't generic enough when using `response_class`

Ouverte
#7,109 18 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
enhancement
Langage dominant
Python
Étoiles
16.5k
Forks
2.4k
Merge moyen
17 h 22 min
PR mergées (30 j)
212

Description

### 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

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.