1
0
Fork 0

fix error handling of register request with unknown transport

This commit is contained in:
Jonathan Treffler 2024-06-12 21:32:52 +02:00
parent 066d89873a
commit 41b3d84e9d

View file

@ -123,27 +123,26 @@ class SubscriptionManagementPlugin extends ServerPlugin {
$transport = $this->transportManager->getTransport($subscriptionType); $transport = $this->transportManager->getTransport($subscriptionType);
if($transport === null) { if(!is_null($transport)) {
[
'success' => $registerSuccess,
'error' => $registerError,
'responseStatus' => $responseStatus,
'response' => $responseContent,
'unsubscribeLink' => $unsubscribeLink,
'data' => $data
] = $transport->registerSubscription($subscriptionOptions);
$responseStatus = $responseStatus ?? Http::STATUS_CREATED;
$data = $data ?? False;
if(!$registerSuccess) {
$errors[] = $registerError;
}
} else {
$errors[] = $subscriptionType . " transport does not exist"; $errors[] = $subscriptionType . " transport does not exist";
} }
[
'success' => $registerSuccess,
'error' => $registerError,
'responseStatus' => $responseStatus,
'response' => $responseContent,
'unsubscribeLink' => $unsubscribeLink,
'data' => $data
] = $transport->registerSubscription($subscriptionOptions);
$responseStatus = $responseStatus ?? Http::STATUS_CREATED;
$data = $data ?? False;
if(!$registerSuccess) {
$errors[] = $registerError;
}
if(sizeof($errors) == 0) { if(sizeof($errors) == 0) {
$response->setStatus($responseStatus); $response->setStatus($responseStatus);