djangorestframework-stubs icon indicating copy to clipboard operation
djangorestframework-stubs copied to clipboard

_MonkeyPatchedResponse missing attribute `wsgi_request`.

Open PedroPerpetua opened this issue 1 year ago • 0 comments

Bug report

What's wrong

The response comming from a request made with rest_framework.test.APIClient has an attribute wsgi_request of type WSGIRequest. Currently, if used, mypy will throw out an error: error: "_MonkeyPatchedResponse" has no attribute "wsgi_request".

How is that should be

No error should be thrown by mypy (if we type: ignore it, it works just fine in runtime).

System information

  • OS: Linux
  • python version: 3.11
  • django version: 4.1.7
  • mypy version: 1.1.1
  • django-stubs version: 1.16.0

PedroPerpetua avatar Apr 03 '23 09:04 PedroPerpetua