forgejo-mcp/pkg/forgejo/testing.go
Christoph Görn 593eeb832f
fix: 🐛 base64-encode content in create_file and update_file (#72)
The Forgejo API requires file content to be base64-encoded, but the MCP
tools were passing plain text through, causing "illegal base64 data"
errors. Now the server encodes content automatically so AI models can
pass plain text directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 23:45:14 +01:00

14 lines
314 B
Go

package forgejo
import (
"sync"
forgejo_sdk "codeberg.org/mvdkleijn/forgejo-sdk/forgejo/v2"
)
// SetClientForTesting overrides the singleton client for testing purposes.
func SetClientForTesting(c *forgejo_sdk.Client) {
clientOnce = sync.Once{}
client = c
clientOnce.Do(func() {}) // mark as initialized
}