Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"_MonkeyPatchedWSGIResponse" has no attribute "redirect_chain" #1085

Closed
monosans opened this issue Aug 4, 2022 · 1 comment
Closed

"_MonkeyPatchedWSGIResponse" has no attribute "redirect_chain" #1085

monosans opened this issue Aug 4, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@monosans
Copy link
Contributor

monosans commented Aug 4, 2022

Bug report

What's wrong

from django.test import Client

c = Client()
response = c.get("/admin/", follow=True)
response.redirect_chain  # "_MonkeyPatchedWSGIResponse" has no attribute "redirect_chain"

How is that should be

If the follow=True argument was passed, the response object must have the redirect_chain attribute, otherwise it must not.

Quote from docs: If you set follow to True the client will follow any redirects and a redirect_chain attribute will be set in the response object containing tuples of the intermediate urls and status codes.

The type of this attribute is List[Tuple[str, int]].

System information

  • OS: Arch Linux
  • python version: 3.10.5
  • django version: 4.1
  • mypy version: 0.961 and 0.971
  • django-stubs version: 1.12.0
  • django-stubs-ext version: 0.5.0
@monosans monosans added the bug Something isn't working label Aug 4, 2022
@adamchainz
Copy link
Contributor

Fixed in #1124. Please use a Git install to pull in this type (example) to resolve this problem until the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

2 participants