Merge pull request #3486 from tao12345666333/rm-unnecessary-str-fmt

remotes: remove unnecessary string formatting
This commit is contained in:
Wei Fu
2019-08-05 14:05:51 +08:00
committed by GitHub

View File

@@ -265,7 +265,7 @@ func (ah *authHandler) doBasicAuth(ctx context.Context) (string, error) {
}
auth := base64.StdEncoding.EncodeToString([]byte(username + ":" + secret))
return fmt.Sprintf("%s %s", "Basic", auth), nil
return fmt.Sprintf("Basic %s", auth), nil
}
func (ah *authHandler) doBearerAuth(ctx context.Context) (string, error) {
@@ -307,7 +307,7 @@ func (ah *authHandler) doBearerAuth(ctx context.Context) (string, error) {
token, err = ah.fetchToken(ctx, to)
err = errors.Wrap(err, "failed to fetch anonymous token")
}
token = fmt.Sprintf("%s %s", "Bearer", token)
token = fmt.Sprintf("Bearer %s", token)
r.token, r.err = token, err
r.Done()