mirror of
https://github.com/traefik/traefik
synced 2026-02-03 11:10:33 +00:00
Replace Split in loops with more efficient SplitSeq
This commit is contained in:
@@ -245,8 +245,8 @@ func digestParts(resp *http.Response) map[string]string {
|
||||
result := map[string]string{}
|
||||
if len(resp.Header["Www-Authenticate"]) > 0 {
|
||||
wantedHeaders := []string{"nonce", "realm", "qop", "opaque"}
|
||||
responseHeaders := strings.Split(resp.Header["Www-Authenticate"][0], ",")
|
||||
for _, r := range responseHeaders {
|
||||
responseHeaders := strings.SplitSeq(resp.Header["Www-Authenticate"][0], ",")
|
||||
for r := range responseHeaders {
|
||||
for _, w := range wantedHeaders {
|
||||
if strings.Contains(r, w) {
|
||||
result[w] = strings.Split(r, `"`)[1]
|
||||
|
||||
@@ -409,7 +409,7 @@ func (s *BaseSuite) displayTraefikLog(output *bytes.Buffer) {
|
||||
if output == nil || output.Len() == 0 {
|
||||
log.Info().Msg("No Traefik logs.")
|
||||
} else {
|
||||
for _, line := range strings.Split(output.String(), "\n") {
|
||||
for line := range strings.SplitSeq(output.String(), "\n") {
|
||||
log.Info().Msg(line)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user