Commit 5839b262 authored by nicola85's avatar nicola85

Workaround to fix “_format” issue

parent b4e2a080
services:
http_middleware.bat_api:
class: Drupal\bat_api\StackMiddleware\BatApiMiddleware
tags:
- { name: http_middleware, priority: 1, responder: true }
<?php
/**
* @file
* Contains \Drupal\bat_api\StackMiddleware\BatApiMiddleware.php
*/
namespace Drupal\bat_api\StackMiddleware;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\HttpKernelInterface;
/**
* Provides a HTTP middleware.
*/
class BatApiMiddleware implements HttpKernelInterface {
/**
* The wrapped HTTP kernel.
*
* @var \Symfony\Component\HttpKernel\HttpKernelInterface
*/
protected $httpKernel;
/**
* Constructs a BatApiMiddleware object.
*
* @param \Symfony\Component\HttpKernel\HttpKernelInterface $kernel
* The decorated kernel.
* @param mixed $optional_argument
* (optional) An optional argument.
*/
public function __construct(HttpKernelInterface $http_kernel) {
$this->httpKernel = $http_kernel;
}
/**
* {@inheritdoc}
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
if ($format = $request->get('_format')) {
$request->setRequestFormat($format);
}
return $this->httpKernel->handle($request, $type, $catch);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment