Skip to content

"_MonkeyPatchedWSGIResponse" has no attribute "redirect_chain" #1085

@monosans

Description

@monosans

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions