mirror of
				https://gitea.com/gitea/gitea-mcp.git
				synced 2025-10-30 09:51:50 +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 ( | ||||
| 	"crypto/tls" | ||||
| 	"fmt" | ||||
| 	"net/http" | ||||
| 	"sync" | ||||
|  | ||||
| @@ -43,6 +44,9 @@ func Client() *gitea.Client { | ||||
| 		if err != nil { | ||||
| 			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 | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user