diff --git a/aiohttp_security/cookies_identity.py b/aiohttp_security/cookies_identity.py index de1620f..0df9f83 100644 --- a/aiohttp_security/cookies_identity.py +++ b/aiohttp_security/cookies_identity.py @@ -22,7 +22,8 @@ class CookiesIdentityPolicy(AbstractIdentityPolicy): **kwargs): if max_age is sentinel: max_age = self._max_age - response.set_cookie(self._cookie_name, max_age=max_age, **kwargs) + response.set_cookie(self._cookie_name, identity, + max_age=max_age, **kwargs) @asyncio.coroutine def forget(self, request, response): diff --git a/tests/test_cookies_identity.py b/tests/test_cookies_identity.py index e72c052..e96fbac 100644 --- a/tests/test_cookies_identity.py +++ b/tests/test_cookies_identity.py @@ -61,8 +61,7 @@ class TestCookiesIdentity(unittest.TestCase): @asyncio.coroutine def handler(request): response = web.Response() - hdrs = yield from remember(request, 'Andrew') - response.headers.extend(hdrs) + yield from remember(request, response, 'Andrew') return response @asyncio.coroutine @@ -82,8 +81,7 @@ class TestCookiesIdentity(unittest.TestCase): @asyncio.coroutine def create(request): response = web.Response() - hdrs = yield from remember(request, 'Andrew') - response.headers.extend(hdrs) + yield from remember(request, response, 'Andrew') return response @asyncio.coroutine @@ -116,15 +114,13 @@ class TestCookiesIdentity(unittest.TestCase): @asyncio.coroutine def login(request): response = web.HTTPFound(location='/') - hdrs = yield from remember(request, 'Andrew') - response.headers.extend(hdrs) + yield from remember(request, response, 'Andrew') return response @asyncio.coroutine def logout(request): response = web.HTTPFound(location='/') - hdrs = yield from forget(request) - response.headers.extend(hdrs) + yield from forget(request, response) return response @asyncio.coroutine diff --git a/tests/test_dict_autz.py b/tests/test_dict_autz.py index f37cacc..72e861a 100644 --- a/tests/test_dict_autz.py +++ b/tests/test_dict_autz.py @@ -67,8 +67,7 @@ class TestCookiesIdentity(unittest.TestCase): @asyncio.coroutine def login(request): response = web.HTTPFound(location='/') - hdrs = yield from remember(request, 'UserID') - response.headers.extend(hdrs) + yield from remember(request, response, 'UserID') return response @asyncio.coroutine @@ -113,8 +112,7 @@ class TestCookiesIdentity(unittest.TestCase): @asyncio.coroutine def login(request): response = web.HTTPFound(location='/') - hdrs = yield from remember(request, 'UserID') - response.headers.extend(hdrs) + yield from remember(request, response, 'UserID') return response @asyncio.coroutine