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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add domain argument to SessionMiddleware #2280

Merged
merged 8 commits into from
Nov 3, 2023
Merged

feat: add domain argument to SessionMiddleware #2280

merged 8 commits into from
Nov 3, 2023

Conversation

zllvm
Copy link
Contributor

@zllvm zllvm commented Sep 13, 2023

Summary

This PR introduces an optional domain parameter to the SessionMiddleware constructor. Users can include this parameter when initializing SessionMiddleware to specify the desired domain for cookie scoping. More information about it can be found, for example, here.

The feature has been discussed in Discussions #1603

Impact

  • Minimal Impact: The changes in this PR are backward-compatible and should not disrupt existing implementations of SessionMiddleware.
  • Opt-In: Users can choose to utilize the new domain parameter when initializing SessionMiddleware, ensuring that it does not affect those who do not use it.

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.

Copy link
Member

@abersheeran abersheeran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great improvement!

@@ -20,6 +20,7 @@ def __init__(
path: str = "/",
same_site: typing.Literal["lax", "strict", "none"] = "lax",
https_only: bool = False,
domain: str = "",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
domain: str = "",
domain: typing.Optional[str] = None,

@Kludex Kludex enabled auto-merge (squash) November 3, 2023 12:16
@Kludex Kludex disabled auto-merge November 3, 2023 12:16
@Kludex Kludex enabled auto-merge (squash) November 3, 2023 12:16
@Kludex Kludex merged commit e017600 into encode:master Nov 3, 2023
5 checks passed
@zllvm zllvm deleted the feature/domain-in-sessionmiddleware branch November 15, 2023 07:56
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