2456868764 opened a new issue, #2641:
URL: https://github.com/apache/dubbo-go/issues/2641

   ### Environment
   
   - Server: Dubbo-go, master
   - Client: Dubbo-go, master
   - Protocol: Triple
   - Registry: N/A
   
   
   ### Issue description
   
   server code 
   
   ```
   func (srv *GreetTripleServer) Greet(ctx context.Context, req 
*greet.GreetRequest) (*greet.GreetResponse, error) {
        resp := &greet.GreetResponse{Greeting: req.Name}
        ctx = context.WithValue(ctx, constant.AttachmentKey, 
map[string]interface{}{"server_info": "dubbo httpbin"})
        return resp, nil
   }
   ```
   
   client code 
   
   ```
           ctx := context.Background()
        resp, err := svc.Greet(ctx, &greet.GreetRequest{Name: "hello world"})
        if err != nil {
                c.JSON(http.StatusBadGateway, err.Error())
                return
        }
        attachments := make(map[string]interface{})
        if ctx.Value(constant.AttachmentKey) != nil {
                attachments = 
ctx.Value(constant.AttachmentKey).(map[string]interface{})
        }
   ```
   
   and found that client attachments is nil.
   then use curl to simulate as http which return is follow:
   
   ````
   (base) ➜  dubbo-go git:(feat-security) ✗ curl -v -H 
"content-type:application/json" http://127.0.0.1:8000/greet.GreetService/Greet 
-d '{"name":"hello"}'
   *   Trying 127.0.0.1:8000...
   * Connected to 127.0.0.1 (127.0.0.1) port 8000 (#0)
   > POST /greet.GreetService/Greet HTTP/1.1
   > Host: 127.0.0.1:8000
   > User-Agent: curl/8.1.2
   > Accept: */*
   > content-type:application/json
   > Content-Length: 16
   >
   < HTTP/1.1 200 OK
   < Accept-Encoding: gzip
   < Content-Type: application/json
   < Date: Fri, 22 Mar 2024 03:05:43 GMT
   < Content-Length: 20
   <
   * Connection #0 to host 127.0.0.1 left intact
   {"greeting":"hello"}%
   
   no attachments return
   
   ````
   
   
   ### Logs
   
   <details><summary>Click me to check logs</summary>
   
   ```
   Copy logs to here.
   ```
   
   </details>
   


-- 
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]

Reply via email to