Fix session.py to allow suppression of the cookie by bobintetley · Pull Request #737 · webpy/webpy · GitHub
Skip to content

Fix session.py to allow suppression of the cookie#737

Merged
cclauss merged 7 commits into
webpy:masterfrom
bobintetley:patch-2
May 30, 2026
Merged

Fix session.py to allow suppression of the cookie#737
cclauss merged 7 commits into
webpy:masterfrom
bobintetley:patch-2

Conversation

@bobintetley

Copy link
Copy Markdown
Contributor

There are often endpoints/targets in your web.py app where you do not want to use sessions and most importantly, you do not want a Set-Cookie header sent with the response. The Set-Cookie header invalidates your Cache-Control directives when you are caching your responses with many CDNs. This PR allows you to do session.no_cookie=True in your handler to suppress the session cookie when you do not want it.

There are often endpoints/targets in your web.py app where you do not want to use sessions and most importantly, you do not want a Set-Cookie header sent with the response. The Set-Cookie header invalidates your Cache-Control directives when you are caching your responses with many CDNs. This PR allows you to do session.no_cookie=True in your handler to suppress the session cookie when you do not want it.
Comment thread web/session.py Outdated
@iredmail

iredmail commented Aug 7, 2022

Copy link
Copy Markdown
Contributor

@bobintetley

Copy link
Copy Markdown
Contributor Author

yep, it could certainly be send_cookie = True with the two booleans reversed. I mean, it's only a 2 line patch so whatever you prefer as maintainers!

@cclauss

cclauss commented Aug 7, 2022

Copy link
Copy Markdown
Contributor

Yes, please. Also please run the code thru psf/black so the tests pass.

@bobintetley

Copy link
Copy Markdown
Contributor Author

cclauss
cclauss previously approved these changes May 30, 2026
@cclauss cclauss merged commit 99e5eed into webpy:master May 30, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants