This commit is contained in:
u80864958
2026-02-12 16:02:38 +01:00
commit 3d4d908d54
14 changed files with 885 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
package gitadapters
import (
"fmt"
"io"
"net/http"
"net/url"
)
type baseHTTP struct {
baseURL string
bearerToken string
}
func (b *baseHTTP) createRequest(method string, body io.Reader, path ...string) (r *http.Request, err error) {
target, err := url.JoinPath(b.baseURL, path...)
if err != nil {
err = fmt.Errorf("can not parse path: %w", err)
return
}
req, err := http.NewRequest(method, target, body)
if err != nil {
return nil, err
}
if b.bearerToken != "" {
req.Header.Set("Authorization", "Bearer "+b.bearerToken)
}
return req, nil
}