Skip to content

Commit 0b34d90

Browse files
committed
Use the application/json Content-Type for errors regardless of whether the error happens for streaming or non-streaming requests
1 parent b555236 commit 0b34d90

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

quarkus-sdk/src/main/java/io/a2a/server/apps/quarkus/A2AServerRoutes.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,11 @@ public void invokeJSONRPCHandler(@Body String body, RoutingContext rc) {
8888
error = new JSONRPCErrorResponse(new InternalError(t.getMessage()));
8989
} finally {
9090
if (error != null) {
91-
if (streaming) {
92-
streamingResponse = Multi.createFrom().item(error);
93-
} else {
94-
nonStreamingResponse = error;
95-
}
96-
}
97-
if (streaming) {
91+
rc.response()
92+
.setStatusCode(200)
93+
.putHeader(CONTENT_TYPE, APPLICATION_JSON)
94+
.end(Json.encodeToBuffer(error));
95+
} else if (streaming) {
9896
MultiSseSupport.subscribeObject(streamingResponse.map(i -> (Object)i), rc);
9997
} else {
10098
rc.response()

0 commit comments

Comments
 (0)