Skip to content

feat(vks): send grn-vks-cli User-Agent on every VKS API request - #47

Merged
vks-team merged 1 commit into
mainfrom
feat/vks-user-agent
Jul 25, 2026
Merged

feat(vks): send grn-vks-cli User-Agent on every VKS API request#47
vks-team merged 1 commit into
mainfrom
feat/vks-user-agent

Conversation

@vks-team

Copy link
Copy Markdown
Contributor

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 can
attribute and count traffic originating from the grn VKS CLI.

Changes

  • internal/client/client.go: new package var UserAgent (default grn-vks-cli);
    header set on both the initial request and the post-401 retry.
  • cmd/root.go: init() sets client.UserAgent = "grn-vks-cli/" + cliVersion,
    sharing cliVersion so release-please bumps the UA automatically.
  • Unit tests assert the outbound header and the default value.

Scope / notes

  • Only the VKS API client is affected. The IAM auth-token request
    (internal/auth/token.go) is intentionally left unchanged.
  • --version output 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_only OK; gofmt + go vet clean.

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.
@vks-team
vks-team merged commit cf1e112 into main Jul 25, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant