You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use return "<p>Hello, World!</p>" and mark the return type as str. But figuring out the right type is tiring, is a maintenance burden and arguably introduces unnecessary variation in the code.
Use return quart.Response("<p>Hello, World!</p>") but it quickly breaks for more complex types. I spent a lot of time trying to understand why quart.Response({"headers": "foo", "params': "bar"}) was returning "headersparams"!
Steps to reproduce
With the following Quart app:
mypy fails because
make_response
does not return aResponse
:Expected result
I would expect validation to pass. Indeed, the equivalent Flask app passes validation:
Workarounds
return "<p>Hello, World!</p>"
and mark the return type asstr
. But figuring out the right type is tiring, is a maintenance burden and arguably introduces unnecessary variation in the code.return quart.Response("<p>Hello, World!</p>")
but it quickly breaks for more complex types. I spent a lot of time trying to understand whyquart.Response({"headers": "foo", "params': "bar"})
was returning "headersparams"!quart.typing. ResponseTypes
. This is what I'm doing right now in the urllib3 tests (Migrate TestPoolManager to Hypercorn urllib3/urllib3#3193) but I would rather useResponse
.Environment
The text was updated successfully, but these errors were encountered: