chore: update error format

This commit is contained in:
steven
2023-09-29 13:04:54 +08:00
parent 73e189ea61
commit a928c4f845
8 changed files with 46 additions and 46 deletions

View File

@@ -132,7 +132,7 @@ func getTokenFromMetadata(md metadata.MD) (string, error) {
if len(md.Get("Authorization")) > 0 {
authHeaderParts := strings.Fields(authorizationHeaders[0])
if len(authHeaderParts) != 2 || strings.ToLower(authHeaderParts[0]) != "bearer" {
return "", errors.Errorf("authorization header format must be Bearer {token}")
return "", errors.New("authorization header format must be Bearer {token}")
}
return authHeaderParts[1], nil
}