mirror of
https://github.com/friendica/friendica
synced 2024-12-22 19:20:17 +00:00
Add response for JSON only
This commit is contained in:
parent
d925e25424
commit
fb1e8e75f5
3 changed files with 13 additions and 3 deletions
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ class StatusesTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusShowWithJson()
|
||||
{
|
||||
self::markTestIncomplete('Needs Stastuses to not set header during call (like at BaseApi::setLinkHeader');
|
||||
self::markTestIncomplete('Needs Statuses to not set header during call (like at BaseApi::setLinkHeader');
|
||||
|
||||
// $result = api_status_show('json', 1);
|
||||
// self::assertStatus($result['status']);
|
||||
|
@ -25,7 +25,7 @@ class StatusesTest extends ApiTest
|
|||
*/
|
||||
public function testApiStatusShowWithXml()
|
||||
{
|
||||
self::markTestIncomplete('Needs Stastuses to not set header during call (like at BaseApi::setLinkHeader');
|
||||
self::markTestIncomplete('Needs Statuses to not set header during call (like at BaseApi::setLinkHeader');
|
||||
|
||||
// $result = api_status_show('xml', 1);
|
||||
// self::assertXml($result, 'statuses');
|
||||
|
|
Loading…
Reference in a new issue