feat(#10): Support http-access-tokens for authentication

This commit is contained in:
xvlcwk authored and chris committed 2024-02-07 23:27:25 +01:00
1 parent 8f9c46f7d7
commit 5c82693906
4 files changed
+47 -32

No files matched your search

+6 -1
View File
@@ -40,6 +40,7 @@ type BitbucketClient struct {
Server string
Username string
Password string
Token string
HTTPClient *http.Client
}
@@ -60,7 +61,11 @@ func (c *BitbucketClient) Do(method, endpoint string, payload *bytes.Buffer, con
return nil, err
}
req.SetBasicAuth(c.Username, c.Password)
if c.Password != "" {
req.SetBasicAuth(c.Username, c.Password)
} else {
req.Header.Add("Authorization", "Bearer "+c.Token)
}
req.Header.Add("X-Atlassian-Token", "no-check")
if payload != nil {