Skip to content

Commit

Permalink
Add Content-Type response header for JSON responses
Browse files Browse the repository at this point in the history
  • Loading branch information
dlichtenberger authored and skjnldsv committed Jun 7, 2023
1 parent 2c5f141 commit ff870db
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -1316,6 +1316,7 @@ public function isAuthenticated() {
if (isset($_POST['step'])) {
// mark step as failed
http_response_code(500);
header('Content-Type: application/json');
echo(json_encode(['proceed' => false, 'response' => $e->getMessage()]));
die();
}
Expand Down Expand Up @@ -1398,6 +1399,7 @@ public function isAuthenticated() {
break;
}
$updater->endStep($step);
header('Content-Type: application/json');
echo(json_encode(['proceed' => true]));
} catch (UpdateException $e) {
$message = $e->getData();
Expand All @@ -1413,6 +1415,7 @@ public function isAuthenticated() {
$updater->rollbackChanges($step);
}
http_response_code(500);
header('Content-Type: application/json');
echo(json_encode(['proceed' => false, 'response' => $message]));
} catch (\Exception $e) {
$message = $e->getMessage();
Expand All @@ -1428,6 +1431,7 @@ public function isAuthenticated() {
$updater->rollbackChanges($step);
}
http_response_code(500);
header('Content-Type: application/json');
echo(json_encode(['proceed' => false, 'response' => $message]));
}

Expand Down

0 comments on commit ff870db

Please sign in to comment.