This is an automated email from the ASF dual-hosted git repository.
xxubai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/amoro.git
The following commit(s) were added to refs/heads/master by this push:
new afdcd19bd [AMORO-4437][AMS] Fix dashboard API error response status
(#4438)
afdcd19bd is described below
commit afdcd19bdd1accb8960d82967d2b9f56e60f8226
Author: Sivakumar Mahalingam
<[email protected]>
AuthorDate: Tue Oct 13 13:50:54 2026 +0400
[AMORO-4437][AMS] Fix dashboard API error response status (#4438)
---
.../java/org/apache/amoro/server/dashboard/DashboardServer.java | 9 ++++++---
.../amoro/server/dashboard/TestDashboardAuthentication.java | 1 +
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git
a/amoro-ams/src/main/java/org/apache/amoro/server/dashboard/DashboardServer.java
b/amoro-ams/src/main/java/org/apache/amoro/server/dashboard/DashboardServer.java
index f6e1ab29d..800837ebd 100644
---
a/amoro-ams/src/main/java/org/apache/amoro/server/dashboard/DashboardServer.java
+++
b/amoro-ams/src/main/java/org/apache/amoro/server/dashboard/DashboardServer.java
@@ -472,12 +472,15 @@ public class DashboardServer {
if (!ctx.req.getRequestURI().startsWith("/api/ams")) {
ctx.html(getIndexFileContent());
} else {
- ctx.json(new ErrorResponse(HttpCode.FORBIDDEN, e.getMessage(), ""));
+ ctx.status(HttpCode.FORBIDDEN)
+ .json(new ErrorResponse(HttpCode.FORBIDDEN, e.getMessage(), ""));
}
} else if (e instanceof SignatureCheckException) {
- ctx.json(new ErrorResponse(HttpCode.FORBIDDEN, "Signature check failed",
""));
+ ctx.status(HttpCode.FORBIDDEN)
+ .json(new ErrorResponse(HttpCode.FORBIDDEN, "Signature check
failed", ""));
} else {
- ctx.json(new ErrorResponse(HttpCode.INTERNAL_SERVER_ERROR,
e.getMessage(), ""));
+ ctx.status(HttpCode.INTERNAL_SERVER_ERROR)
+ .json(new ErrorResponse(HttpCode.INTERNAL_SERVER_ERROR,
e.getMessage(), ""));
}
LOG.error("An error occurred while processing the url:{}", ctx.url(), e);
}
diff --git
a/amoro-ams/src/test/java/org/apache/amoro/server/dashboard/TestDashboardAuthentication.java
b/amoro-ams/src/test/java/org/apache/amoro/server/dashboard/TestDashboardAuthentication.java
index cecd5225e..26593f941 100644
---
a/amoro-ams/src/test/java/org/apache/amoro/server/dashboard/TestDashboardAuthentication.java
+++
b/amoro-ams/src/test/java/org/apache/amoro/server/dashboard/TestDashboardAuthentication.java
@@ -101,6 +101,7 @@ public class TestDashboardAuthentication {
private static void assertForbidden(HttpResponse<String> response, String
expectedMessage)
throws IOException {
+ Assertions.assertEquals(403, response.statusCode());
JsonNode responseBody = OBJECT_MAPPER.readTree(response.body());
Assertions.assertEquals(403, responseBody.get("code").asInt());
Assertions.assertEquals(expectedMessage,
responseBody.get("message").asText());