Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions fishjam/_openapi_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import httpx
from attrs import define, evolve, field

from fishjam.version import get_version


@define
class Client:
Expand Down Expand Up @@ -229,6 +231,7 @@ def get_httpx_client(self) -> httpx.Client:
self._headers[self.auth_header_name] = (
f"{self.prefix} {self.token}" if self.prefix else self.token
)
self._headers["x-sdk_version"] = f"py-{get_version()}"
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The header name uses an underscore in "x-sdk_version" which is inconsistent with HTTP header naming conventions. HTTP headers should use hyphens as separators. Change to "x-sdk-version" to follow standard conventions.

Suggested change
self._headers["x-sdk_version"] = f"py-{get_version()}"
self._headers["x-sdk-version"] = f"py-{get_version()}"

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The SDK version header is only added to AuthenticatedClient but not to the base Client class. This creates an inconsistency where only authenticated requests include the SDK version. For consistent tracking and analytics, the SDK version header should also be added in the Client.get_httpx_client() method (around line 91) and Client.get_async_httpx_client() method (around line 122).

Suggested change
self._headers["x-sdk_version"] = f"py-{get_version()}"

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The new SDK version header functionality lacks test coverage. Similar header functionality in the codebase (e.g., x-goog-api-client in test_gemini.py) has comprehensive tests. Consider adding tests that verify the SDK version header is correctly set in both sync and async HTTP clients.

Copilot uses AI. Check for mistakes.
self._client = httpx.Client(
base_url=self._base_url,
cookies=self._cookies,
Expand Down Expand Up @@ -265,6 +268,7 @@ def get_async_httpx_client(self) -> httpx.AsyncClient:
self._headers[self.auth_header_name] = (
f"{self.prefix} {self.token}" if self.prefix else self.token
)
self._headers["x-sdk_version"] = f"py-{get_version()}"
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The header name uses an underscore in "x-sdk_version" which is inconsistent with HTTP header naming conventions. HTTP headers should use hyphens as separators. Change to "x-sdk-version" to follow standard conventions.

Copilot uses AI. Check for mistakes.
self._async_client = httpx.AsyncClient(
base_url=self._base_url,
cookies=self._cookies,
Expand Down
Loading