From 0edd9110958e84ac4b6acf621734c6b9d5fd71e1 Mon Sep 17 00:00:00 2001 From: Dejan Zele Pejchev Date: Fri, 18 Oct 2024 03:09:29 +0200 Subject: [PATCH] add User-Agent when CLI sends requests API requests --- cmd/kubectl-testkube/commands/common/client.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/kubectl-testkube/commands/common/client.go b/cmd/kubectl-testkube/commands/common/client.go index db9aa648ce5..5fdb01930f9 100644 --- a/cmd/kubectl-testkube/commands/common/client.go +++ b/cmd/kubectl-testkube/commands/common/client.go @@ -15,6 +15,8 @@ import ( "github.com/kubeshop/testkube/pkg/cloudlogin" ) +const UserAgentCLI = "testkube-cli" + // GetClient returns api client func GetClient(cmd *cobra.Command) (client.Client, string, error) { clientType := cmd.Flag("client").Value.String() @@ -35,6 +37,11 @@ func GetClient(cmd *cobra.Command) (client.Client, string, error) { return nil, "", fmt.Errorf("parsing flag value %w", err) } + if headers == nil { + headers = make(map[string]string) + } + headers["User-Agent"] = UserAgentCLI + options := client.Options{ Namespace: namespace, ApiUri: apiURI,