public function onKernelResponse(FilterResponseEvent $e)
    {

        if (!$this->enabled) return;

        $response = $e->getResponse();

        //if supression is active, always return 200 no matter what
        $config = $e->getRequest()->attributes->get('_ac_web_service');

        if (!$config['negotiated']) {
            $config = $this->negotiateResponseFormat($e->getRequest(), $config);
        }

        if ($config['suppress_response_codes']) {
            $response = $response->setStatusCode(200);
        }

        //if JSONP, wrap use _callback param
        if ($config['is_jsonp']) {
            $response->headers->set('Content-Type', $this->formatHeaders['jsonp']);
            $response->setContent(sprintf("%s(%s);", $config['jsonp_callback'], $response->getContent()));
        }

        $e->getDispatcher()->dispatch(self::API_RESPONSE, $e);
    }
public function onKernelResponse(FilterResponseEvent $e)
    {

        if (!$this->enabled) return;

        $response = $e->getResponse();

        //if supression is active, always return 200 no matter what
        $config = $e->getRequest()->attributes->get('_ac_web_service');

        if (!$config['negotiated']) {
            $config = $this->negotiateResponseFormat($e->getRequest(), $config);
        }

        if ($config['suppress_response_codes']) {
            $response = $response->setStatusCode(200);
        }

        //if JSONP, wrap use _callback param
        if ($config['is_jsonp']) {
            $response->headers->set('Content-Type', $this->formatHeaders['jsonp']);
            $response->setContent(sprintf("%s(%s);", $config['jsonp_callback'], $response->getContent()));
        }

        $e->getDispatcher()->dispatch(self::API_RESPONSE, $e);
    }
public function onKernelResponse ( FilterResponseEvent $ e ) { if ( ! $ this -> enabled ) return ; $ response = $ e -> getResponse ( ) ; //if supression is active, always return 200 no matter what $ config = $ e -> getRequest ( ) -> attributes -> get ( '_ac_web_service' ) ; if ( ! $ config [ 'negotiated' ] ) { $ config = $ this -> negotiateResponseFormat ( $ e -> getRequest ( ) , $ config ) ; } if ( $ config [ 'suppress_response_codes' ] ) { $ response = $ response -> setStatusCode ( 200 ) ; } //if JSONP, wrap use _callback param if ( $ config [ 'is_jsonp' ] ) { $ response -> headers -> set ( 'Content-Type' , $ this -> formatHeaders [ 'jsonp' ] ) ; $ response -> setContent ( sprintf ( "%s(%s);" , $ config [ 'jsonp_callback' ] , $ response -> getContent ( ) ) ) ; } $ e -> getDispatcher ( ) -> dispatch ( self :: API_RESPONSE , $ e ) ; }
Called when a response object has been resolved.
Called when a response object has been resolved .