mirror of
https://gitea.com/gitea/gitea-mcp.git
synced 2026-08-30 03:57:45 +00:00
feat(gitea): support extra outbound HTTP headers via GITEA_EXTRA_HEADERS
Add a GITEA_EXTRA_HEADERS environment variable that accepts a JSON object of header name/value pairs (e.g. Cloudflare Access credentials) and applies them to every outbound request to Gitea, both the raw pkg/gitea.DoJSON/DoBytes path and the SDK-backed pkg/gitea.NewClient path, without overriding Authorization, Content-Type, or Accept. Co-Authored-By: Codet <codet@commitgo.dev> (GPT-5-Codex)
This commit is contained in:
+2
-2
@@ -59,7 +59,7 @@ var (
|
||||
func restHTTPClient() *http.Client {
|
||||
restClientOnce.Do(func() {
|
||||
restClient = &http.Client{
|
||||
Transport: sharedTransport(),
|
||||
Transport: giteaTransport(),
|
||||
Timeout: httpClientTimeout,
|
||||
CheckRedirect: checkRedirect,
|
||||
}
|
||||
@@ -180,7 +180,7 @@ func DoJSON(ctx context.Context, method, path string, query url.Values, body, re
|
||||
|
||||
func attachmentHTTPClient(origin *url.URL) *http.Client {
|
||||
return &http.Client{
|
||||
Transport: sharedTransport(),
|
||||
Transport: giteaTransport(),
|
||||
CheckRedirect: func(req *http.Request, via []*http.Request) error {
|
||||
if err := checkRedirect(req, via); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user