public function beforeDispatch(Event $event)
    {
        $this->buildResponse($event);
        Configure::write('requestLogged', false);
        $request = $event->getData()['request'];
        if ('OPTIONS' === $request->getMethod()) {
            $event->stopPropagation();
            $response = $event->getData()['response'];
            $response->getStatusCode(200);

            return $response;
        }

        if (empty($request->getData())) {
//            $request->data = $request->input('json_decode', true);
        }
    }
public function beforeDispatch(Event $event)
    {
        $this->buildResponse($event);
        Configure::write('requestLogged', false);
        $request = $event->getData()['request'];
        if ('OPTIONS' === $request->getMethod()) {
            $event->stopPropagation();
            $response = $event->getData()['response'];
            $response->getStatusCode(200);

            return $response;
        }

        if (empty($request->getData())) {
//            $request->data = $request->input('json_decode', true);
        }
    }
public function beforeDispatch ( Event $ event ) { $ this -> buildResponse ( $ event ) ; Configure :: write ( 'requestLogged' , false ) ; $ request = $ event -> getData ( ) [ 'request' ] ; if ( 'OPTIONS' === $ request -> getMethod ( ) ) { $ event -> stopPropagation ( ) ; $ response = $ event -> getData ( ) [ 'response' ] ; $ response -> getStatusCode ( 200 ) ; return $ response ; } if ( empty ( $ request -> getData ( ) ) ) { //            $request->data = $request->input('json_decode', true); } }
Handles incoming request and its data.

@param Event $event The beforeDispatch event
Handles incoming request and its data .