From df76a67e8568607c23fba08bdbc59e871f8d50c7 Mon Sep 17 00:00:00 2001 From: Eshaan Bansal Date: Fri, 4 Apr 2025 14:48:30 +0530 Subject: [PATCH] fixes #4196: handle empty token in rpc client --- api/rpc/client/client.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api/rpc/client/client.go b/api/rpc/client/client.go index 56b4a54d19..65dbdf0e30 100644 --- a/api/rpc/client/client.go +++ b/api/rpc/client/client.go @@ -66,7 +66,10 @@ func (c *Client) Close() { // NewClient creates a new Client with one connection per namespace with the // given token as the authorization token. func NewClient(ctx context.Context, addr, token string) (*Client, error) { - authHeader := http.Header{perms.AuthKey: []string{fmt.Sprintf("Bearer %s", token)}} + var authHeader http.Header + if token != "" { + authHeader = http.Header{perms.AuthKey: []string{fmt.Sprintf("Bearer %s", token)}} + } return newClient(ctx, addr, authHeader) }