Use Whoops in debug mode, JSON API compliant errors otherwise

pull/9/head
Franz Liedke 10 years ago
parent e514b1bc5f
commit a0ef02e4f6

@ -1,5 +1,6 @@
<?php
use Flarum\Core;
use Psr\Http\Message\ResponseInterface as Response;
use Psr\Http\Message\ServerRequestInterface as Request;
use Zend\Diactoros\Server;
@ -19,7 +20,12 @@ $api->pipe($app->make('Flarum\Api\Middleware\ReadJsonParameters'));
$api->pipe($app->make('Flarum\Api\Middleware\LoginWithHeader'));
$api->pipe('/api', $app->make('Flarum\Http\RouterMiddleware', ['routes' => $app->make('flarum.api.routes')]));
$api->pipe(new \Flarum\Api\Middleware\JsonApiErrors());
if (Core::inDebugMode()) {
$api->pipe(new \Franzl\Middleware\Whoops\Middleware());
} else {
$api->pipe(new \Flarum\Api\Middleware\JsonApiErrors());
}
$server = Server::createServer(
$api,

Loading…
Cancel
Save