-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Support partitioned in Response.delete_cookie
#3376
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -139,6 +139,7 @@ def delete_cookie( | |
| secure: bool = False, | ||
| httponly: bool = False, | ||
| samesite: Literal["lax", "strict", "none"] | None = "lax", | ||
| partitioned: bool = False, | ||
| ) -> None: | ||
| self.set_cookie( | ||
| key, | ||
|
|
@@ -149,6 +150,7 @@ def delete_cookie( | |
| secure=secure, | ||
| httponly=httponly, | ||
| samesite=samesite, | ||
| partitioned=partitioned, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: Prompt for AI agents |
||
| ) | ||
|
|
||
| def _wrap_websocket_denial_send(self, send: Send) -> Send: | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -512,6 +512,22 @@ async def app(scope: Scope, receive: Receive, send: Send) -> None: | |
| assert not response.cookies.get("mycookie") | ||
|
|
||
|
|
||
| def test_delete_cookie_partitioned(test_client_factory: TestClientFactory) -> None: | ||
| async def app(scope: Scope, receive: Receive, send: Send) -> None: | ||
| response = Response("Hello, world!", media_type="text/plain") | ||
| response.delete_cookie( | ||
| "mycookie", | ||
| partitioned=True if sys.version_info >= (3, 14) else False, | ||
| ) | ||
| await response(scope, receive, send) | ||
|
|
||
| partitioned_text = "Partitioned" if sys.version_info >= (3, 14) else "" | ||
|
|
||
| client = test_client_factory(app) | ||
| response = client.get("/") | ||
| assert partitioned_text in response.headers["set-cookie"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: The branchless refactoring loses negative coverage for Python < 3.14. When Prompt for AI agents |
||
|
|
||
|
|
||
| def test_populate_headers(test_client_factory: TestClientFactory) -> None: | ||
| app = Response(content="hi", headers={}, media_type="text/html") | ||
| client = test_client_factory(app) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.