No-SilverBullet commented on code in PR #821:
URL: https://github.com/apache/dubbo-go-samples/pull/821#discussion_r2020879193


##########
context/go-client/cmd/main.go:
##########
@@ -40,15 +41,27 @@ func main() {
                panic(err)
        }
 
-       ctx := context.Background()
-       ctx = context.WithValue(ctx, constant.AttachmentKey, 
map[string]interface{}{
-               "key1": "user defined value 1",
-               "key2": "user defined value 2",
-       })
+       header := http.Header{"testKey1": []string{"testVal1"}, "testKey2": 
[]string{"testVal2"}}
+       // to store outgoing data ,and reserve the location for the receive 
field.
+       // header will be copy , and header's key will change to be lowwer.
+       ctx := triple_protocol.NewOutgoingContext(context.Background(), header)
+       ctx = triple_protocol.AppendToOutgoingContext(ctx, "testKey3", 
"testVal3")
 
        resp, err := svc.Greet(ctx, &greet.GreetRequest{Name: "hello world"})
        if err != nil {
                logger.Error(err)
        }
+       extractedHeader, _ := triple_protocol.FromIncomingContext(ctx)
+
+       var value1, value2 string
+       if values, ok := extractedHeader["outgoingcontextkey1"]; ok && 
len(values) > 0 {

Review Comment:
   http header should be Canonical, rename it to `OutgoingContextKey1` or use 
http.CanonicalHeaderKey(); same as other header keys should be modified too. 



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

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


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

Reply via email to