You are here

public function FormatSetter::handle in JSON:API 8

Same name and namespace in other branches
  1. 8.2 src/StackMiddleware/FormatSetter.php \Drupal\jsonapi\StackMiddleware\FormatSetter::handle()

File

src/StackMiddleware/FormatSetter.php, line 46

Class

FormatSetter
Sets the 'api_json' format on all requests to JSON API-managed routes.

Namespace

Drupal\jsonapi\StackMiddleware

Code

public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
  if ($this
    ->isJsonApiRequest($request)) {
    $request
      ->setRequestFormat('api_json');
  }
  return $this->httpKernel
    ->handle($request, $type, $catch);
}