tao12345666333 commented on code in PR #1451:
URL: 
https://github.com/apache/apisix-ingress-controller/pull/1451#discussion_r1033752911


##########
pkg/providers/ingress/translation/annotations/upstreamscheme/upstreamscheme.go:
##########
@@ -26,24 +27,24 @@ func NewParser() annotations.IngressAnnotationsParser {
        return &upstreamscheme{}
 }
 
-// string in slice
-func inSchemes(a string) bool {
-       list := []string{"http", "https", "grpc", "grpcs"}
-
-       for _, b := range list {
-               if b == a {
-                       return true
-               }
-       }
-       return false
+var schemeMap map[string]int = map[string]int{
+       "http":  1,
+       "https": 2,
+       "grpc":  3,
+       "grpcs": 4,
 }
 
 func (w *upstreamscheme) Parse(e annotations.Extractor) (interface{}, error) {
        scheme := e.GetStringAnnotation(annotations.AnnotationsUpstreamScheme)
-
-       if inSchemes(scheme) {
+       _, ok := schemeMap[scheme]

Review Comment:
   I thought we could ignore case?
   both `HTTP` and `http` can be used.
   
   You can convert the obtained configuration items to lowercase



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to