Skip to content
Myr

Merge pull request #1440 from fcurella/patch-0

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

unquote double-quotes cookie values

authored by Kenneth Reitz · committed by Kenneth Reitz · parents 4b7cf38, 7da16c5 · Browse files · 3 files+11 added−0 removed
This commit

State

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

Diff stats

3 files+11 added−0 removed

  • other:+11 added−0 removed

3 files+11 added−0 removed

modified:requests/cookies.py+5 added
257 unmodified lines
258 def __delitem__(self, name):259 """Deletes a cookie given a name. Wraps cookielib.CookieJar's remove_cookie_by_name()."""260 remove_cookie_by_name(self, name)261262 def set_cookie(self, cookie, *args, **kwargs):263 if cookie.value.startswith('"') and cookie.value.endswith('"'):264 cookie.value = cookie.value.replace('\\"', '')265 return super(RequestsCookieJar, self).set_cookie(cookie, *args, **kwargs)266267 def update(self, other):268 """Updates this jar with cookies from another CookieJar or dict-like"""269 if isinstance(other, cookielib.CookieJar):270 for cookie in other:
129 unmodified lines
modified:AUTHORS.rst+1 added
129 unmodified lines
130- Łukasz Langa <lukasz@langa.pl> @llanga131- Dave Shawley <daveshawley@gmail.com>132- James Clarke (jam)133- Kevin Burke <kev@inburke.com>134- Flavio Curella
modified:test_requests.py+5 added
168 unmodified lines
169 }170 )171 assert 'foo' not in s.cookies172173 def test_cookie_quote_wrapped(self):174 s = requests.session()175 s.get(httpbin('cookies/set?foo="bar:baz"'))176 self.assertTrue(s.cookies['foo'] == '"bar:baz"')177178 def test_request_cookie_overrides_session_cookie(self):179 s = requests.session()180 s.cookies['foo'] = 'bar'181 r = s.get(httpbin('cookies'), cookies={'foo': 'baz'})
600 unmodified lines