[FEATURE] Add option to set custom http return status
This commit is contained in:
@@ -191,9 +191,10 @@ class AbstractEIDController
|
||||
* @param ResponseInterface $response
|
||||
* @return void
|
||||
*/
|
||||
public function processRequest(ServerRequestInterface $request,
|
||||
ResponseInterface $response = null)
|
||||
{
|
||||
public function processRequest(
|
||||
ServerRequestInterface $request,
|
||||
ResponseInterface $response = null
|
||||
) {
|
||||
$apiObject = explode('/', $request->getUri()->getPath())[3];
|
||||
$apiObjectId = explode('/', $request->getUri()->getPath())[4];
|
||||
if (!$apiObject) {
|
||||
@@ -221,6 +222,18 @@ class AbstractEIDController
|
||||
) {
|
||||
$response = $response->withStatus(400);
|
||||
}
|
||||
if (is_array($responseData)
|
||||
&& array_key_exists('status', $responseData)
|
||||
) {
|
||||
if (is_array($responseData['status'])) {
|
||||
$response = $response->withStatus(
|
||||
$responseData['status'][0],
|
||||
$responseData['status'][1]
|
||||
);
|
||||
} else {
|
||||
$response = $response->withStatus($responseData['status']);
|
||||
}
|
||||
}
|
||||
$response->getBody()->write(\json_encode($responseData));
|
||||
return $response;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user