flask-session icon indicating copy to clipboard operation
flask-session copied to clipboard

After calling session.clear() the Expiry attribute stops being returned

Open jacopo-j opened this issue 4 years ago • 2 comments

Example code:

from flask import Flask, session
from flask_session import Session

app = Flask(__name__, static_url_path="")
app.config["SESSION_TYPE"] = "filesystem"
app.config["SESSION_PERMANENT"] = True
app.config["PERMANENT_SESSION_LIFETIME"] = 30 * 86400
Session(app)

@app.route("/test_working")
def test_working():
    return "", 200

@app.route("/test_not_working")
def test_not_working():
    session.clear()
    session["x"] = "y"
    return "", 200

app.run()

When requesting /test_working I get the following header, which contains the Expires attribute as expected:

set-cookie: session=a40be61f-164a-47d3-b3dc-77a7fd4c66a4; Expires=Thu, 03-Sep-2020 21:12:53 GMT; HttpOnly; Path=/

However, when requesting /test_not_working the Expires attribute is missing:

set-cookie: session=69bb7ea7-a8d5-4a9c-be64-9295b1545f88; HttpOnly; Path=/

jacopo-j avatar Aug 04 '20 22:08 jacopo-j

I'm observing the same behavior (flask-session 0.3.2)

louisrigot avatar Oct 21 '20 13:10 louisrigot

same behaviour 21/10/2021

achaayb avatar Oct 20 '21 23:10 achaayb

Fixed post 0.7.0rc1

Lxstr avatar Mar 10 '24 13:03 Lxstr