-
Notifications
You must be signed in to change notification settings - Fork 122
Description
What happened?
The A2A server does not set the Content-Type: application/json header when sending push notifications, leading to a 415 Unsupported Media Type error. This occurs because the request defaults to application/octet-stream, which is not accepted by the client.
Relevant code: io.a2a.server.tasks.BasePushNotificationSender#dispatchNotification
a2a-java/server-common/src/main/java/io/a2a/server/tasks/BasePushNotificationSender.java
Lines 70 to 99 in fcc02ec
| private boolean dispatchNotification(Task task, PushNotificationConfig pushInfo) { | |
| String url = pushInfo.url(); | |
| String token = pushInfo.token(); | |
| A2AHttpClient.PostBuilder postBuilder = httpClient.createPost(); | |
| if (token != null && !token.isBlank()) { | |
| postBuilder.addHeader(X_A2A_NOTIFICATION_TOKEN, token); | |
| } | |
| String body; | |
| try { | |
| body = Utils.OBJECT_MAPPER.writeValueAsString(task); | |
| } catch (JsonProcessingException e) { | |
| LOGGER.debug("Error writing value as string: {}", e.getMessage(), e); | |
| return false; | |
| } catch (Throwable throwable) { | |
| LOGGER.debug("Error writing value as string: {}", throwable.getMessage(), throwable); | |
| return false; | |
| } | |
| try { | |
| postBuilder | |
| .url(url) | |
| .body(body) | |
| .post(); | |
| } catch (IOException | InterruptedException e) { | |
| LOGGER.debug("Error pushing data to " + url + ": {}", e.getMessage(), e); | |
| return false; | |
| } | |
| return true; |
Relevant log output
Code of Conduct
- I agree to follow this project's Code of Conduct
Reactions are currently unavailable