feat(vks): send grn-vks-cli User-Agent on every VKS API request - #47
Merged
Conversation
Tag each outbound VKS public-API request with a version-stamped User-Agent (grn-vks-cli/<version>) so the backend can attribute and count traffic from the grn VKS CLI. The header is set on both the initial request and the post-401 retry; version is shared with cliVersion so release-please bumps it automatically.
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
Every outbound request to the VKS public API now carries a version-stamped
User-Agent: grn-vks-cli/<version>(e.g.grn-vks-cli/1.7.3) so the backend canattribute and count traffic originating from the grn VKS CLI.
Changes
internal/client/client.go: new package varUserAgent(defaultgrn-vks-cli);header set on both the initial request and the post-401 retry.
cmd/root.go:init()setsclient.UserAgent = "grn-vks-cli/" + cliVersion,sharing
cliVersionso release-please bumps the UA automatically.Scope / notes
(
internal/auth/token.go) is intentionally left unchanged.--versionoutput is unchanged (grn-cli/...); the new string is API-only.Test
CGO_ENABLED=1 go test -ldflags=-linkmode=external ./internal/client/ ./cmd/...— pass(external linker works around the known macOS LC_UUID abort; unrelated to this change).
go build -tags vks_onlyOK;gofmt+go vetclean.