From 15e21ca331257546949269b1e2a834c066573322 Mon Sep 17 00:00:00 2001 From: Paul Harris Date: Mon, 24 Feb 2025 16:21:10 +1100 Subject: [PATCH] add unsupported media type to register validators endpoint (#9160) add unsupported media type to register validators endpoint fixes #9158 Signed-off-by: Paul Harris --- CHANGELOG.md | 1 + .../paths/_eth_v1_validator_register_validator.json | 10 ++++++++++ .../handlers/v1/validator/PostRegisterValidator.java | 1 + 3 files changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc27f9305cf..5964a74bbe7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,3 +14,4 @@ - Added Chiado Electra configuration due at Mar-06-2025 09:43:40 GMT+0000 ### Bug Fixes + - added 415 response code for beacon-api `/eth/v1/validator/register_validator`. diff --git a/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/paths/_eth_v1_validator_register_validator.json b/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/paths/_eth_v1_validator_register_validator.json index 802ad1eb56f..ad4d525dc2a 100644 --- a/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/paths/_eth_v1_validator_register_validator.json +++ b/data/beaconrestapi/src/integration-test/resources/tech/pegasys/teku/beaconrestapi/beacon/paths/_eth_v1_validator_register_validator.json @@ -37,6 +37,16 @@ } } }, + "415" : { + "description" : "Unsupported media type", + "content" : { + "application/json" : { + "schema" : { + "$ref" : "#/components/schemas/HttpErrorResponse" + } + } + } + }, "503" : { "description" : "Service unavailable", "content" : { diff --git a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/validator/PostRegisterValidator.java b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/validator/PostRegisterValidator.java index c4b21bdb865..fe3e108be7b 100644 --- a/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/validator/PostRegisterValidator.java +++ b/data/beaconrestapi/src/main/java/tech/pegasys/teku/beaconrestapi/handlers/v1/validator/PostRegisterValidator.java @@ -54,6 +54,7 @@ public PostRegisterValidator(final ValidatorDataProvider validatorDataProvider) SIGNED_VALIDATOR_REGISTRATIONS_SCHEMA.getJsonTypeDefinition(), SIGNED_VALIDATOR_REGISTRATIONS_SCHEMA::sszDeserialize) .response(SC_OK, "Registration information has been received.") + .withUnsupportedMediaTypeResponse() .withBadRequestResponse( Optional.of( "The request could not be processed, check the response for more information."))