Skip to content

Commit 0cf5a72

Browse files
cfc4nchaochn47
authored andcommitted
credentials: let GetRequestMetadata() return nil when authToken isn't initialized.
Signed-off-by: Chao Chen <[email protected]>
1 parent 1fc259d commit 0cf5a72

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

clientv3/credentials/credentials.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ func (rc *perRPCCredential) GetRequestMetadata(ctx context.Context, s ...string)
156156
rc.authTokenMu.RLock()
157157
authToken := rc.authToken
158158
rc.authTokenMu.RUnlock()
159+
if authToken == "" {
160+
return nil, nil
161+
}
159162
return map[string]string{rpctypes.TokenFieldNameGRPC: authToken}, nil
160163
}
161164

0 commit comments

Comments
 (0)