From ee94deaefc2d8ff9758d86851c26c0365a75c80e Mon Sep 17 00:00:00 2001 From: Marcin Maciaszczyk Date: Tue, 26 Sep 2023 14:42:39 +0200 Subject: [PATCH] update client auth --- pkg/console/console.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/console/console.go b/pkg/console/console.go index 194a615e..de28b477 100644 --- a/pkg/console/console.go +++ b/pkg/console/console.go @@ -3,8 +3,9 @@ package console import ( "context" "fmt" - consoleclient "github.com/pluralsh/console-client-go" "net/http" + + consoleclient "github.com/pluralsh/console-client-go" ) type consoleClient struct { @@ -18,11 +19,10 @@ type ConsoleClient interface { } func NewConsoleClient(token, url string) (ConsoleClient, error) { - authHeader := func(req *http.Request) { - req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token)) - } return &consoleClient{ - pluralClient: consoleclient.NewClient(http.DefaultClient, fmt.Sprintf("%s/gql", url), authHeader), - ctx: context.Background(), + pluralClient: consoleclient.NewClient(http.DefaultClient, fmt.Sprintf("%s/gql", url), func(req *http.Request) { + req.Header.Set("Authorization", fmt.Sprintf("Token %s", token)) + }), + ctx: context.Background(), }, nil }