mirror of
https://github.com/httpie/cli.git
synced 2025-01-10 00:28:12 +02:00
parent
cf78a12e46
commit
3c07a25326
@ -38,5 +38,6 @@ Patches and ideas
|
|||||||
* `Edward Yang <https://github.com/honorabrutroll>`_
|
* `Edward Yang <https://github.com/honorabrutroll>`_
|
||||||
* `Aleksandr Vinokurov <https://github.com/aleksandr-vin>`_
|
* `Aleksandr Vinokurov <https://github.com/aleksandr-vin>`_
|
||||||
* `Jeff Byrnes <https://github.com/jeffbyrnes>`_
|
* `Jeff Byrnes <https://github.com/jeffbyrnes>`_
|
||||||
|
* `Denis Belavin <https://github.com/LuckyDenis>`_
|
||||||
|
|
||||||
|
|
||||||
|
@ -109,6 +109,15 @@ def get_expired_cookies(
|
|||||||
for attrs in attr_sets
|
for attrs in attr_sets
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# HACK/FIXME: https://github.com/psf/requests/issues/5743
|
||||||
|
for cookie in cookies:
|
||||||
|
if 'expires' in cookie:
|
||||||
|
continue
|
||||||
|
|
||||||
|
max_age = cookie.get('max-age')
|
||||||
|
if max_age and max_age.isdigit():
|
||||||
|
cookie['expires'] = now + float(max_age)
|
||||||
|
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
'name': cookie['name'],
|
'name': cookie['name'],
|
||||||
|
@ -345,6 +345,15 @@ class TestExpiredCookies(CookieTestBase):
|
|||||||
assert 'cookie1' in updated_session['cookies']
|
assert 'cookie1' in updated_session['cookies']
|
||||||
assert 'cookie2' not in updated_session['cookies']
|
assert 'cookie2' not in updated_session['cookies']
|
||||||
|
|
||||||
|
def test_get_expired_cookies_using_max_age(self):
|
||||||
|
headers = [
|
||||||
|
('Set-Cookie', 'one=two; Max-Age=0; path=/; domain=.tumblr.com; HttpOnly')
|
||||||
|
]
|
||||||
|
expected_expired = [
|
||||||
|
{'name': 'one', 'path': '/'}
|
||||||
|
]
|
||||||
|
assert get_expired_cookies(headers, now=None) == expected_expired
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
argnames=['headers', 'now', 'expected_expired'],
|
argnames=['headers', 'now', 'expected_expired'],
|
||||||
argvalues=[
|
argvalues=[
|
||||||
|
Loading…
Reference in New Issue
Block a user