feat: add user-agent http header for thirdparty sdks

This commit is contained in:
Fu Diwei
2025-05-28 10:46:02 +08:00
parent ddb46f9dda
commit 829fa29cf1
30 changed files with 66 additions and 43 deletions

View File

@@ -32,6 +32,7 @@ func NewClient(serverUrl, apiRole, accessKeyId, accessKey string) *Client {
}
client.client = resty.New().
SetBaseURL(strings.TrimRight(serverUrl, "/")).
SetHeader("User-Agent", "certimate").
SetPreRequestHook(func(c *resty.Client, req *http.Request) error {
if client.accessToken != "" {
req.Header.Set("X-Cloud-Access-Token", client.accessToken)