Skip to content
Myr

fix and test for a bug dhagrow reported

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Shivaram Lingamneni · committed by Shivaram Lingamneni · parent 404ecaf · Browse files · 2 files+8 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+8 added−1 removed

  • tests:+5 added−0 removed
  • other:+3 added−1 removed

2 files+8 added−1 removed

modified:requests/models.py+3 added-1 removed
568 unmodified lines
569 if not self.sent or anyway:570571 # Skip if 'cookie' header is explicitly set.572 if 'cookie' not in self.headers:573 self.headers['Cookie'] = get_cookie_header(self.cookies, self)573 cookie_header = get_cookie_header(self.cookies, self)574 if cookie_header is not None:575 self.headers['Cookie'] = cookie_header576577 # Pre-request hook.578 r = dispatch_hook('pre_request', self.hooks, self)579 self.__dict__.update(r.__dict__)
268 unmodified lines
modified:tests/test_cookies.py+5 added
79 unmodified lines
80 expected_cookies = {'redirects': 'work', 'very': 'well'}81 self.assertEqual(json.loads(r2.text)['cookies'], expected_cookies)82 self.assertIs(r.cookies, r2.cookies)8384 def test_none_cookie(self):85 """Regression test: don't send a Cookie header with a string value of 'None'!"""86 page = json.loads(requests.get(httpbin('headers')).text)87 self.assertNotIn('Cookie', page['headers'])8889class LWPCookieJarTest(TestBaseMixin, unittest.TestCase):90 """Check store/load of cookies to FileCookieJar's, specifically LWPCookieJar's."""9192 COOKIEJAR_CLASS = cookielib.LWPCookieJar
74 unmodified lines