Skip to content

Commit

Permalink
Do not modify a StreamedResponse (#214)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinreniers authored and Nyholm committed Jan 7, 2019
1 parent d3bb654 commit a546cae
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Listener/ResponseListener.php
Expand Up @@ -17,6 +17,7 @@
use Ekino\NewRelicBundle\NewRelic\NewRelicInteractorInterface;
use Ekino\NewRelicBundle\Twig\NewRelicExtension;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;

Expand Down Expand Up @@ -81,6 +82,9 @@ public function onKernelResponse(FilterResponseEvent $event): void
// Some requests might not want to get instrumented
if ($event->getRequest()->attributes->get('_instrument', true)) {
$response = $event->getResponse();
if ($response instanceof StreamedResponse) {
return;
}

// We can only instrument HTML responses
if ('text/html' === \substr($response->headers->get('Content-Type', ''), 0, 9)) {
Expand Down

0 comments on commit a546cae

Please sign in to comment.