Vanillaxi commented on code in PR #3443:
URL: https://github.com/apache/dubbo-go/pull/3443#discussion_r3434982296
##########
protocol/triple/client.go:
##########
@@ -66,12 +66,18 @@ type clientManager struct {
// TODO: code a triple client between clientManager and triple_protocol client
// TODO: write a NewClient for triple client
-func (cm *clientManager) callUnary(ctx context.Context, method string, req,
resp any) error {
+func (cm *clientManager) callUnary(ctx context.Context, method string, req,
resp any, responseHeader, responseTrailer *http.Header) error {
triReq := tri.NewRequest(req)
triResp := tri.NewResponse(resp)
if err := cm.triClient.CallUnary(ctx, triReq, method, triResp); err !=
nil {
return err
}
+ if responseHeader != nil {
+ *responseHeader = triResp.Header().Clone()
+ }
+ if responseTrailer != nil {
+ *responseTrailer = triResp.Trailer().Clone()
Review Comment:
感谢 review,我已经更新了 unary error path:现在 `CallUnary` 返回 error 时也会捕获 response
header/trailer,同时 `receiveUnaryResponse` 会在 error path 返回前填充 response wrapper
metadata。另外补了 error-path 测试,验证 `WithResponseHeader` / `WithResponseTrailer` 在
unary error response 下也能拿到 metadata。
--
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]