You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/09/13 03:12:39 UTC

[GitHub] [dubbo-go] zouyx commented on a change in pull request #1444: Ftr: compatible with lower versions registering "default." keys

zouyx commented on a change in pull request #1444:
URL: https://github.com/apache/dubbo-go/pull/1444#discussion_r706976631



##########
File path: common/url_test.go
##########
@@ -421,3 +421,11 @@ func TestCompareURLEqualFunc(t *testing.T) {
 func CustomCompareURLEqual(l *URL, r *URL, execludeParam ...string) bool {
 	return l.PrimitiveURL == r.PrimitiveURL
 }
+
+func TestURLWithLowerVersion(t *testing.T) {

Review comment:
       I think your test case has not cover all scene.
   You should provide a new test case about `default.version` replace `version`.

##########
File path: protocol/invocation/rpcinvocation.go
##########
@@ -165,6 +165,13 @@ func (r *RPCInvocation) SetAttachments(key string, value interface{}) {
 	if r.attachments == nil {
 		r.attachments = make(map[string]interface{})
 	}
+	// compatible "default." prefix
+	if strings.Index(key, constant.DEFAULT_KEY_PREFIX) == 0 {

Review comment:
       Should you use `strings.HasPrefix`?

##########
File path: common/url.go
##########
@@ -259,6 +259,16 @@ func NewURL(urlString string, opts ...Option) (*URL, error) {
 		return &s, perrors.Errorf("url.ParseQuery(raw url string{%s}),  error{%v}", serviceUrl.RawQuery, err)
 	}
 
+	// compatible "default." prefix
+	for key, value := range s.params {
+		if strings.Index(key, constant.DEFAULT_KEY_PREFIX) == 0 && len(value) > 0 {

Review comment:
       Should you use `strings.HasPrefix`?




-- 
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-unsubscribe@dubbo.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org