]> git.ipfire.org Git - thirdparty/starlette.git/commitdiff
Fix #1207 (#1228)
authorbookgin <bookgin@bookgin.tw>
Tue, 5 Oct 2021 21:36:24 +0000 (05:36 +0800)
committerGitHub <noreply@github.com>
Tue, 5 Oct 2021 21:36:24 +0000 (23:36 +0200)
Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
starlette/responses.py

index d03df23294c1ca77af697ae4e2fed860470de5aa..9dbe03beb56fde2bbd28e6c53623b298876ac24f 100644 (file)
@@ -125,8 +125,25 @@ class Response:
         cookie_val = cookie.output(header="").strip()
         self.raw_headers.append((b"set-cookie", cookie_val.encode("latin-1")))
 
-    def delete_cookie(self, key: str, path: str = "/", domain: str = None) -> None:
-        self.set_cookie(key, expires=0, max_age=0, path=path, domain=domain)
+    def delete_cookie(
+        self,
+        key: str,
+        path: str = "/",
+        domain: str = None,
+        secure: bool = False,
+        httponly: bool = False,
+        samesite: str = "lax",
+    ) -> None:
+        self.set_cookie(
+            key,
+            max_age=0,
+            expires=0,
+            path=path,
+            domain=domain,
+            secure=secure,
+            httponly=httponly,
+            samesite=samesite,
+        )
 
     async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
         await send(