Copilot commented on code in PR #15464:
URL: https://github.com/apache/dubbo/pull/15464#discussion_r2157925029


##########
dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/h12/ServerStreamServerCallListener.java:
##########
@@ -29,7 +30,12 @@ public ServerStreamServerCallListener(
     }
 
     @Override
-    public void onReturn(Object value) {}
+    public void onReturn(Object value) {

Review Comment:
   The override only handles HttpResult values and omits delegating to the 
default behavior for other return types, which will swallow non-HttpResult 
returns. Consider calling super.onReturn(value) when value is not an instance 
of HttpResult.



##########
dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/AbstractServerHttpChannelObserver.java:
##########
@@ -166,13 +166,13 @@ protected final HttpMetadata buildMetadata(
         if (message != null) {
             headers.set(HttpHeaderNames.CONTENT_TYPE.getKey(), 
responseEncoder.contentType());
         }
+        customizeHeaders(headers, throwable, message);
         if (data instanceof HttpResult) {
             HttpResult<?> result = (HttpResult<?>) data;
             if (result.getHeaders() != null) {
                 headers.set(result.getHeaders());
             }
         }

Review Comment:
   Moving customizeHeaders before applying HttpResult headers causes custom 
header values to be overwritten. To preserve custom headers, invoke 
customizeHeaders after merging HttpResult headers.
   ```suggestion
           if (data instanceof HttpResult) {
               HttpResult<?> result = (HttpResult<?>) data;
               if (result.getHeaders() != null) {
                   headers.set(result.getHeaders());
               }
           }
           customizeHeaders(headers, throwable, message);
   ```



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