-
Notifications
You must be signed in to change notification settings - Fork 1
sent sdk version in headers #65
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?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds SDK version tracking by including a custom header in HTTP requests made by the Fishjam client. This enables server-side tracking of which SDK version is being used by clients.
Changes:
- Added import of
get_version()function to the OpenAPI client module - Added
x-sdk_versionheader with formatpy-{version}to both sync and async HTTP client methods inAuthenticatedClient
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 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()}" |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
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.
| self._headers["x-sdk_version"] = f"py-{get_version()}" | |
| self._headers["x-sdk-version"] = f"py-{get_version()}" |
| 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()}" |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
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.
| 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()}" |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
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).
| self._headers["x-sdk_version"] = f"py-{get_version()}" |
| 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()}" |
Copilot
AI
Jan 16, 2026
There was a problem hiding this comment.
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.
Description
Describe your changes.
Motivation and Context
Why is this change required? What problem does it solve? If it fixes an open
issue, please link to the issue here.
Documentation impact
Types of changes
not work as expected)