diff --git a/webapp/src/Controller/API/GeneralInfoController.php b/webapp/src/Controller/API/GeneralInfoController.php index 0de157989d..d2555439c8 100644 --- a/webapp/src/Controller/API/GeneralInfoController.php +++ b/webapp/src/Controller/API/GeneralInfoController.php @@ -249,7 +249,7 @@ public function getDatabaseConfigurationAction( content: new OA\JsonContent(type: 'object') )] #[OA\Response( - response: 400, + response: 422, description: 'An error occurred while saving the configuration', content: new OA\JsonContent( properties: [ @@ -271,7 +271,7 @@ public function updateConfigurationAction(Request $request): JsonResponse|array { $errors = $this->config->saveChanges($request->request->all(), $this->eventLogService, $this->dj); if (!empty($errors)) { - return new JsonResponse(['errors' => $errors], 400); + return new JsonResponse(['errors' => $errors], Response::HTTP_UNPROCESSABLE_ENTITY); } return $this->config->all(false); } diff --git a/webapp/tests/Unit/Controller/API/ConfigControllerTest.php b/webapp/tests/Unit/Controller/API/ConfigControllerTest.php index 7eb77e0b6b..1f7530a251 100644 --- a/webapp/tests/Unit/Controller/API/ConfigControllerTest.php +++ b/webapp/tests/Unit/Controller/API/ConfigControllerTest.php @@ -118,7 +118,7 @@ public function testConfigChangeAPIInvalid( static::assertEquals($currentValue, $response[$property]); $proposedChange = [$property => $newValue]; - $response = $this->verifyApiJsonResponse('PUT', $this->endpoint, 400, 'admin', $proposedChange); + $response = $this->verifyApiJsonResponse('PUT', $this->endpoint, 422, 'admin', $proposedChange); static::assertEquals(['errors' => [$property => $errorMessage]], $response); }