Skip to content

Commit

Permalink
Merge pull request #8 from Becklyn/content-type-crash
Browse files Browse the repository at this point in the history
Don't crash when no content-type is available
  • Loading branch information
Jannik Zschiesche authored Apr 17, 2019
2 parents 575e537 + d930857 commit bbc87e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Listener/MonitoringTokenListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ public function onResponse (FilterResponseEvent $event) : void
}

$response = $event->getResponse();
$contentType = $response->headers->get("Content-Type");

// skip if not HTML response
if (false === \strpos($response->headers->get("Content-Type"), "text/html"))
if (null === $contentType || false === \strpos($contentType, "text/html"))
{
return;
}
Expand All @@ -63,7 +64,7 @@ public function onResponse (FilterResponseEvent $event) : void
public static function getSubscribedEvents () : array
{
return [
KernelEvents::RESPONSE => "onResponse",
KernelEvents::RESPONSE => ["onResponse", -1000],
];
}
}

0 comments on commit bbc87e2

Please sign in to comment.