From cdc214c764340fb5cfee553f2a3e6e6b7db15d37 Mon Sep 17 00:00:00 2001 From: TomlongTK Date: Tue, 2 Apr 2024 17:51:06 +0800 Subject: [PATCH] Fix status --- .../http12/AbstractServerHttpChannelObserver.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/AbstractServerHttpChannelObserver.java b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/AbstractServerHttpChannelObserver.java index 6621e7f3929..515afb2d503 100644 --- a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/AbstractServerHttpChannelObserver.java +++ b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/AbstractServerHttpChannelObserver.java @@ -138,14 +138,15 @@ protected void postOutputMessage(HttpOutputMessage outputMessage) throws Throwab protected void preMetadata(HttpMetadata httpMetadata, HttpOutputMessage outputMessage) {} protected final String resolveStatusCode(Object data) { - return String.valueOf(data instanceof HttpResult ? ((HttpResult) data).getStatus() : HttpStatus.OK); + return data instanceof HttpResult + ? String.valueOf(((HttpResult) data).getStatus()) + : HttpStatus.OK.getStatusString(); } protected final String resolveStatusCode(Throwable throwable) { - return String.valueOf( - throwable instanceof HttpStatusException - ? ((HttpStatusException) throwable).getStatusCode() - : HttpStatus.INTERNAL_SERVER_ERROR.getCode()); + return throwable instanceof HttpStatusException + ? String.valueOf(((HttpStatusException) throwable).getStatusCode()) + : HttpStatus.INTERNAL_SERVER_ERROR.getStatusString(); } protected final ErrorResponse buildErrorResponse(String statusCode, Throwable throwable) {