Home / Function/ test_header_and_body_removal_on_redirect() — requests Function Reference

test_header_and_body_removal_on_redirect() — requests Function Reference

Architecture documentation for the test_header_and_body_removal_on_redirect() function in test_requests.py from the requests codebase.

Entity Profile

Dependency Diagram

graph TD
  9a236e9a_b045_255f_928c_3258771b2bce["test_header_and_body_removal_on_redirect()"]
  22b80b19_26d4_cd0e_c476_3edf87b3df14["TestRequests"]
  9a236e9a_b045_255f_928c_3258771b2bce -->|defined in| 22b80b19_26d4_cd0e_c476_3edf87b3df14
  772251a3_91b5_d6a8_857f_bb938ed045f7["send()"]
  9a236e9a_b045_255f_928c_3258771b2bce -->|calls| 772251a3_91b5_d6a8_857f_bb938ed045f7
  style 9a236e9a_b045_255f_928c_3258771b2bce fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_requests.py lines 312–327

    def test_header_and_body_removal_on_redirect(self, httpbin):
        purged_headers = ("Content-Length", "Content-Type")
        ses = requests.Session()
        req = requests.Request("POST", httpbin("post"), data={"test": "data"})
        prep = ses.prepare_request(req)
        resp = ses.send(prep)

        # Mimic a redirect response
        resp.status_code = 302
        resp.headers["location"] = "get"

        # Run request through resolve_redirects
        next_resp = next(ses.resolve_redirects(resp, prep))
        assert next_resp.request.body is None
        for header in purged_headers:
            assert header not in next_resp.request.headers

Domain

Subdomains

Calls

Frequently Asked Questions

What does test_header_and_body_removal_on_redirect() do?
test_header_and_body_removal_on_redirect() is a function in the requests codebase, defined in tests/test_requests.py.
Where is test_header_and_body_removal_on_redirect() defined?
test_header_and_body_removal_on_redirect() is defined in tests/test_requests.py at line 312.
What does test_header_and_body_removal_on_redirect() call?
test_header_and_body_removal_on_redirect() calls 1 function(s): send.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free