File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -397,16 +397,20 @@ def test_gateway_request_with_expiring_cookies(
397
397
GatewayClient .clear_instance ()
398
398
_ = jp_configurable_serverapp (argv = argv )
399
399
400
- cookie : SimpleCookie = SimpleCookie ()
401
- cookie .load ("SERVERID=1234567; Path=/" )
400
+ headers = {}
401
+ # Use comma-separated Set-Cookie headers to demonstrate the issue
402
+ headers ["Set-Cookie" ] = "SERVERID=016723f5|12345678; Max-Age=172800; Path=/; HttpOnly," \
403
+ "username-my-server=2|1:0|10:1756250589|35:username-my-server|144:123abc789|87654321; " \
404
+ "Max-Age=172800; Path=/; HttpOnly"
402
405
if expire_arg == "Expires" :
403
406
expire_param = format_datetime (
404
407
datetime .now (tz = timezone .utc ) + timedelta (seconds = expire_param )
405
408
)
406
409
if expire_arg :
407
- cookie ["SERVERID" ][expire_arg ] = expire_param
410
+ # Replace the first SERVERID cookie's Max-Age with the new expire parameter
411
+ headers ["Cookie" ] = headers ["Set-Cookie" ].replace ("Max-Age=172800" , f"{ expire_arg } ={ expire_param } " )
408
412
409
- GatewayClient .instance ().update_cookies (cookie )
413
+ GatewayClient .instance ().update_cookies (headers )
410
414
411
415
args = {}
412
416
if existing_cookies :
You can’t perform that action at this time.
0 commit comments