use Friendica\App\Router;
use Friendica\Capabilities\ICanHandleRequests;
use Friendica\Capabilities\ICanCreateResponses;
-use Friendica\Capabilities\IRespondToRequests;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Module\Special\HTTPException as ModuleHTTPException;
use Friendica\Network\HTTPException;
use Friendica\Util\Profiler;
+use Psr\Http\Message\ResponseInterface;
use Psr\Log\LoggerInterface;
/**
/**
* {@inheritDoc}
*/
- public function run(array $post = [], array $request = []): IRespondToRequests
+ public function run(array $post = [], array $request = []): ResponseInterface
{
// @see https://github.com/tootsuite/mastodon/blob/c3aef491d66aec743a3a53e934a494f653745b61/config/initializers/cors.rb
if (substr($request['pagename'] ?? '', 0, 12) == '.well-known/') {
case Router::PUT:
$this->put();
break;
- default:
- $timestamp = microtime(true);
- // "rawContent" is especially meant for technical endpoints.
- // This endpoint doesn't need any theme initialization or other comparable stuff.
- $this->rawContent($request);
-
- try {
- $arr = ['content' => ''];
- Hook::callAll(static::class . '_mod_content', $arr);
- $this->response->addContent($arr['content']);
- $this->response->addContent($this->content($_REQUEST));
- } catch (HTTPException $e) {
- $this->response->addContent((new ModuleHTTPException())->content($e));
- } finally {
- $this->profiler->set(microtime(true) - $timestamp, 'content');
- }
- break;
}
- return $this->response;
+ $timestamp = microtime(true);
+ // "rawContent" is especially meant for technical endpoints.
+ // This endpoint doesn't need any theme initialization or other comparable stuff.
+ $this->rawContent($request);
+
+ try {
+ $arr = ['content' => ''];
+ Hook::callAll(static::class . '_mod_content', $arr);
+ $this->response->addContent($arr['content']);
+ $this->response->addContent($this->content($_REQUEST));
+ } catch (HTTPException $e) {
+ $this->response->addContent((new ModuleHTTPException())->content($e));
+ } finally {
+ $this->profiler->set(microtime(true) - $timestamp, 'content');
+ }
+
+ return $this->response->generate();
}
/*