ztelur commented on a change in pull request #310:
URL: https://github.com/apache/dubbo-go-pixiu/pull/310#discussion_r769162889
##########
File path: pkg/common/util/stringutil/stringutil.go
##########
@@ -72,14 +72,19 @@ func IsMatchAll(key string) bool {
func GetTrieKey(method string, path string) string {
ret := ""
+ //"http://localhost:8882/api/v1/test-dubbo/user?name=tc"
+ if strings.Contains(path, constant.ProtocolSlash) {
+ path = path[strings.Index(path,
constant.ProtocolSlash)+len(constant.ProtocolSlash):]
+ path = path[strings.Index(path, constant.PathSlash)+1:]
+ }
if strings.HasPrefix(path, constant.PathSlash) {
ret = method + path
} else {
ret = method + constant.PathSlash + path
}
-
if strings.HasSuffix(ret, constant.PathSlash) {
ret = ret[0 : len(ret)-1]
}
+ ret = strings.Split(ret, "?")[0]
Review comment:
is it better to make "?" as a constant named variable? code in trie.go
uses "?" too
##########
File path: pkg/common/router/trie/trie.go
##########
@@ -18,12 +18,13 @@
package trie
import (
- "github.com/pkg/errors"
+ "strings"
)
import (
"github.com/apache/dubbo-go-pixiu/pkg/common/util/stringutil"
"github.com/apache/dubbo-go-pixiu/pkg/logger"
+ "github.com/pkg/errors"
Review comment:
please split third party import to another import block,like below.
import (
"github.com/apache/dubbo-go-pixiu/pkg/common/util/stringutil"
"github.com/apache/dubbo-go-pixiu/pkg/logger"
)
import (
"github.com/pkg/errors""
)
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]