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

@ -200,8 +200,8 @@ func TestAPITokenAuth_CustomHeader(t *testing.T) {
return
}
// Verify the custom header has the correct Basic auth value
expected := "Basic " + base64Encode("jsonrpc:my-api-token")
// Verify the custom header has raw base64 value (no "Basic " prefix)
expected := base64Encode("jsonrpc:my-api-token")
if customAuth != expected {
t.Errorf("expected X-API-Auth=%s, got %s", expected, customAuth)
}
@ -244,8 +244,8 @@ func TestBasicAuth_CustomHeader(t *testing.T) {
return
}
// Verify the custom header has the correct Basic auth value
expected := "Basic " + base64Encode("admin:secret")
// Verify the custom header has raw base64 value (no "Basic " prefix)
expected := base64Encode("admin:secret")
if customAuth != expected {
t.Errorf("expected X-Custom-Auth=%s, got %s", expected, customAuth)
}
@ -281,8 +281,8 @@ func TestCustomHeader_WithCustomUser(t *testing.T) {
return
}
// Verify the custom header uses the custom username
expected := "Basic " + base64Encode("custom-user:my-token")
// Verify the custom header uses raw base64 value with custom username
expected := base64Encode("custom-user:my-token")
if customAuth != expected {
t.Errorf("expected X-API-Auth=%s, got %s", expected, customAuth)
}