Public Access
fix(api): use raw token for Vikunja Authorization header
Vikunja's API expects the raw API token in the Authorization header without the "Bearer" prefix. Using "Bearer <token>" causes HTTP 401 errors, which broke the auto-merge preconditions check in CI. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent
6f1220a4f1
commit
60f33ce1dc
@@ -419,7 +419,7 @@ class VikunjaClient:
|
|||||||
def __init__(self, base_url: str, token: str) -> None:
|
def __init__(self, base_url: str, token: str) -> None:
|
||||||
self._base_url = base_url.rstrip("/")
|
self._base_url = base_url.rstrip("/")
|
||||||
self._session = requests.Session()
|
self._session = requests.Session()
|
||||||
self._session.headers.update({"Authorization": f"Bearer {token}"})
|
self._session.headers.update({"Authorization": token})
|
||||||
|
|
||||||
def _request(self, method: str, path: str, **kwargs: Any) -> requests.Response:
|
def _request(self, method: str, path: str, **kwargs: Any) -> requests.Response:
|
||||||
url = f"{self._base_url}{path}"
|
url = f"{self._base_url}{path}"
|
||||||
|
|||||||
@@ -606,7 +606,7 @@ class TestVikunjaClient:
|
|||||||
def test_init_sets_headers(self) -> None:
|
def test_init_sets_headers(self) -> None:
|
||||||
client = VikunjaClient("https://work.example.com", "tok")
|
client = VikunjaClient("https://work.example.com", "tok")
|
||||||
assert client._base_url == "https://work.example.com"
|
assert client._base_url == "https://work.example.com"
|
||||||
assert client._session.headers["Authorization"] == "Bearer tok"
|
assert client._session.headers["Authorization"] == "tok"
|
||||||
|
|
||||||
def test_list_tasks(self) -> None:
|
def test_list_tasks(self) -> None:
|
||||||
client = VikunjaClient("https://work.example.com", "tok")
|
client = VikunjaClient("https://work.example.com", "tok")
|
||||||
|
|||||||
Reference in New Issue
Block a user