enable HTTP method overrides as early as possible with the HTTP cache

This commit is contained in:
Christian Flothmann 2021-03-17 21:16:29 +01:00
parent e3788b68be
commit 93e9337382

View File

@ -18,6 +18,7 @@ use Symfony\Component\HttpKernel\HttpCache\HttpCache as BaseHttpCache;
use Symfony\Component\HttpKernel\HttpCache\Store; use Symfony\Component\HttpKernel\HttpCache\Store;
use Symfony\Component\HttpKernel\HttpCache\StoreInterface; use Symfony\Component\HttpKernel\HttpCache\StoreInterface;
use Symfony\Component\HttpKernel\HttpCache\SurrogateInterface; use Symfony\Component\HttpKernel\HttpCache\SurrogateInterface;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
/** /**
@ -62,6 +63,15 @@ class HttpCache extends BaseHttpCache
parent::__construct($kernel, $this->createStore(), $this->createSurrogate(), array_merge($this->options, $this->getOptions())); parent::__construct($kernel, $this->createStore(), $this->createSurrogate(), array_merge($this->options, $this->getOptions()));
} }
public function handle(Request $request, int $type = HttpKernelInterface::MASTER_REQUEST, bool $catch = true)
{
if ($this->kernel->getContainer()->getParameter('kernel.http_method_override')) {
Request::enableHttpMethodParameterOverride();
}
return parent::handle($request, $type, $catch);
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */