1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-08 06:06:45 +02:00

fix(core): fix issue with Rest API endpoints detection. #522

BREAKING CHANGES

- method isApiRequest() removed.
This commit is contained in:
Awilum
2020-12-25 15:53:34 +03:00
parent 79440a3ddd
commit de10f4f163
2 changed files with 11 additions and 19 deletions

View File

@@ -88,16 +88,6 @@ final class Flextype extends App
return self::$instances[$cls];
}
/**
* Determine API Request
*
* @return bool
*/
public function isApiRequest(): bool
{
return explode('/', Uri::createFromEnvironment(new Environment($_SERVER))->getPath())[0] === 'api';
}
/**
* Returns the current Flextype version
*/

View File

@@ -57,7 +57,6 @@ $flextype = Flextype::getInstance([
],
]);
/**
* Display Errors
*/
@@ -172,14 +171,12 @@ flextype('plugins')->init();
/**
* Include API ENDPOINTS
*/
if (flextype()->isApiRequest()) {
include_once ROOT_DIR . '/src/flextype/Endpoints/Utils/errors.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/Utils/access.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/entries.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/registry.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/media.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/images.php';
}
include_once ROOT_DIR . '/src/flextype/Endpoints/Utils/errors.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/Utils/access.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/entries.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/registry.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/media.php';
include_once ROOT_DIR . '/src/flextype/Endpoints/images.php';
/**
* Enable lazy CORS
@@ -190,6 +187,11 @@ if (flextype()->isApiRequest()) {
*/
flextype('cors')->init();
/**
* Run high priority event: onFlextypeBeforeRun before Flextype Application starts.
*/
flextype('emitter')->emit('onFlextypeBeforeRun');
/**
* Run application
*/