mirror of
https://gitea.com/gitea/gitea-mcp.git
synced 2025-08-23 14:23:05 +00:00
feat: set custom user agent for Gitea client using server version (#74)
- Import the fmt package to enable string formatting - Set a custom user agent for the Gitea client using the current server version Signed-off-by: appleboy <appleboy.tw@gmail.com> Reviewed-on: https://gitea.com/gitea/gitea-mcp/pulls/74 Co-authored-by: appleboy <appleboy.tw@gmail.com> Co-committed-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package gitea
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@@ -43,6 +44,9 @@ func Client() *gitea.Client {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("create gitea client err: %v", err)
|
log.Fatalf("create gitea client err: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set user agent for the client
|
||||||
|
client.SetUserAgent(fmt.Sprintf("gitea-mcp-server/%s", flag.Version))
|
||||||
})
|
})
|
||||||
return client
|
return client
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user