- Big WIP on forms component
This commit is contained in:
1 parent
c0b0681fee
commit
3d50cfaccb
14 files changed
+114
-20
No files matched your search
@@ -3,6 +3,7 @@
|
||||
namespace Lean\Api\ApplicationStrategy;
|
||||
|
||||
use DI\Attribute\Inject;
|
||||
use Lean\Api\Middleware\ApiRenderer;
|
||||
use Lean\Factory\HttpFactoryInterface;
|
||||
use Picea\Picea;
|
||||
use Psr\Container\ContainerInterface;
|
||||
@@ -15,14 +16,14 @@ class NotFoundDecorator extends \Lean\ApplicationStrategy\NotFoundDecorator
|
||||
{
|
||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||
{
|
||||
if (php_sapi_name() !== 'cli' and ! defined('STDIN')) {
|
||||
return $this->throw404($request);
|
||||
if (php_sapi_name() !== 'cli' and ! defined('STDIN') and ApiRenderer::awaitingJson($request)) {
|
||||
return $this->throw404api($request);
|
||||
}
|
||||
|
||||
return parent::process($request, $handler);
|
||||
}
|
||||
|
||||
public function throw404(ServerRequestInterface $request) : ResponseInterface
|
||||
public function throw404api(ServerRequestInterface $request) : ResponseInterface
|
||||
{
|
||||
return $this->checkAssetTrigger($request) ?: $this->httpFactory->createJsonResponse([
|
||||
'status' => 'error',
|
||||
|
||||
Reference in new issue
Block a user