EventListener/KernelSubscriber.php
public function onKernelResponse(FilterResponseEvent $event)
    {
        if ($event->isMasterRequest()) {
            $request = $event->getRequest();
            $response = $event->getResponse();

            if ($request->isXmlHttpRequest() && !$response->isRedirection()) {
                // flash messages
                if ($request->hasSession() && !$response->headers->has('X-Flash-Messages')) {
                    $this->setFlashMessageHeader($response, $request->getSession());
                }

                // title, fullTitle
                $this->setTitleHeaders($response);

                // exception info (debug only)
                if ($this->debug && $this->lastException) {
                    $this->setExceptionHeader($response, $this->lastException);
                    $this->lastException = null;
                }
            }
        }
    }
public function onKernelResponse(FilterResponseEvent $event)
    {
        if ($event->isMasterRequest()) {
            $request = $event->getRequest();
            $response = $event->getResponse();

            if ($request->isXmlHttpRequest() && !$response->isRedirection()) {
                // flash messages
                if ($request->hasSession() && !$response->headers->has('X-Flash-Messages')) {
                    $this->setFlashMessageHeader($response, $request->getSession());
                }

                // title, fullTitle
                $this->setTitleHeaders($response);

                // exception info (debug only)
                if ($this->debug && $this->lastException) {
                    $this->setExceptionHeader($response, $this->lastException);
                    $this->lastException = null;
                }
            }
        }
    }
On kernel response.

@param FilterResponseEvent $event