encode / starlette

The little ASGI framework that shines. 🌟
https://www.starlette.io/
BSD 3-Clause "New" or "Revised" License
10.32k stars 948 forks source link

Add `ContentType` generic to `Response` #2547

Closed Kludex closed 2 hours ago

Kludex commented 8 months ago

At the time that PR was implemented the default= parameter was not available on TypeVar, and mypy didn't support it.

Now it's possible to achieve what that PR intended.

Kludex commented 8 months ago

I think JsonResponse and others don’t actually accept Any, they accept a limited set of types. Is that codified in this PR? If it is I’m missing it.

You are right, but I'm not changing that in this PR. And I think there was an attempt to change the type, but it failed, and we had to revert.