jwrookie commented on code in PR #2421:
URL: https://github.com/apache/apisix-dashboard/pull/2421#discussion_r874349477


##########
api/internal/core/entity/format.go:
##########
@@ -17,17 +17,23 @@
 package entity
 
 import (
-       "net"
+       "errors"
        "strconv"
+       "strings"
 
        "github.com/apisix/manager-api/internal/log"
 )
 
 func mapKV2Node(key string, val float64) (*Node, error) {
-       host, port, err := net.SplitHostPort(key)
-       if err != nil {
-               log.Errorf("split host port fail: %s", err)
-               return nil, err
+       hp := strings.Split(key, ":")
+       host := hp[0]
+       //  according to APISIX upstream nodes policy, port is optional
+       port := "0"

Review Comment:
   
https://github.com/apache/apisix-dashboard/blob/92f46d9d2fa8438659131eedecf9cab4c87b0f9d/api/internal/core/entity/entity.go#L99-L105
   
   We cannot give default values to port, the value of 0 is assigned because 
the zero value is ignored during `json.Marshal`



-- 
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: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to