diff --git a/Symfony/src/Codebender/CompilerBundle/Controller/DefaultController.php b/Symfony/src/Codebender/CompilerBundle/Controller/DefaultController.php index 30a70c0..700e97c 100644 --- a/Symfony/src/Codebender/CompilerBundle/Controller/DefaultController.php +++ b/Symfony/src/Codebender/CompilerBundle/Controller/DefaultController.php @@ -63,13 +63,24 @@ public function indexAction($authorizationKey, $version) ]); } - $request = $this->getRequest()->getContent(); + $requestObject = $this->getRequest(); + $request = $requestObject->getContent(); if ($version == 'v1') { + // Custom headers used during library tests. + // They don't affect the compiler's response and make our life easier. + if ($requestObject->headers->get('X-Set-Exec-Time') == 'true') { + ini_set('max_execution_time', '30'); + } + $mongoProjectId = $requestObject->headers->get('X-Mongo-Id'); + //Get the compiler service /** @var CompilerHandler $compiler */ $compiler = $this->get('compiler_handler'); $reply = $compiler->main($request, $params); + if ($mongoProjectId != '') { + $reply['mongo-id'] = $mongoProjectId; + } return new JsonResponse($reply); }