test_cookielib_cookiejar_on_redirect() — requests Function Reference
Architecture documentation for the test_cookielib_cookiejar_on_redirect() function in test_requests.py from the requests codebase.
Entity Profile
Dependency Diagram
graph TD 5682b645_2f8b_0c11_82e2_fec12866dbcd["test_cookielib_cookiejar_on_redirect()"] 22b80b19_26d4_cd0e_c476_3edf87b3df14["TestRequests"] 5682b645_2f8b_0c11_82e2_fec12866dbcd -->|defined in| 22b80b19_26d4_cd0e_c476_3edf87b3df14 772251a3_91b5_d6a8_857f_bb938ed045f7["send()"] 5682b645_2f8b_0c11_82e2_fec12866dbcd -->|calls| 772251a3_91b5_d6a8_857f_bb938ed045f7 style 5682b645_2f8b_0c11_82e2_fec12866dbcd fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
tests/test_requests.py lines 442–472
def test_cookielib_cookiejar_on_redirect(self, httpbin):
"""Tests resolve_redirect doesn't fail when merging cookies
with non-RequestsCookieJar cookiejar.
See GH #3579
"""
cj = cookiejar_from_dict({"foo": "bar"}, cookielib.CookieJar())
s = requests.Session()
s.cookies = cookiejar_from_dict({"cookie": "tasty"})
# Prepare request without using Session
req = requests.Request("GET", httpbin("headers"), cookies=cj)
prep_req = req.prepare()
# Send request and simulate redirect
resp = s.send(prep_req)
resp.status_code = 302
resp.headers["location"] = httpbin("get")
redirects = s.resolve_redirects(resp, prep_req)
resp = next(redirects)
# Verify CookieJar isn't being converted to RequestsCookieJar
assert isinstance(prep_req._cookies, cookielib.CookieJar)
assert isinstance(resp.request._cookies, cookielib.CookieJar)
assert not isinstance(resp.request._cookies, requests.cookies.RequestsCookieJar)
cookies = {}
for c in resp.request._cookies:
cookies[c.name] = c.value
assert cookies["foo"] == "bar"
assert cookies["cookie"] == "tasty"
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does test_cookielib_cookiejar_on_redirect() do?
test_cookielib_cookiejar_on_redirect() is a function in the requests codebase, defined in tests/test_requests.py.
Where is test_cookielib_cookiejar_on_redirect() defined?
test_cookielib_cookiejar_on_redirect() is defined in tests/test_requests.py at line 442.
What does test_cookielib_cookiejar_on_redirect() call?
test_cookielib_cookiejar_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