fix(admin): serialize poll response as JSON string via ObjectMapper
Deploy to Production / deploy (push) Successful in 3m20s
Deploy to Production / deploy (push) Successful in 3m20s
Response.ok(Map.of(...)).build() with class-level @Produces(TEXT_HTML)
caused Quarkus to call Map.toString() instead of the Jackson writer,
producing {key=value} output that r.json() can't parse. Explicitly
serialize with ObjectMapper and set Content-Type to application/json.
Co-Authored-By: Mira Rehfeld <noreply@anthropic.com>
This commit is contained in:
+3
-2
@@ -56,10 +56,11 @@ public class DashboardResource {
|
||||
SandboxDashboardResponse d = registry.sandboxDetail(adminKey, uuid);
|
||||
long total = d.usage() == null ? 0L :
|
||||
d.usage().values().stream().mapToLong(Long::longValue).sum();
|
||||
return Response.ok(Map.of(
|
||||
String json = mapper.writeValueAsString(Map.of(
|
||||
"totalRequests", total,
|
||||
"ratePerMinute", d.ratePerMinute()
|
||||
)).build();
|
||||
));
|
||||
return Response.ok(json).type(MediaType.APPLICATION_JSON).build();
|
||||
} catch (Exception e) {
|
||||
LOG.errorf(e, "Poll failed for sandbox %s", uuid);
|
||||
return Response.serverError().build();
|
||||
|
||||
Reference in New Issue
Block a user