Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotate samesite parameter on set_cookie #1590

Merged
merged 6 commits into from Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion starlette/middleware/sessions.py
Expand Up @@ -18,7 +18,7 @@ def __init__(
session_cookie: str = "session",
max_age: typing.Optional[int] = 14 * 24 * 60 * 60, # 14 days, in seconds
path: str = "/",
same_site: str = "lax",
same_site: typing.Literal["lax", "strict", "none"] = "lax",
https_only: bool = False,
) -> None:
self.app = app
Expand Down
4 changes: 2 additions & 2 deletions starlette/responses.py
Expand Up @@ -103,7 +103,7 @@ def set_cookie(
domain: str = None,
secure: bool = False,
httponly: bool = False,
samesite: str = "lax",
samesite: typing.Optional[typing.Literal["lax", "strict", "none"]] = "lax",
) -> None:
cookie: http.cookies.BaseCookie = http.cookies.SimpleCookie()
cookie[key] = value
Expand Down Expand Up @@ -136,7 +136,7 @@ def delete_cookie(
domain: str = None,
secure: bool = False,
httponly: bool = False,
samesite: str = "lax",
samesite: typing.Optional[typing.Literal["lax", "strict", "none"]] = "lax",
) -> None:
self.set_cookie(
key,
Expand Down