reduce the number of string copy operations.
This commit is contained in:
parent
14155d6031
commit
4b7dbfbcc3
1 changed files with 5 additions and 3 deletions
|
@ -116,9 +116,11 @@ func (r *Registry) setUserAgent(req *http.Request, extra ...VersionChecker) {
|
||||||
if len(r.baseVersions)+len(extra) == 0 {
|
if len(r.baseVersions)+len(extra) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if len(extra) == 0 {
|
||||||
userAgent := appendVersions(r.baseVersionsStr, extra...)
|
req.Header.Set("User-Agent", r.baseVersionsStr)
|
||||||
req.Header.Set("User-Agent", userAgent)
|
} else {
|
||||||
|
req.Header.Set("User-Agent", appendVersions(r.baseVersionsStr, extra...))
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue