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 committed Mar 13, 2017
1 parent 28e49e6 commit 60ce88c
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 @@ -1066,6 +1066,7 @@ public function logVersion() {
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 @@ -1145,6 +1146,7 @@ public function logVersion() {
break;
}
$updater->endStep($step);
header('Content-Type: application/json');
echo(json_encode(['proceed' => true]));
} catch (UpdateException $e) {
$message = $e->getData();
Expand All @@ -1160,6 +1162,7 @@ public function logVersion() {
$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 @@ -1175,6 +1178,7 @@ public function logVersion() {
$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 60ce88c

Please sign in to comment.