Send combined CLI and SDK versions in API user agent#400
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Basecamp CLI’s SDK client initialization so API requests send a combined User-Agent that identifies the CLI first while still including the Go SDK version and API revision for server-side logging and debugging.
Changes:
- Configure the Basecamp SDK client in
NewAppto useversion.UserAgent() + " " + basecamp.DefaultUserAgent. - Add an HTTP integration-style test to verify the
User-Agent(and auth header) applied to outbound SDK requests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
internal/appctx/context.go |
Sets a combined CLI+SDK User-Agent when constructing the shared SDK client in NewApp. |
internal/appctx/context_test.go |
Adds coverage asserting NewApp results in requests carrying the combined User-Agent (and expected Authorization). |
Tip
If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This updates the Basecamp CLI to send a combined
User-Agentso BC3 can identify and log the CLI version alongside the Go SDK and API revision. Today CLI requests inherit the SDK default user agent, which means BC3 logs show the SDK version but not that the traffic came from the CLI itself.Before, the API saw:
After, it sees:
This change:
NewAppconfigures the combined user agent consistentlySummary by cubic
Send a combined CLI+SDK User-Agent on all API requests so BC3 can identify CLI traffic and version while preserving the Go SDK version and API revision. Example: basecamp-cli/ (...) basecamp-sdk-go/0.7.2 (api:2026-01-26).
User-AgentinNewAppviabasecamp.WithUserAgent(version.UserAgent()+" "+basecamp.DefaultUserAgent).TestNewAppSetsCombinedUserAgentto verify the combined header and token against a test server.Written for commit 609671f. Summary will update on new commits.