mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 06:00:52 +00:00
[Go] use EqualFold instead instead of comparing strings in lower case (#12741)
* use EqualFold instead in the go client * update samples
This commit is contained in:
parent
08108cc4ba
commit
c982421495
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user