From f58ebbe5059a8078b6651d0d56b71d6efbf91b5f Mon Sep 17 00:00:00 2001 From: Souhaila Noor Date: Fri, 28 Jan 2022 12:10:22 -0600 Subject: [PATCH] enable auth for endpoint --- http/client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/http/client.go b/http/client.go index ef21f6b24..362ac053c 100644 --- a/http/client.go +++ b/http/client.go @@ -2207,6 +2207,10 @@ func (c *InternalClient) ImportIndexKeys(ctx context.Context, uri *pnet.URI, ind return errors.Wrap(err, "creating request") } httpReq.Header.Set("User-Agent", "pilosa/"+pilosa.Version) + token, ok := ctx.Value("token").(string) + if ok && token != "" { + httpReq.Header.Set("Authorization", token) + } // Execute request against the host. resp, err := c.executeRetryableRequest(httpReq.WithContext(ctx))