diff --git a/modules/openapi-generator/src/main/resources/go/client.mustache b/modules/openapi-generator/src/main/resources/go/client.mustache index 799553a189e3..62f75508baef 100644 --- a/modules/openapi-generator/src/main/resources/go/client.mustache +++ b/modules/openapi-generator/src/main/resources/go/client.mustache @@ -111,7 +111,7 @@ func selectHeaderAccept(accepts []string) string { // contains is a case insensitive match, finding needle in a haystack func contains(haystack []string, needle string) bool { for _, a := range haystack { - if strings.ToLower(a) == strings.ToLower(needle) { + if strings.EqualFold(a, needle) { return true } } diff --git a/modules/openapi-generator/src/main/resources/go/signing.mustache b/modules/openapi-generator/src/main/resources/go/signing.mustache index d7171ca5350c..d8c5b376e9e6 100644 --- a/modules/openapi-generator/src/main/resources/go/signing.mustache +++ b/modules/openapi-generator/src/main/resources/go/signing.mustache @@ -136,7 +136,7 @@ func (h *HttpSignatureAuth) ContextWithValue(ctx context.Context) (context.Conte } m := make(map[string]bool) for _, h := range h.SignedHeaders { - if strings.ToLower(h) == strings.ToLower(HttpHeaderAuthorization) { + if strings.EqualFold(h, HttpHeaderAuthorization) { return nil, fmt.Errorf("Signed headers cannot include the 'Authorization' header") } m[h] = true diff --git a/samples/client/petstore/go/go-petstore/client.go b/samples/client/petstore/go/go-petstore/client.go index c656e9616cac..f872380df96a 100644 --- a/samples/client/petstore/go/go-petstore/client.go +++ b/samples/client/petstore/go/go-petstore/client.go @@ -119,7 +119,7 @@ func selectHeaderAccept(accepts []string) string { // contains is a case insensitive match, finding needle in a haystack func contains(haystack []string, needle string) bool { for _, a := range haystack { - if strings.ToLower(a) == strings.ToLower(needle) { + if strings.EqualFold(a, needle) { return true } } diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/client.go b/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/client.go index dc4affb7bd50..547180d6b63e 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/client.go +++ b/samples/openapi3/client/extensions/x-auth-id-alias/go-experimental/client.go @@ -104,7 +104,7 @@ func selectHeaderAccept(accepts []string) string { // contains is a case insensitive match, finding needle in a haystack func contains(haystack []string, needle string) bool { for _, a := range haystack { - if strings.ToLower(a) == strings.ToLower(needle) { + if strings.EqualFold(a, needle) { return true } } diff --git a/samples/openapi3/client/petstore/go/go-petstore/client.go b/samples/openapi3/client/petstore/go/go-petstore/client.go index a2a56c5af959..c6d7fabcb2ef 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/client.go +++ b/samples/openapi3/client/petstore/go/go-petstore/client.go @@ -122,7 +122,7 @@ func selectHeaderAccept(accepts []string) string { // contains is a case insensitive match, finding needle in a haystack func contains(haystack []string, needle string) bool { for _, a := range haystack { - if strings.ToLower(a) == strings.ToLower(needle) { + if strings.EqualFold(a, needle) { return true } } diff --git a/samples/openapi3/client/petstore/go/go-petstore/signing.go b/samples/openapi3/client/petstore/go/go-petstore/signing.go index f2610ce7742f..d6dfdbb50f95 100644 --- a/samples/openapi3/client/petstore/go/go-petstore/signing.go +++ b/samples/openapi3/client/petstore/go/go-petstore/signing.go @@ -145,7 +145,7 @@ func (h *HttpSignatureAuth) ContextWithValue(ctx context.Context) (context.Conte } m := make(map[string]bool) for _, h := range h.SignedHeaders { - if strings.ToLower(h) == strings.ToLower(HttpHeaderAuthorization) { + if strings.EqualFold(h, HttpHeaderAuthorization) { return nil, fmt.Errorf("Signed headers cannot include the 'Authorization' header") } m[h] = true