Skip to content

Commit

Permalink
lib: Fix JSON response exception on form failure
Browse files Browse the repository at this point in the history
  • Loading branch information
lippserd committed Oct 26, 2015
1 parent e07e16d commit 4593c78
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions library/Icinga/Web/Form.php
Expand Up @@ -1171,10 +1171,9 @@ public function handleRequest(Request $request = null)
$this->getView()->layout()->redirectUrl = $this->getRedirectUrl()->getAbsoluteUrl();
}
} elseif ($this->getIsApiTarget()) {
$this->getResponse()->sendJson(array(
'status' => 'fail',
'data' => array_merge($this->getMessages(), $this->getErrorMessages())
));
$this->getResponse()->json()->setFailData(
array_merge($this->getMessages(), $this->getErrorMessages())
)->sendResponse();
}
} elseif ($this->getValidatePartial()) {
// The form can't be processed but we may want to show validation errors though
Expand Down

0 comments on commit 4593c78

Please sign in to comment.