1
0
mirror of https://github.com/go-acme/lego.git synced 2024-11-25 00:56:20 +02:00

gandiv5: Add "Bearer" prefix to the auth header (#2029)

This commit is contained in:
Christoph 2023-10-07 02:22:02 +02:00 committed by GitHub
parent bf8c7abf6d
commit 2140e6befe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -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
}

View File

@ -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)