fix: HTTP+JSON transport returns 501 instead of 400 for UnsupportedOperationError.#787
fix: HTTP+JSON transport returns 501 instead of 400 for UnsupportedOperationError.#787ehsavoie merged 2 commits intoa2aproject:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the mapErrorToHttpStatus method in RestHandler.java to replace hardcoded HTTP status codes with values from the A2AErrorCodes enum. The review feedback suggests improving consistency by using the enum for InvalidAgentResponseError and removing a redundant check for InternalError that matches the default return value.
transport/rest/src/main/java/io/a2a/transport/rest/handler/RestHandler.java
Outdated
Show resolved
Hide resolved
transport/rest/src/main/java/io/a2a/transport/rest/handler/RestHandler.java
Outdated
Show resolved
Hide resolved
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors the mapErrorToHttpStatus method in RestHandler.java to replace hardcoded HTTP status codes with calls to A2AErrorCodes.XXX.httpCode() for various error types, improving consistency. The review suggests a further simplification of this method by leveraging A2AErrorCodes.fromCode(error.getCode()) to derive the HTTP status, which would eliminate the need for multiple instanceof checks and align better with the A2A protocol specification for error code mappings.
transport/rest/src/main/java/io/a2a/transport/rest/handler/RestHandler.java
Outdated
Show resolved
Hide resolved
…erationError. Returning the proper status code. Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Returning the proper status code.
Fixes #765 🦕