Skip to content

Instantly share code, notes, and snippets.

@exts
Last active April 24, 2018 22:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save exts/12d520fdd6ce123fc69f0a3305eb84ed to your computer and use it in GitHub Desktop.
Save exts/12d520fdd6ce123fc69f0a3305eb84ed to your computer and use it in GitHub Desktop.
<?php
namespace Http\Handlers;
use Slim\Handlers\Error;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
/**
* Class ErrorHandler
*
* @package Http\Handlers
*/
class ErrorHandler extends Error
{
/**
* @param ServerRequestInterface $request
* @param ResponseInterface $response
* @param \Exception $exception
*
* @return ResponseInterface|static
*/
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, \Exception $exception)
{
$response = parent::__invoke($request, $response, $exception);
return $response->withHeader('X-LiteSpeed-Cache-Control', 'no-cache');
}
}
<?php
namespace Http\Handlers;
use Slim\Handlers\PhpError;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
/**
* Class PhpErrorHandler
*
* @package Http\Handlers
*/
class PhpErrorHandler extends PhpError
{
/**
* @param ServerRequestInterface $request
* @param ResponseInterface $response
* @param \Throwable $error
*
* @return ResponseInterface|static
*/
public function __invoke(ServerRequestInterface $request, ResponseInterface $response, \Throwable $error)
{
$response = parent::__invoke($request, $response, $error);
return $response->withHeader('X-LiteSpeed-Cache-Control', 'no-cache');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment