protected function isJsonMessage(HeaderBag $headers) { $headers = $headers->get('Content-Type', []); foreach ($headers as $header) { if (strpos($header, 'application/json') === 0) { return true; } } return false; }