Skip to content

Commit 42e09cf

Browse files
authored
chore: include user-agent for future tracking of deployed client's versions (#71)
1 parent da4db6c commit 42e09cf

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎internal/api/client.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ package api
33

44
import (
55
"context"
6+
"fmt"
67
"net/http"
78
"strings"
89

10+
"github.com/ctrlplanedev/cli/cmd/ctrlc/root/version"
911
"github.com/google/uuid"
1012
)
1113

@@ -15,6 +17,7 @@ func NewAPIKeyClientWithResponses(server string, apiKey string) (*ClientWithResp
1517
return NewClientWithResponses(server+"/api",
1618
WithRequestEditorFn(func(ctx context.Context, req *http.Request) error {
1719
req.Header.Set("X-API-Key", apiKey)
20+
req.Header.Set("User-Agent", fmt.Sprintf("ctrlc/%s", version.Version))
1821
return nil
1922
}),
2023
)

0 commit comments

Comments
 (0)