From dbddca1e6b0913027d1af7acdaefbb822c6163a4 Mon Sep 17 00:00:00 2001
From: "i.nueske" <i.nueske@indiscale.com>
Date: Sat, 16 Nov 2024 16:54:41 +0100
Subject: [PATCH] BUG: Request responses without the "Set-Cookie" header no
 longer overwrite the current auth_token with None

---
 src/linkahead/connection/authentication/interface.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/linkahead/connection/authentication/interface.py b/src/linkahead/connection/authentication/interface.py
index b48e27c0..f5033fad 100644
--- a/src/linkahead/connection/authentication/interface.py
+++ b/src/linkahead/connection/authentication/interface.py
@@ -125,8 +125,9 @@ class AbstractAuthenticator(ABC):
         Returns
         -------
         """
-        self.auth_token = parse_auth_token(
-            response.getheader("Set-Cookie"))
+        new_token = parse_auth_token(response.getheader("Set-Cookie"))
+        if new_token is not None:
+            self.auth_token = new_token
 
     def on_request(self, method: str, path: str, headers: QueryDict, **kwargs):
         # pylint: disable=unused-argument
-- 
GitLab