Move System::httpExit to BaseModule->httpExit

- This will ensure headers set in BaseModule->run will be carried in httpExit scenarios
- Deprecate httpExit() method in Core\System
This commit is contained in:
Hypolite Petovan 2023-09-21 12:35:55 -04:00
parent 94e3dde2e3
commit da1416c07f
24 changed files with 58 additions and 32 deletions

View file

@ -28,6 +28,7 @@ use Friendica\DI;
use Friendica\Model\User;
use Friendica\Module\Response;
use Friendica\Network\HTTPException\FoundException;
use Friendica\Network\HTTPException\InternalServerErrorException;
use Friendica\Network\HTTPException\MovedPermanentlyException;
use Friendica\Network\HTTPException\TemporaryRedirectException;
use Friendica\Util\BasePath;
@ -357,12 +358,15 @@ class System
* This function adds the content and a content-type HTTP header to the output.
* After finishing the process is getting killed.
*
* @param string $content
* @param string $type
* @param string $content
* @param string $type
* @param string|null $content_type
* @return void
* @throws InternalServerErrorException
* @deprecated since 2023.09 Use BaseModule->httpExit() instead
*/
public static function httpExit(string $content, string $type = Response::TYPE_HTML, ?string $content_type = null) {
public static function httpExit(string $content, string $type = Response::TYPE_HTML, ?string $content_type = null)
{
DI::apiResponse()->setType($type, $content_type);
DI::apiResponse()->addContent($content);
self::echoResponse(DI::apiResponse()->generate());