fix status code in API + PHP 5.3 errors on object instantiation

This commit is contained in:
Jonathan Labreuille
2016-09-12 10:21:59 +02:00
parent 0c5589a3e3
commit 1918894c5c
2 changed files with 5 additions and 12 deletions

View File

@@ -102,14 +102,7 @@ class API {
try {
$endpoint = new $endpoint();
$response = $endpoint->$method($data);
// TODO: remove this condition once the API unification is complete
if(is_object($response)) {
$response->send();
} else {
// LEGACY API
wp_send_json($response);
}
$response->send();
} catch(\Exception $e) {
$error_response = new ErrorResponse(
array($e->getCode() => $e->getMessage())