fix: remove Basic prefix from custom auth headers

Custom headers like X-API-Auth expect raw base64 credentials without
the "Basic " prefix. The standard Authorization header continues to
use the proper Basic auth format via SetBasicAuth().

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Oliver Jakoubek 2026-01-27 11:01:28 +01:00
commit 508c3ac6d2
4 changed files with 12 additions and 11 deletions

View file

@ -24,7 +24,7 @@ func (a *apiTokenAuth) Apply(req *http.Request) {
user = "jsonrpc"
}
if a.headerName != "" {
req.Header.Set(a.headerName, "Basic "+basicAuthValue(user, a.token))
req.Header.Set(a.headerName, basicAuthValue(user, a.token))
} else {
req.SetBasicAuth(user, a.token)
}
@ -40,7 +40,7 @@ type basicAuth struct {
// Apply adds HTTP Basic Auth with username and password.
func (a *basicAuth) Apply(req *http.Request) {
if a.headerName != "" {
req.Header.Set(a.headerName, "Basic "+basicAuthValue(a.username, a.password))
req.Header.Set(a.headerName, basicAuthValue(a.username, a.password))
} else {
req.SetBasicAuth(a.username, a.password)
}