File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed
supertokens_python/framework/django Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77
88## unreleased
99
10+ - Fix django cookie expiry time format to make it consistent with other frameworks
11+
1012## [ 0.11.11] - 2022-12-26
1113
1214- Updates dashboard version
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ def set_cookie(
5151 key = key ,
5252 value = value ,
5353 expires = datetime .fromtimestamp (ceil (expires / 1000 )).strftime (
54- "%A , %B %d, %Y %H:%M:%S"
54+ "%a , %d %b %Y %H:%M:%S GMT "
5555 ),
5656 path = path ,
5757 domain = domain ,
Original file line number Diff line number Diff line change 1616from inspect import isawaitable
1717from typing import Any , Dict , Union
1818
19+ from datetime import datetime
1920from django .http import HttpRequest , HttpResponse , JsonResponse
2021from django .test import RequestFactory , TestCase
2122from supertokens_python import InputAppInfo , SupertokensConfig , init
@@ -252,6 +253,13 @@ async def test_login_handle(self):
252253 assert len (cookies ["sIdRefreshToken" ]["value" ]) > 0
253254 assert len (cookies ["sRefreshToken" ]["value" ]) > 0
254255
256+ try :
257+ datetime .strptime (
258+ cookies ["sAccessToken" ]["expires" ], "%a, %d %b %Y %H:%M:%S GMT"
259+ )
260+ except ValueError :
261+ assert False , "cookies expiry time doesn't have the correct format"
262+
255263 my_middleware = middleware (handle_view )
256264 request = self .factory .get ("/handle" , {"user_id" : "user_id" })
257265
You can’t perform that action at this time.
0 commit comments