Skip to content

Typings aren't generic enough when using response_class #7109

@connebs

Description

@connebs

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

python=3.10.8
aiohttp=3.8.3

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions