From 2140e6befe2a46267c88c735a40f4791fe6036ab Mon Sep 17 00:00:00 2001 From: Christoph Date: Sat, 7 Oct 2023 02:22:02 +0200 Subject: [PATCH] gandiv5: Add "Bearer" prefix to the auth header (#2029) --- providers/dns/gandiv5/gandiv5_test.go | 4 ++-- providers/dns/gandiv5/internal/client.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/providers/dns/gandiv5/gandiv5_test.go b/providers/dns/gandiv5/gandiv5_test.go index 2cc8f1cd..57fed032 100644 --- a/providers/dns/gandiv5/gandiv5_test.go +++ b/providers/dns/gandiv5/gandiv5_test.go @@ -121,8 +121,8 @@ func TestDNSProvider(t *testing.T) { mux.HandleFunc("/domains/example.com/records/_acme-challenge.abc.def/TXT", func(rw http.ResponseWriter, req *http.Request) { log.Infof("request: %s %s", req.Method, req.URL) - if req.Header.Get("Authorization") == "" { - http.Error(rw, `{"message": "missing Authorization"}`, http.StatusUnauthorized) + if req.Header.Get("Authorization") != "Bearer 123412341234123412341234" { + http.Error(rw, `{"message": "missing or malformed Authorization"}`, http.StatusUnauthorized) return } diff --git a/providers/dns/gandiv5/internal/client.go b/providers/dns/gandiv5/internal/client.go index d91c1422..57de9d61 100644 --- a/providers/dns/gandiv5/internal/client.go +++ b/providers/dns/gandiv5/internal/client.go @@ -134,7 +134,7 @@ func (c *Client) do(req *http.Request, result any) error { } if c.pat != "" { - req.Header.Set(authorizationHeader, c.pat) + req.Header.Set(authorizationHeader, "Bearer "+c.pat) } resp, err := c.HTTPClient.Do(req)