From f6f7fe0ab65e7bc50849426ff1a7d95185409894 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 13 Nov 2024 22:31:55 +0100 Subject: [PATCH] https status must be 400 instead of 200 in case of an error --- restapi/index.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/restapi/index.php b/restapi/index.php index b8621008d..2548d737c 100644 --- a/restapi/index.php +++ b/restapi/index.php @@ -2346,7 +2346,7 @@ class RestapiController { /* {{{ */ $params = $request->getParsedBody(); if (empty($params['userid'])) { - return $response->withJson(array('success'=>false, 'message'=>'Missing userid', 'data'=>''), 500); + return $response->withJson(array('success'=>false, 'message'=>'Missing userid', 'data'=>''), 400); } $userId = $params['userid']; if(ctype_digit($userId)) @@ -2404,9 +2404,9 @@ class RestapiController { /* {{{ */ if($check !== true) return $check; $params = $request->getParsedBody(); - if (empty($params['enable'])) + if (!isset($params['enable'])) { - return $response->withJson(array('success'=>false, 'message'=>'You must supply an "enable" value', 'data'=>''), 200); + return $response->withJson(array('success'=>false, 'message'=>'You must supply an "enable" value', 'data'=>''), 400); } $inherit = false; @@ -2474,12 +2474,12 @@ class RestapiController { /* {{{ */ { if ($params['id'] == null) { - return $response->withJson(array('success'=>false, 'message'=>'Please PUT the user or group Id', 'data'=>''), 200); + return $response->withJson(array('success'=>false, 'message'=>'Please PUT the user or group Id', 'data'=>''), 400); } if ($params['mode'] == null) { - return $response->withJson(array('success'=>false, 'message'=>'Please PUT the access mode', 'data'=>''), 200); + return $response->withJson(array('success'=>false, 'message'=>'Please PUT the access mode', 'data'=>''), 400); } $modeInput = $params['mode'];