fix(eventbridgev2): send no message member in a SerializationException (#9593)

This commit is contained in:
TATSUNO “Taz” Yasuhiro authored and GitHub committed 2026-11-27 10:36:45 -04:00
1 parent 0285a3df5b
commit 05217485a9
2 files changed
+6 -2

No files matched your search

@@ -1,5 +1,6 @@
package io.floci.aws.core.common;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
import jakarta.ws.rs.core.Response;
@@ -15,7 +16,9 @@ public final class CborErrorResponses {
public static final String AWS_CBOR_1_1_MEDIA_TYPE = "application/x-amz-cbor-1.1";
public static final String GENERIC_CBOR_MEDIA_TYPE = "application/cbor";
private static final ObjectMapper CBOR_MAPPER = new ObjectMapper(new CBORFactory());
// AWS sends no member for an error without a message.
private static final ObjectMapper CBOR_MAPPER = new ObjectMapper(new CBORFactory())
.setSerializationInclusion(JsonInclude.Include.NON_NULL);
private CborErrorResponses() {
}
@@ -33,6 +33,7 @@ import java.util.Map;
import static io.restassured.RestAssured.given;
import static org.hamcrest.Matchers.equalTo;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
@@ -272,7 +273,7 @@ class EventBridgeV2EventSourceIntegrationTest {
JsonNode error = CBOR_MAPPER.readTree(answer);
assertEquals("SerializationException", error.path("__type").asText());
assertNull(error.path("message").textValue());
assertFalse(error.has("message"));
}
private static WebhookAuthConfiguration staticToken(String header, String secretValue) {