aio-libs / aio-libs/aiohttp

Typings aren't generic enough when using `response_class`

Offen
#7,109 18 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Python
Sterne
16.5k
Forks
2.4k
Ø Merge
17 Std. 22 Min.
Gemergte PRs (30 T.)
212

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.