Add response for JSON only
This commit is contained in:
@@ -221,6 +221,16 @@ class ApiResponse extends Response
|
||||
$this->addContent($return);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper around exit() for JSON only responses
|
||||
*
|
||||
* @param array $data
|
||||
*/
|
||||
public function exitWithJson(array $data)
|
||||
{
|
||||
$this->exit('content', ['content' => $data], static::TYPE_JSON);
|
||||
}
|
||||
|
||||
/**
|
||||
* Quit execution with the message that the endpoint isn't implemented
|
||||
*
|
||||
|
||||
@@ -52,6 +52,6 @@ class VerifyCredentials extends BaseApi
|
||||
|
||||
// @todo Support the source property,
|
||||
$account = DI::mstdnAccount()->createFromContactId($cdata['user'], $uid);
|
||||
$this->response->exit('account', ['account' => $account->toArray()]);
|
||||
$this->response->exitWithJson($account->toArray());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user