<?php

namespace Overblog\GraphBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;

class GraphController extends Controller
{
    public function endpointAction(Request $request)
    {
        $req = $this->get('overblog_graph.request_parser')->parse($request);
        $res = $this->get('overblog_graph.request_executor')->execute($req, []);

        $response = new JsonResponse($res->toArray(), 200);
        $response->headers->set('Content-Type', 'application/json');

        return $response;
    }
}

<?php

namespace Overblog\GraphBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;

class GraphController extends Controller
{
    public function endpointAction(Request $request)
    {
        $req = $this->get('overblog_graph.request_parser')->parse($request);
        $res = $this->get('overblog_graph.request_executor')->execute($req, []);

        return new JsonResponse($res->toArray(), 200);
    }
}

Add CORS preflight request support
Add CORS preflight request support
